summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZofia Szweda <sophies@disroot.org>2026-09-07 15:54:17 +0200
committerZofia Szweda <sophies@disroot.org>2026-09-07 15:54:17 +0200
commitcb2495305008964f4269bdb34903d6810dc63d7d (patch)
tree7cc7d93401fec99e196cfe3b260e2ea14694b2fd
parenteb8302033c8f816ecde471a07cd8fbf13505d389 (diff)
vim: lsp format fallback option instead of an index with languages that can format
-rw-r--r--vim/.vimrc8
1 files 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('<Space>', '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 <buffer> [g :LspDiagPrev<CR>
nmap <buffer> ]g :LspDiagNext<CR>
nmap <buffer> K :LspHover<CR>
-if index(['python', 'c', 'cpp', 'objc', 'objcpp',
- \ 'javascript', 'javascript.jsx', 'javascriptreact'], &filetype) >= 0
- autocmd BufWritePre <buffer> LspFormat
-endif
+autocmd BufWritePre <buffer> 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/<!doctype html>/<!DOCTYPE html>/e
endif
call winrestview(l:view)
endfunction