nvim: add nvim configs

This commit is contained in:
inkch
2024-01-14 23:03:03 +09:00
parent 6339cdb490
commit 4446e72a04
19 changed files with 274 additions and 0 deletions

View File

@ -0,0 +1,27 @@
-- Trim
vim.cmd([[
command! Trim call TrimSpace()
function! TrimSpace()
let save_cursor = getpos(".")
%s#\ \+$##e
%s#\($\n\s*\)\+\%$##e
call setpos('.', save_cursor)
endfunction
command! TrimDisable call TrimAuto(0)
command! TrimEnable call TrimAuto(1)
function! TrimAuto(enable)
if a:enable == 1
augroup TrimAuto
au!
au BufWritePre * Trim " See: ~/.config/nvim/functions/Trim.vim
augroup END
else
augroup TrimAuto
au!
augroup END
endif
endfunction
call TrimAuto(1)
]])