nvim: fix lsp formatting
Anirudh Oppiliappan x@icyphox.sh
Thu, 15 Dec 2022 08:53:25 +0530
4 files changed,
5 insertions(+),
3 deletions(-)
M
config/nvim/_init.lua
→
config/nvim/_init.lua
@@ -17,6 +17,7 @@ require 'lsp.go'
require 'lsp.lua' require 'lsp.json' require 'lsp.js' +require 'lsp.rust' -- plugins not in nixpkgs require 'packer'.startup(function(use)
M
config/nvim/ftplugin/go.vim
→
config/nvim/ftplugin/go.vim
@@ -23,8 +23,8 @@ end
end EOF -augroup go_lsp +augroup go_lsp autocmd! - autocmd BufWritePre *.go :silent! lua vim.lsp.buf.formatting() + autocmd BufWritePre *.go :silent! lua vim.lsp.buf.format() autocmd BufWritePre *.go :silent! lua org_imports(3000) augroup END
M
config/nvim/lua/maps.lua
→
config/nvim/lua/maps.lua
@@ -90,7 +90,7 @@ buf_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', options)
buf_set_keymap('n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', options) if client.server_capabilities.document_formatting then - buf_set_keymap('n', 'ff', '<cmd>lua vim.lsp.buf.formatting()<CR>', options) + buf_set_keymap('n', 'ff', '<cmd>lua vim.lsp.buf.format()<CR>', options) elseif client.server_capabilities.document_range_formatting then buf_set_keymap('n', 'ff', '<cmd>lua vim.lsp.buf.range_formatting()<CR>', options) end