some more fixes for different nvim versions

This commit is contained in:
2022-09-10 13:39:45 +02:00
parent c19072c4cd
commit 612ec0cbe6
3 changed files with 38 additions and 27 deletions

View File

@@ -63,7 +63,11 @@ local on_attach = function(client, bufnr)
-- Set some keybinds conditional on server capabilities
if client.server_capabilities.documentFormattingProvider then
vim.keymap.set('n', '<space>f', vim.lsp.buf.format, opts)
if vim.version().minor >= 8 then
vim.keymap.set('n', '<space>f', vim.lsp.buf.format, opts)
else
vim.keymap.set('n', '<space>f', vim.lsp.buf.formatting, opts)
end
end
if client.server_capabilities.documentRangeFormattingProvider then
vim.keymap.set('v', '<space>f', vim.lsp.buf.range_formatting, opts)