Created
June 19, 2012 16:27
-
-
Save AndrewRadev/2955105 to your computer and use it in GitHub Desktop.
Reindent the whole file
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
" Typing "++" reindents the whole file and restores the view (doesn't move the | |
" cursor or the viewport) | |
" | |
nnoremap ++ :call <SID>Reindent()<cr> | |
function! s:Reindent() | |
let saved_view = winsaveview() | |
normal! gg=G | |
call winrestview(saved_view) | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment