[vim] Stabilize cursor while reflowing paragraph

This commit is contained in:
lhark 2019-04-01 14:31:05 -04:00
parent 52cd05d395
commit 68929a5ae8

10
vimrc
View file

@ -170,7 +170,7 @@ nnoremap // :nohlsearch<CR>
map Q gq
"[Reflow current paragraph]"
"[http://stevelosh.com/blog/2010/09/coming-home-to-vim/]"
nnoremap <leader>q gqip
nnoremap <silent> <leader>q :call ReflowParagraph()<CR>
" http://stackoverflow.com/questions/1005/getting-root-permissions-on-a-file-inside-of-vi
cmap w!! w !sudo tee >/dev/null %
"[To disable the arrow keys]"
@ -200,7 +200,13 @@ if &t_Co > 2 || has("gui_running")
" Revert with ":unlet c_comment_strings".
let c_comment_strings=1
endif
"
"[Reflow current paragraph]"
function! ReflowParagraph()
let l:view = winsaveview()
normal gqip
call winrestview(l:view)
endfunction
"[Remove tabs and spaces at the end of lines]"
function! DeleteTrailingTWS()
if &ft =~ 'diff'