13 lines
420 B
Lua
13 lines
420 B
Lua
-- Autocmds are automatically loaded on the VeryLazy event
|
|
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
|
|
|
|
-- Strip trailing whitespace on save
|
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
|
pattern = "*",
|
|
callback = function()
|
|
local view = vim.fn.winsaveview()
|
|
vim.cmd([[keeppatterns %s/\s\+$//e]])
|
|
vim.fn.winrestview(view)
|
|
end,
|
|
})
|