diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua index c3d9704..379ad64 100644 --- a/.config/nvim/lua/settings.lua +++ b/.config/nvim/lua/settings.lua @@ -22,19 +22,19 @@ packer.use { } -- remove trailing whitespace -function remove_trailing_whitespace() +function my_remove_trailing_whitespace() local curpos = vim.api.nvim_win_get_cursor(0) vim.cmd([[keeppatterns %s/\s\+$//e]]) vim.api.nvim_win_set_cursor(0, curpos) end vim.api.nvim_create_autocmd( - { "BufWritePre" }, + { 'BufWritePre' }, { pattern = { - "*.lua", "*.cpp", "*.hpp" + '*.lua', '*.cpp', '*.hpp' }, - command = 'lua remove_trailing_whitespace()' + callback = my_remove_trailing_whitespace } )