Skip to content

Instantly share code, notes, and snippets.

@nisaacson
Last active August 29, 2015 14:02
Show Gist options
  • Save nisaacson/4e17cb6abc4345833416 to your computer and use it in GitHub Desktop.
Save nisaacson/4e17cb6abc4345833416 to your computer and use it in GitHub Desktop.
Align code on the = sign with a key mapping using the EasyAlign Plugin https://github.com/junegunn/vim-easy-align
Bundle 'junegunn/vim-easy-align'
map <Leader>r :call EnterAlign()<cr>
function! EnterAlign()
let save_cursor = getpos(".")
let l:win_view = winsaveview()
:execute "normal vip\<Enter>="
call winrestview(l:win_view)
call setpos('.', save_cursor)
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment