nvim: move whitespace function to functions.lua

This commit is contained in:
tastytea 2022-08-09 11:26:00 +02:00
parent cb15d8ab62
commit aa041079c5
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM
3 changed files with 17 additions and 17 deletions

View File

@ -1,4 +1,5 @@
require('plugins')
require('functions')
require('settings')
require('keymaps')
require('fileformats')

View 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
}
)

View File

@ -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