[nvim] add option to ignore auto-formatting with coc for specific filetypes

This commit is contained in:
Dmytro Meleshko 2019-04-22 22:54:45 +03:00
parent 8f6cc82799
commit 636ca786f2

View file

@ -116,9 +116,18 @@ set wildignore+=.git,.svn,.hg,.DS_Store,*~
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()
call s:FixWhitespaceOnSave()
if IsCocEnabled() | silent CocFormat | endif
call s:FormatOnSave()
call s:CreateDirOnSave()
endfunction
augroup vimrc-on-save