Update bindings for formatting and range formatting with an lsp prefix (l)

This commit is contained in:
ViViDboarder 2021-12-16 14:41:07 -08:00
parent 1eee1c727f
commit 7b3f69cf66

View File

@ -81,7 +81,7 @@ local function default_attach(client, bufnr)
-- Set some keybinds conditional on server capabilities
if client.resolved_capabilities.document_formatting then
buf_set_keymap("n", "<leader>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
buf_set_keymap("n", "<leader>lf", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
vim.cmd([[
augroup lsp_format
autocmd!
@ -89,8 +89,9 @@ local function default_attach(client, bufnr)
" autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync(nil, 1000)
augroup END
]])
elseif client.resolved_capabilities.document_range_formatting then
buf_set_keymap("n", "<leader>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
end
if client.resolved_capabilities.document_range_formatting then
buf_set_keymap("n", "<leader>lfr", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
end
-- Set autocommands conditional on server_capabilities