summaryrefslogtreecommitdiffstats
path: root/.config/nvim/lua/hooks.lua
diff options
context:
space:
mode:
authorJoe <bousset.rudy@gmail.com>2024-06-16 16:44:30 +0200
committerJoe <bousset.rudy@gmail.com>2024-06-16 16:44:30 +0200
commit0e2060752fa22ab14dfd52101fe7b25baf39d4af (patch)
tree12f62dfe64f99ea978808ff95f1a3aba567f569f /.config/nvim/lua/hooks.lua
parentmailup (diff)
downloaddotfiles-bsd-0e2060752fa22ab14dfd52101fe7b25baf39d4af.tar.gz
dotfiles-bsd-0e2060752fa22ab14dfd52101fe7b25baf39d4af.tar.bz2
dotfiles-bsd-0e2060752fa22ab14dfd52101fe7b25baf39d4af.tar.xz
dotfiles-bsd-0e2060752fa22ab14dfd52101fe7b25baf39d4af.tar.zst
dotfiles-bsd-0e2060752fa22ab14dfd52101fe7b25baf39d4af.zip
up
Diffstat (limited to '.config/nvim/lua/hooks.lua')
-rw-r--r--.config/nvim/lua/hooks.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/.config/nvim/lua/hooks.lua b/.config/nvim/lua/hooks.lua
index 0d5ed32..eaf0687 100644
--- a/.config/nvim/lua/hooks.lua
+++ b/.config/nvim/lua/hooks.lua
@@ -1,4 +1,8 @@
vim.api.nvim_create_autocmd({"BufWritePre"}, {
pattern = "*",
- command = [[%s/\s\+$//e]],
+ callback = function(ev)
+ save_cursor = vim.fn.getpos(".")
+ vim.cmd([[%s/\s\+$//e]])
+ vim.fn.setpos(".", save_cursor)
+ end,
})