From 4cdadaaaf93a6b8775e4c6e66a3978366ce13c8a Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Tue, 30 Apr 2024 09:05:57 +0200 Subject: [PATCH] Add LSP rename command --- vim/lua/lsp/attach.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vim/lua/lsp/attach.lua b/vim/lua/lsp/attach.lua index 602d038..67f7647 100644 --- a/vim/lua/lsp/attach.lua +++ b/vim/lua/lsp/attach.lua @@ -38,4 +38,12 @@ return function(_, bufnr) vim.api.nvim_buf_create_user_command(bufnr, "LspWorkspaces", function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, {}) + + vim.api.nvim_buf_create_user_command(bufnr, "Rename", function(params) + if #params.fargs > 0 then + vim.lsp.buf.rename(params.fargs[1]) + else + vim.lsp.buf.rename() + end + end, {nargs = "?"}) end