feat(keymaps): Use cd to LSP Rename (N)

This commit is contained in:
js0ny 2025-04-02 19:29:45 +01:00
parent 0164b1ca8a
commit e8d5568745
6 changed files with 56 additions and 11 deletions

View file

@ -1,3 +1,4 @@
fish_variables
completions
functions/br.fish
functions/dotenv.fish

View file

@ -3,7 +3,7 @@
# Fonts {{{
# Family
font_family family="Sarasa Term SC Nerd Font"
font_family family="Maple Mono NF CN"
bold_font auto
italic_font auto
bold_italic_font auto
@ -79,9 +79,3 @@ map ctrl+shift+enter toggle_layout stack
# }}}
# BEGIN_KITTY_FONTS
font_family family="Sarasa Term SC Nerd Font"
bold_font auto
italic_font auto
bold_italic_font auto
# END_KITTY_FONTS

View file

@ -7,6 +7,37 @@ local M = {
{ keys = "<leader>,", cmd = vim.lsp.buf.code_action, opts = { desc = "Code Action" } },
{ keys = "ga", cmd = vim.lsp.buf.code_action, opts = { desc = "Code Action" } },
{ keys = "gh", cmd = vim.lsp.buf.hover, opts = { desc = "Show hover" } },
-- [c]hange [d]efinition
{ keys = "cd", cmd = vim.lsp.buf.rename, opts = { desc = "Rename symbol under cursor" } },
}
-- local function smart_split_definition()
-- local width = vim.api.nvim_win_get_width(0)
-- if width > 80 then -- Adjust 80 to your preference
-- vim.api.nvim_command("vsp")
-- else
-- vim.api.nvim_command("sp")
-- end
-- vim.lsp.buf.definition()
-- end
-- vim.keymap.set("n", "<C-w>d", smart_split_definition, { desc = "Go to Definition (Smart Split)" })
local function smart_split(func)
local width = vim.api.nvim_win_get_width(0)
if width > 80 then
vim.api.nvim_command("vsp")
else
vim.api.nvim_command("sp")
end
func()
end
vim.keymap.set("n", "<C-w>d", function()
smart_split(vim.lsp.buf.definition)
end, { desc = "Go to Definition (Smart Split)" })
vim.keymap.set("n", "<C-w>D", function()
smart_split(vim.lsp.buf.declaration)
end, { desc = "Go to Declaration (Smart Split)" })
return M

View file

@ -59,6 +59,8 @@ noremap gr editor.action.goToReferences
noremap gpr editor.action.referenceSearch.trigger
noremap ga editor.action.quickFix
" Rename, or [c]hange [d]efinition
noremap cd editor.action.rename
" Requires matchit by redguardtoo
" nnoremap % extension.matchitJumpItems

View file

@ -47,7 +47,21 @@
"bindings": {
"N": "vim::JoinLines",
"l": "vim::InsertBefore",
"L": "vim::InsertFirstNonWhitespace",
"L": "vim::InsertFirstNonWhitespace"
}
},
{
"context": "vim_mode == visual || vim_mode == operator",
"bindings": {
"H": "vim::StartOfLine",
"I": "vim::EndOfLine"
}
},
{
"context": "vim_mode == normal",
"bindings": {
"H": "pane::ActivatePrevItem",
"I": "pane::ActivateNextItem"
}

View file

@ -18,6 +18,9 @@
// custom settings, run `zed: open default settings` from the
// command palette (cmd-shift-p / ctrl-shift-p)
{
"outline_panel": {
"dock": "right"
},
"edit_predictions": {
"disabled_globs": ["*.bean"],
"mode": "eager_preview",