From 7b3f69cf6662679c989596aa933df2c86b1a4f02 Mon Sep 17 00:00:00 2001 From: ViViDboarder Date: Thu, 16 Dec 2021 14:41:07 -0800 Subject: [PATCH] Update bindings for formatting and range formatting with an lsp prefix (l) --- neovim/lua/plugins/lsp.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/neovim/lua/plugins/lsp.lua b/neovim/lua/plugins/lsp.lua index efa643f..f3436e9 100644 --- a/neovim/lua/plugins/lsp.lua +++ b/neovim/lua/plugins/lsp.lua @@ -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", "f", "lua vim.lsp.buf.formatting()", opts) + buf_set_keymap("n", "lf", "lua vim.lsp.buf.formatting()", opts) vim.cmd([[ augroup lsp_format autocmd! @@ -89,8 +89,9 @@ local function default_attach(client, bufnr) " autocmd BufWritePre lua vim.lsp.buf.formatting_sync(nil, 1000) augroup END ]]) - elseif client.resolved_capabilities.document_range_formatting then - buf_set_keymap("n", "f", "lua vim.lsp.buf.range_formatting()", opts) + end + if client.resolved_capabilities.document_range_formatting then + buf_set_keymap("n", "lfr", "lua vim.lsp.buf.range_formatting()", opts) end -- Set autocommands conditional on server_capabilities