mirror of
https://github.com/jessebot/dot_files.git
synced 2025-10-01 01:48:43 +00:00
delete whitespace on save in neovim
This commit is contained in:
parent
2e3d5e2935
commit
eef0cbdf69
1 changed files with 10 additions and 0 deletions
|
@ -116,6 +116,16 @@ vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, {
|
|||
end,
|
||||
})
|
||||
|
||||
-- delete whitespace - https://vi.stackexchange.com/a/41388
|
||||
vim.api.nvim_create_autocmd({ "BufWritePre" }, {
|
||||
pattern = {"*"},
|
||||
callback = function()
|
||||
local save_cursor = vim.fn.getpos(".")
|
||||
pcall(function() vim.cmd [[%s/\s\+$//e]] end)
|
||||
vim.fn.setpos(".", save_cursor)
|
||||
end,
|
||||
})
|
||||
|
||||
require('user.tree-sitter')
|
||||
|
||||
-- folding and indentation
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue