From 27b4bb99705ad9987a1661077bf8afedff668b2d Mon Sep 17 00:00:00 2001 From: ttyS3 Date: Sat, 4 Jun 2022 23:57:28 +0800 Subject: [PATCH] feat: map r to Incremental LSP rename command https://github.com/smjonas/inc-rename.nvim --- lua/config/nvim-lspconfig.lua | 1 - lua/config/nvim-tree.lua | 2 -- lua/plugins.lua | 7 +++++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lua/config/nvim-lspconfig.lua b/lua/config/nvim-lspconfig.lua index ad3b18a..7e98000 100644 --- a/lua/config/nvim-lspconfig.lua +++ b/lua/config/nvim-lspconfig.lua @@ -15,7 +15,6 @@ nnoremap { "wa", "lua vim.lsp.buf.add_workspace_folder()", sile nnoremap { "wr", "lua vim.lsp.buf.remove_workspace_folder()", silent = true } nnoremap { "wl", "lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))", silent = true } nnoremap { "D", "lua vim.lsp.buf.type_definition()", silent = true } -nnoremap { "rn", "lua vim.lsp.buf.rename()", silent = true } nnoremap { "", "lua vim.lsp.buf.rename()", silent = true } -- lspsaga currently can not popup with current name of the symbol in the popup -- https://github.com/glepnir/lspsaga.nvim/issues/186 diff --git a/lua/config/nvim-tree.lua b/lua/config/nvim-tree.lua index be8fad7..345a645 100644 --- a/lua/config/nvim-tree.lua +++ b/lua/config/nvim-tree.lua @@ -1,7 +1,5 @@ map { "", ":NvimTreeToggle" } nnoremap { "f", ":NvimTreeToggle" } -nnoremap { "r", ":NvimTreeRefresh" } -nnoremap { "ff", ":NvimTreeFindFile" } -- NvimTreeOpen and NvimTreeClose are also available if you need them -- a list of groups can be found at `:help nvim_tree_highlight` -- vim.cmd [[highlight NvimTreeFolderIcon guifg=#1b95e0]] diff --git a/lua/plugins.lua b/lua/plugins.lua index 1868597..ff158e2 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -134,6 +134,13 @@ return require("packer").startup { config = [[require('config.nvim-lspconfig')]], } + use { + "smjonas/inc-rename.nvim", + config = function() + require("inc_rename").setup() + vim.keymap.set("n", "r", ":IncRename ") + end, + } -- https://github.com/j-hui/fidget.nvim/blob/main/doc/fidget.md -- Standalone UI for nvim-lsp progress -- see https://github.com/j-hui/fidget.nvim/blob/main/lua/fidget/spinners.lua for predefined spinners