Created
August 25, 2009 13:17
-
-
Save hokaccha/174687 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! VisualCurrentIndentBlock() | |
let current_indent = indent('.') | |
let current_line = line('.') | |
let current_col = col('.') | |
let last_line = line('$') | |
let start_line = current_line | |
while start_line != 1 && current_indent == indent(start_line - 1) | |
let start_line = start_line - 1 | |
endwhile | |
let end_line = current_line | |
while end_line != last_line && current_indent == indent(end_line + 1) | |
let end_line = end_line + 1 | |
endwhile | |
call cursor(start_line, current_col) | |
normal V | |
call cursor(end_line, current_col) | |
endfunction | |
nnoremap gi :call VisualCurrentIndentBlock()<CR> | |
onoremap gi :normal gi<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment