diff options
| author | Zofia Szweda <sophies@disroot.org> | 2026-09-07 15:54:17 +0200 |
|---|---|---|
| committer | Zofia Szweda <sophies@disroot.org> | 2026-09-07 15:54:17 +0200 |
| commit | cb2495305008964f4269bdb34903d6810dc63d7d (patch) | |
| tree | 7cc7d93401fec99e196cfe3b260e2ea14694b2fd /vim | |
| parent | eb8302033c8f816ecde471a07cd8fbf13505d389 (diff) | |
vim: lsp format fallback option instead of an index with languages that can format
Diffstat (limited to 'vim')
| -rw-r--r-- | vim/.vimrc | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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 |
