summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrahmajit Das <brahmajit.xyz@gmail.com>2024-06-26 13:40:02 +0530
committerBrahmajit Das <brahmajit.xyz@gmail.com>2024-06-26 13:40:02 +0530
commit1a11adcf54c1b47f9f31656be92957596ab29a8b (patch)
treed06fefad2f74eedf6bbfe2d2f8a124ed689e3119
parentfceb04e5a2c67360e91d1ae02cf8897c8ecbe10b (diff)
nvim: lua: lsp: Allow formatting in normal and visual mode
Previously formatting was only allowed in normal mode, as a result range formatting or formatting of only selected region was not possible. Thus enabling formatting in visual mode makes it more convinient. Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
-rw-r--r--lua/plugins/lsp.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua
index 82244d1..33de12e 100644
--- a/lua/plugins/lsp.lua
+++ b/lua/plugins/lsp.lua
@@ -60,7 +60,7 @@ vim.api.nvim_create_autocmd('LspAttach', {
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
vim.keymap.set({ 'n', 'v' }, '<leader>ca', vim.lsp.buf.code_action, opts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
- vim.keymap.set('n', '<leader>f', function()
+ vim.keymap.set({ 'n', 'v' }, '<leader>f', function()
vim.lsp.buf.format { async = true }
end, opts)
end,