Created
February 23, 2011 02:47
-
-
Save jeffmccune/839899 to your computer and use it in GitHub Desktop.
In your Vim RC
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
" ~/.vim/ftplugin/puppet.vim | |
" | |
" Requires Align VIM plugin: | |
" http://mysite.verizon.net/astronaut/vim/align.html | |
" With a visual block selected, align =>'s | |
vmap . :Align =><CR> | |
" Function to save cursor position, select the block, and align =>'s | |
function! AlignFats() | |
let save_cursor = getpos(".") | |
call SelectIndent() | |
exe "norm ." | |
call setpos('.', save_cursor) | |
endfun | |
" Bind the comma to align all fats in the current resource. | |
noremap , :call AlignFats()<CR> |
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
" The goal here is to select the current block with space, | |
" and align everything with the dot key. | |
" ~/.vimrc | |
" Visually select current indent level and greater. | |
" http://vim.wikia.com/wiki/VimTip1014 | |
" Bind the function to the spacebar | |
function! SelectIndent () | |
let temp_var=indent(line(".")) | |
while indent(line(".")-1) >= temp_var | |
exe "normal k" | |
endwhile | |
exe "normal V" | |
while indent(line(".")+1) >= temp_var | |
exe "normal j" | |
endwhile | |
endfun | |
" Map space to visual-block-line select the current indent level | |
nmap <Space> :call SelectIndent()<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment