From a5af646e759a09627a28020db68ce2a705d7f1ec Mon Sep 17 00:00:00 2001 From: Dag Odenhall Date: Tue, 22 May 2012 17:04:32 +0200 Subject: [PATCH] offside text object --- plugin/offside.vim | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 plugin/offside.vim diff --git a/plugin/offside.vim b/plugin/offside.vim new file mode 100644 index 0000000..0644d5c --- /dev/null +++ b/plugin/offside.vim @@ -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 InnerOffside InnerOffside() + +if !hasmapto('InnerOffside') + vmap io InnerOffside + onoremap io :normal vio +endif