* Resets cursor position on file save (Issue #1040) * Resets cursor pos on save. (line and column)
This commit is contained in:
parent
ed9a67ed6d
commit
a01c9f967b
1 changed files with 3 additions and 1 deletions
|
@ -111,10 +111,12 @@ set noshowcmd
|
||||||
autocmd BufRead,BufNewFile /tmp/neomutt* map ZZ :Goyo\|x!<CR>
|
autocmd BufRead,BufNewFile /tmp/neomutt* map ZZ :Goyo\|x!<CR>
|
||||||
autocmd BufRead,BufNewFile /tmp/neomutt* map ZQ :Goyo\|q!<CR>
|
autocmd BufRead,BufNewFile /tmp/neomutt* map ZQ :Goyo\|q!<CR>
|
||||||
|
|
||||||
" Automatically deletes all trailing whitespace and newlines at end of file on save.
|
" Automatically deletes all trailing whitespace and newlines at end of file on save. & reset cursor position
|
||||||
|
autocmd BufWritePre * let currPos = getpos(".")
|
||||||
autocmd BufWritePre * %s/\s\+$//e
|
autocmd BufWritePre * %s/\s\+$//e
|
||||||
autocmd BufWritePre * %s/\n\+\%$//e
|
autocmd BufWritePre * %s/\n\+\%$//e
|
||||||
autocmd BufWritePre *.[ch] %s/\%$/\r/e
|
autocmd BufWritePre *.[ch] %s/\%$/\r/e
|
||||||
|
autocmd BufWritePre * cal cursor(currPos[1], currPos[2])
|
||||||
|
|
||||||
" When shortcut files are updated, renew bash and ranger configs with new material:
|
" When shortcut files are updated, renew bash and ranger configs with new material:
|
||||||
autocmd BufWritePost bm-files,bm-dirs !shortcuts
|
autocmd BufWritePost bm-files,bm-dirs !shortcuts
|
||||||
|
|
Loading…
Reference in a new issue