From 918b5ccaec54b6d073701a2b8db89182be102ba2 Mon Sep 17 00:00:00 2001 From: sudacode Date: Thu, 23 Oct 2025 21:08:07 -0700 Subject: [PATCH] update keybindings --- .config/nvim/lua/core/keymaps.lua | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/.config/nvim/lua/core/keymaps.lua b/.config/nvim/lua/core/keymaps.lua index 09488a8..e793171 100644 --- a/.config/nvim/lua/core/keymaps.lua +++ b/.config/nvim/lua/core/keymaps.lua @@ -1,14 +1,12 @@ local map = vim.keymap.set -local term = require("utils.terminal") local map_from_table = require("utils.keymaps.converters.from_table").set_keybindings local add_to_whichkey = require("utils.keymaps.converters.whichkey").addToWhichKey local telescope_paste_img = require("utils.telescope_extra").find_and_paste_image local mkdir_under_cursor = require("utils.functions.mkdir_under_cursor").setup() +local term = require("utils.terminal") local term_factory = term.term_factory local term_toggle = term.term_toggle -local cc = require("codecompanion") -local opts = { silent = true, noremap = true } local nosilent = { silent = false, noremap = true } -- Leader key @@ -20,7 +18,7 @@ vim.g.maplocalleader = "," --- @param command string The command to execute --- @param description string Description of the command --- @return nil -function create_custom_command(trigger, command, description) +local create_custom_command = function(trigger, command, description) vim.api.nvim_create_user_command(trigger, command, { desc = description }) end -- Custom commands @@ -165,7 +163,7 @@ local lsp_mappings = { { mode = "n", key = "gb", cmd = ":Gitsigns blame", group = "Git Blame" }, { mode = "n", key = "gi", cmd = ":Telescope lsp_implementations", group = "Telescope Implementations" }, { mode = "n", key = "gj", cmd = ":Telescope jumplist", group = "Telescope Jumplist" }, - { mode = "n", key = "gr", cmd = ":Telescope lsp_references", goup = "LSP References" }, + { mode = "n", key = "gr", cmd = ":Telescope lsp_references", group = "LSP References" }, { mode = "n", key = "gs", cmd = vim.lsp.buf.signature_help }, -- { mode = "n", key = "K", cmd = vim.lsp.buf.hover }, { mode = "n", key = "ca", cmd = vim.lsp.buf.code_action, group = "Code" }, @@ -199,7 +197,7 @@ local lsp_mappings = { { mode = "n", key = "cDp", - cmd = ":lua vim.diagnostic.goto_prev()", + cmd = ":lua vim.diagnostic.goto_prev()", group = "Goto Previous Preview", }, { mode = "n", key = "cl", cmd = ":lua vim.diagnostic.setloclist()", group = "Set Loclist" }, @@ -222,7 +220,8 @@ local code_companion_mappings = { mode = "n", key = "Cf", cmd = function() - cc.chat({ window_opts = { height = 1.0, layout = "buffer" } }) + local chat = require("codecompanion").chat + chat({ window_opts = { height = 1.0, layout = "buffer" } }) end, group = "Codecompanion Fullscreen", }, @@ -230,7 +229,8 @@ local code_companion_mappings = { mode = "n", key = "Ch", cmd = function() - cc.chat({ window_opts = { height = 0.24, layout = "horizontal", position = "bottom" } }) + local chat = require("codecompanion").chat + chat({ window_opts = { height = 0.24, layout = "horizontal", position = "bottom" } }) end, group = "Codecompanion Horizontal Split", }, @@ -266,7 +266,7 @@ local telescope_mappings = { mode = "n", key = "//", cmd = ":Telescope current_buffer_fuzzy_find previewer=false", - "Current buffer fuzzy find", + desc = "Current buffer fuzzy find", }, { mode = "n", @@ -421,8 +421,8 @@ local file_explorer_mappings = { -- {{{ Misc Utilities Mappings local misc_utilities_mappings = { { mode = "n", key = "x", cmd = "!chmod +x %", group = "Make Executable" }, - { mode = "n", key = "y", cmd = '"+', group = "System Yank" }, - { mode = "v", key = "y", cmd = '"+', group = "System Yank" }, + { mode = "n", key = "y", cmd = '"+y', group = "System Yank" }, + { mode = "v", key = "y", cmd = '"+y', group = "System Yank" }, { mode = "n", key = "sc", cmd = ":nohls", group = "Search" }, { mode = "n", @@ -538,12 +538,17 @@ local diffview_mappings = { desc = "Refresh diffview", group = "Git", }, + { + mode = "n", + key = "gg", + cmd = ":lua Snacks.lazygit()", + desc = "Open Lazygit", + }, } -- }}} --{{{ Custom Terminals local programs_map = { - gg = { cmd = "lazygit", display_name = "lazygit", direction = "tab", hidden = true }, op = { cmd = "ipython", display_name = "ipython", direction = "vertical", hidden = true }, oP = { cmd = "ipython",