nvim: move whitespace function to functions.lua
This commit is contained in:
parent
cb15d8ab62
commit
aa041079c5
|
@ -1,4 +1,5 @@
|
|||
require('plugins')
|
||||
require('functions')
|
||||
require('settings')
|
||||
require('keymaps')
|
||||
require('fileformats')
|
||||
|
|
16
.config/nvim/lua/functions.lua
Normal file
16
.config/nvim/lua/functions.lua
Normal file
|
@ -0,0 +1,16 @@
|
|||
-- 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' },
|
||||
{
|
||||
pattern = {
|
||||
'*.lua', '*.cpp', '*.hpp'
|
||||
},
|
||||
callback = my_remove_trailing_whitespace
|
||||
}
|
||||
)
|
|
@ -22,23 +22,6 @@ packer.use {
|
|||
end
|
||||
}
|
||||
|
||||
-- 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' },
|
||||
{
|
||||
pattern = {
|
||||
'*.lua', '*.cpp', '*.hpp'
|
||||
},
|
||||
callback = my_remove_trailing_whitespace
|
||||
}
|
||||
)
|
||||
|
||||
packer.use 'https://github.com/editorconfig/editorconfig-vim'
|
||||
|
||||
-- set colorcolumn to textwidth after buffer is displayed or option is changed
|
||||
|
|
Loading…
Reference in New Issue
Block a user