Skip to content

Commit

Permalink
offside text object
Browse files Browse the repository at this point in the history
  • Loading branch information
dag committed May 22, 2012
1 parent ac0ba18 commit a5af646
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions plugin/offside.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
function! s:InnerOffside() " {{{
let l:line = line('.')
let l:indent = indent(l:line)
for l:start in range(l:line, 0, -1)
if indent(l:start) <# l:indent
break
endif
endfor
for l:end in range(l:line, line('$') + 1)
if indent(l:end) <# l:indent
break
endif
endfor
return (l:start + 1) . 'GV' . (l:end - 1) . 'G'
endfunction " }}}


vnoremap <expr> <Plug>InnerOffside <SID>InnerOffside()
if !hasmapto('<Plug>InnerOffside')
vmap <unique> <silent> io <Plug>InnerOffside
onoremap <unique> <silent> io :normal vio<cr>
endif

0 comments on commit a5af646

Please sign in to comment.