From b46408a64a5fa3528ce3589bb0456096418278ad Mon Sep 17 00:00:00 2001 From: tastytea Date: Mon, 8 Aug 2022 22:13:19 +0200 Subject: [PATCH] nvim: call lua function directly in autogroup --- .config/nvim/lua/settings.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 } )