mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
[nvim] add option to ignore auto-formatting with coc for specific filetypes
This commit is contained in:
parent
8f6cc82799
commit
636ca786f2
1 changed files with 10 additions and 1 deletions
|
@ -116,9 +116,18 @@ set wildignore+=.git,.svn,.hg,.DS_Store,*~
|
||||||
endfunction
|
endfunction
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
|
" auto-format with Coc.nvim {{{
|
||||||
|
let g:coc_format_on_save_ignore = []
|
||||||
|
function s:FormatOnSave()
|
||||||
|
if index(g:coc_format_on_save_ignore, &filetype) < 0 && IsCocEnabled()
|
||||||
|
silent CocFormat
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
" }}}
|
||||||
|
|
||||||
function s:OnSave()
|
function s:OnSave()
|
||||||
call s:FixWhitespaceOnSave()
|
call s:FixWhitespaceOnSave()
|
||||||
if IsCocEnabled() | silent CocFormat | endif
|
call s:FormatOnSave()
|
||||||
call s:CreateDirOnSave()
|
call s:CreateDirOnSave()
|
||||||
endfunction
|
endfunction
|
||||||
augroup vimrc-on-save
|
augroup vimrc-on-save
|
||||||
|
|
Loading…
Reference in a new issue