Allow to disable trailing spaces removal for certain languages
This commit is contained in:
+9
-5
@@ -40,12 +40,16 @@ vim.opt.updatetime = 300
|
||||
vim.opt.list = true
|
||||
vim.opt.listchars = { trail = '·', tab = ' ', nbsp = '¬' }
|
||||
|
||||
-- Auto remove trailing spaces
|
||||
-- Auto remove trailing spaces for allowed files
|
||||
vim.g.trim_trailing_spaces_exclude = {}
|
||||
vim.api.nvim_create_autocmd({'BufWritePre'}, {
|
||||
pattern = {'*'},
|
||||
callback = function(ev)
|
||||
vim.cmd('%s/\\s\\+$//e')
|
||||
end
|
||||
pattern = {'*'},
|
||||
callback = function(ev)
|
||||
local excludes = vim.g.trim_trailing_spaces_exclude or {}
|
||||
if not vim.tbl_contains(excludes, vim.bo.filetype) then
|
||||
vim.cmd('%s/\\s\\+$//e')
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
-- COLOR --
|
||||
|
||||
Reference in New Issue
Block a user