cfm formatter lsp
This commit is contained in:
parent
deecd96cc9
commit
2a36ef6c0b
2 changed files with 20 additions and 0 deletions
|
|
@ -9,6 +9,22 @@ end
|
||||||
nvim_lsp.rust_analyzer.setup({ on_attach=on_attach })
|
nvim_lsp.rust_analyzer.setup({ on_attach=on_attach })
|
||||||
nvim_lsp.gopls.setup({ on_attach=on_attach })
|
nvim_lsp.gopls.setup({ on_attach=on_attach })
|
||||||
nvim_lsp.pyright.setup({ on_attach=on_attach })
|
nvim_lsp.pyright.setup({ on_attach=on_attach })
|
||||||
|
nvim_lsp.clangd.setup({ on_attach=on_attach })
|
||||||
|
|
||||||
|
nvim_lsp.efm.setup {
|
||||||
|
init_options = {documentFormatting = true},
|
||||||
|
settings = {
|
||||||
|
rootMarkers = {".git/"},
|
||||||
|
languages = {
|
||||||
|
lua = {
|
||||||
|
{ formatCommand = "lua-format -i", formatStdin = true }
|
||||||
|
},
|
||||||
|
python = {
|
||||||
|
{ formatCommand = 'black --quiet -', formatStdin = true }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
-- Enable diagnostics
|
-- Enable diagnostics
|
||||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
||||||
|
|
|
||||||
4
.vimrc
4
.vimrc
|
|
@ -304,6 +304,10 @@ set updatetime=500
|
||||||
" Show diagnostic popup on cursor hold
|
" Show diagnostic popup on cursor hold
|
||||||
autocmd CursorHold * lua vim.lsp.diagnostic.show_line_diagnostics({show_header = false, focusable = false})
|
autocmd CursorHold * lua vim.lsp.diagnostic.show_line_diagnostics({show_header = false, focusable = false})
|
||||||
|
|
||||||
|
" Autoformat on save
|
||||||
|
autocmd BufWritePre *.lua lua vim.lsp.buf.formatting_sync(nil, 1000)
|
||||||
|
autocmd BufWritePre *.py lua vim.lsp.buf.formatting_sync(nil, 1000)
|
||||||
|
|
||||||
" Goto previous/next diagnostic warning/error
|
" Goto previous/next diagnostic warning/error
|
||||||
nnoremap <silent> g[ <cmd>lua vim.lsp.diagnostic.goto_prev()<CR>
|
nnoremap <silent> g[ <cmd>lua vim.lsp.diagnostic.goto_prev()<CR>
|
||||||
nnoremap <silent> g] <cmd>lua vim.lsp.diagnostic.goto_next()<CR>
|
nnoremap <silent> g] <cmd>lua vim.lsp.diagnostic.goto_next()<CR>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue