fix(vim): problem with LSP and prettier

This commit is contained in:
Stefan Imhoff
2021-12-20 15:54:03 +01:00
parent d6743abe7a
commit d0eaecece3
6 changed files with 22 additions and 26 deletions

View File

@@ -1,6 +1,7 @@
" lspconfig
" https://github.com/neovim/nvim-lspconfig
" Mappings
nnoremap <silent> <C-k> <cmd>lua vim.lsp.buf.signature_help()<CR>
nnoremap <silent> <leader>D <cmd>lua vim.lsp.buf.type_definition()<CR>
nnoremap <silent> <leader>e <cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>

View File

@@ -61,18 +61,3 @@ lsp_installer.on_server_ready(function(server)
vim.cmd([[do User LspAttachBuffers]])
end)
--- Global function to install servers automatically
function _G.lsp_install_sync()
local lsp_installer_servers = require("nvim-lsp-installer.servers")
local requested = {}
for server_name, _ in pairs(servers) do
local ok, server = lsp_installer_servers.get_server(server_name)
if ok and not server:is_installed() then
table.insert(requested, server_name)
end
end
lsp_installer.install_sync(requested)
end

View File

@@ -0,0 +1,17 @@
" Neoformat
" https://github.com/sbdchd/neoformat
" Settings
let g:neoformat_try_node_exe = 1
let g:neoformat_basic_format_align = 1 " Enable alignment
let g:neoformat_basic_format_retab = 1 " Enable tab to spaces conversion
let g:neoformat_basic_format_trim = 1 " Enable trimmming of trailing whitespace
" Mappings
nnoremap <silent> nf <cmd>Neoformat<CR>
" Auto Commands
augroup fmt
autocmd!
autocmd BufWritePre * undojoin | Neoformat
augroup END