diff --git a/README.md b/README.md index f205dcd..8c12ecd 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,8 @@ variable is # Features: - LSP easy setup. Support the most commonly used lsp clients setup. Dynamic lsp activation based on buffer type. This -also enables you to handle workspace with mixed types of codes (e.g. Go + javascript + yml) +also enables you to handle workspace with mixed types of codes (e.g. Go + javascript + yml). A better default setup is +included for LSP clients. - Out of box experience. 10 lines of minimum vimrc can turn your neovim into a full-featured LSP & Treesitter powered IDE @@ -260,7 +261,8 @@ require.'navigator'.setup({ | n | K | hover doc | | n | ga | code action (when you see 💡 ) | | v | ga | range code action (when you see 💡 ) | -| n | \re | rename| +| n | \re | rename (lsp default)| +| n | \re | rename with floating window| | n | \gi | incoming calls| | n | \go | outgoing calls| | n | gi | implementation | diff --git a/lua/navigator/lspclient/highlight.lua b/lua/navigator/lspclient/highlight.lua index b3add54..d209cfc 100644 --- a/lua/navigator/lspclient/highlight.lua +++ b/lua/navigator/lspclient/highlight.lua @@ -24,7 +24,7 @@ function M.add_highlight() api.nvim_command("hi! link LspDiagnosticsUnderlineWarning SpellRare") api.nvim_command("hi! link LspDiagnosticsUnderlineInformation SpellRare") api.nvim_command("hi! link LspDiagnosticsUnderlineHint SpellRare") - api.nvim_command("hi def link DefinitionPreviewTitle Title") + api.nvim_command("hi def link NGPreviewTitle Title") local colors = { {'#aefe00', '#aede00', '#aebe00', '#4e7efe'}, {'#ff00e0', '#df00e0', '#af00e0', '#fedefe'}, diff --git a/lua/navigator/lspclient/mapping.lua b/lua/navigator/lspclient/mapping.lua index 51f46ba..8407598 100644 --- a/lua/navigator/lspclient/mapping.lua +++ b/lua/navigator/lspclient/mapping.lua @@ -33,7 +33,7 @@ local key_maps = { {key = "K", func = "hover({ popup_opts = { border = single }})"}, {key = "ga", mode = "n", func = "code_action()"}, {key = "ga", mode = "v", func = "range_code_action()"}, {key = "re", func = "rename()"}, - {key = "rn", func = "require('navigator.rename').rename()"}, + {key = "re", func = "require('navigator.rename').rename()"}, {key = "gi", func = "incoming_calls()"}, {key = "go", func = "outgoing_calls()"}, {key = "gi", func = "implementation()"}, {key = "gt", func = "type_definition()"}, {key = "gL", func = "diagnostic.show_line_diagnostics({ popup_opts = { border = single }})"}, diff --git a/lua/navigator/rename.lua b/lua/navigator/rename.lua index b2c343b..d2d52ec 100644 --- a/lua/navigator/rename.lua +++ b/lua/navigator/rename.lua @@ -8,11 +8,12 @@ M.rename = function() local bufnr = vim.api.nvim_create_buf(false, true) vim.api.nvim_buf_set_option(bufnr, "buftype", "prompt") vim.api.nvim_buf_set_option(bufnr, "bufhidden", "wipe") - vim.api.nvim_buf_add_highlight(bufnr, -1, "RenamePrompt", 0, 0, #rename_prompt) + vim.api.nvim_buf_add_highlight(bufnr, -1, "NGPreviewTitle", 0, 0, #rename_prompt) vim.fn.prompt_setprompt(bufnr, rename_prompt) + local width = #current_name + #rename_prompt + 10 local winnr = vim.api.nvim_open_win(bufnr, true, { relative = "cursor", - width = 50, + width = width, height = 1, row = -3, col = 1, @@ -38,6 +39,5 @@ M.callback = function() params.newName = new_name vim.lsp.buf_request(0, "textDocument/rename", params) end -M.rename() -- M.callback() return M