Created
March 27, 2010 11:34
-
-
Save chrismcg/345965 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
" select at current indent level from http://vim.wikia.com/wiki/Visual_selection_of_indent_block | |
" modified for ruby to allow selecting the prev and next lines too for blocks | |
function! SelectIndent (blockmode) | |
let temp_var=indent(line(".")) | |
while indent(line(".")-1) >= temp_var | |
exe "normal k" | |
endwhile | |
if a:blockmode == "yes" | |
exe "normal k" | |
end | |
exe "normal V" | |
while indent(line(".")+1) >= temp_var | |
exe "normal j" | |
endwhile | |
if a:blockmode == "yes" | |
exe "normal j" | |
end | |
endfun | |
nmap gb :call SelectIndent("yes")<CR> | |
nmap gn :call SelectIndent("no")<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment