diff options
| author | Fabian <58243358+FabianPaci@users.noreply.github.com> | 2021-12-21 02:11:17 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-20 10:11:17 -0500 |
| commit | a01c9f967b8801b9917be0f270f1cf9b9655e770 (patch) | |
| tree | bab9dbb8b14f82c04fb5c7ef2d6dfcc1383e3254 /.config/nvim | |
| parent | ed9a67ed6dbd408032f51f34a471362264c47e1c (diff) | |
| download | eibhear-a01c9f967b8801b9917be0f270f1cf9b9655e770.tar.gz eibhear-a01c9f967b8801b9917be0f270f1cf9b9655e770.tar.zst eibhear-a01c9f967b8801b9917be0f270f1cf9b9655e770.zip | |
Resets cursor position on file save (Issue #1040) (#1057)
* Resets cursor position on file save (Issue #1040)
* Resets cursor pos on save. (line and column)
Diffstat (limited to '.config/nvim')
| -rw-r--r-- | .config/nvim/init.vim | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index f93eed4..e32b8eb 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -111,10 +111,12 @@ set noshowcmd autocmd BufRead,BufNewFile /tmp/neomutt* map ZZ :Goyo\|x!<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/\n\+\%$//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: autocmd BufWritePost bm-files,bm-dirs !shortcuts |
