From cb2495305008964f4269bdb34903d6810dc63d7d Mon Sep 17 00:00:00 2001 From: Zofia Szweda Date: Mon, 7 Sep 2026 15:54:17 +0200 Subject: vim: lsp format fallback option instead of an index with languages that can format --- vim/.vimrc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vim/.vimrc b/vim/.vimrc index 8cab076..a92c9db 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -85,6 +85,7 @@ call which_key#register('', 'g:which_key_map') autocmd User LspSetup call LspOptionsSet(#{ \ autoComplete: v:true, \ autoHighlightDiags: v:true, + \ formatFallbck: v:true, \ }) autocmd User LspSetup call LspAddServer([ @@ -109,10 +110,7 @@ function! s:lsp_keymaps() abort nmap [g :LspDiagPrev nmap ]g :LspDiagNext nmap K :LspHover -if index(['python', 'c', 'cpp', 'objc', 'objcpp', - \ 'javascript', 'javascript.jsx', 'javascriptreact'], &filetype) >= 0 - autocmd BufWritePre LspFormat -endif +autocmd BufWritePre LspFormat endfunction function! s:prettier_format() abort if !executable('prettier') @@ -123,6 +121,8 @@ function! s:prettier_format() abort if v:shell_error silent undo echohl ErrorMsg | echom 'formatting failed' + else + silent! 1s///e endif call winrestview(l:view) endfunction -- cgit v1.2.3