mirror of
https://github.com/ViViDboarder/vim-settings.git
synced 2024-12-23 04:47:36 +00:00
Update bindings for formatting and range formatting with an lsp prefix (l)
This commit is contained in:
parent
1eee1c727f
commit
7b3f69cf66
@ -81,7 +81,7 @@ local function default_attach(client, bufnr)
|
|||||||
|
|
||||||
-- Set some keybinds conditional on server capabilities
|
-- Set some keybinds conditional on server capabilities
|
||||||
if client.resolved_capabilities.document_formatting then
|
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([[
|
vim.cmd([[
|
||||||
augroup lsp_format
|
augroup lsp_format
|
||||||
autocmd!
|
autocmd!
|
||||||
@ -89,8 +89,9 @@ local function default_attach(client, bufnr)
|
|||||||
" autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync(nil, 1000)
|
" autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync(nil, 1000)
|
||||||
augroup END
|
augroup END
|
||||||
]])
|
]])
|
||||||
elseif client.resolved_capabilities.document_range_formatting then
|
end
|
||||||
buf_set_keymap("n", "<leader>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
|
if client.resolved_capabilities.document_range_formatting then
|
||||||
|
buf_set_keymap("n", "<leader>lfr", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Set autocommands conditional on server_capabilities
|
-- Set autocommands conditional on server_capabilities
|
||||||
|
Loading…
Reference in New Issue
Block a user