diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index 5716bf6d..27736311 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -114,8 +114,8 @@ local conceallevel = vim.o.conceallevel > 0 and vim.o.conceallevel or 3 map("n", "uc", function() Util.toggle("conceallevel", false, {0, conceallevel}) end, { desc = "Toggle Conceal" }) -- lazygit -map("n", "gg", function() Util.float_term({ "lazygit" }, { cwd = Util.get_root(), esc_esc = false }) end, { desc = "Lazygit (root dir)" }) -map("n", "gG", function() Util.float_term({ "lazygit" }, {esc_esc = false}) end, { desc = "Lazygit (cwd)" }) +map("n", "gg", function() Util.float_term({ "lazygit" }, { cwd = Util.get_root(), esc_esc = false, ctrl_hjkl = false }) end, { desc = "Lazygit (root dir)" }) +map("n", "gG", function() Util.float_term({ "lazygit" }, {esc_esc = false, ctrl_hjkl = false}) end, { desc = "Lazygit (cwd)" }) -- quit map("n", "qq", "qa", { desc = "Quit all" }) diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index d08efab9..5db01fef 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -128,7 +128,7 @@ local terminals = {} -- Opens a floating terminal (interactive by default) ---@param cmd? string[]|string ----@param opts? LazyCmdOptions|{interactive?:boolean, esc_esc?:false} +---@param opts? LazyCmdOptions|{interactive?:boolean, esc_esc?:false, ctrl_hjkl?:false} function M.float_term(cmd, opts) opts = vim.tbl_deep_extend("force", { ft = "lazyterm", @@ -147,6 +147,13 @@ function M.float_term(cmd, opts) if opts.esc_esc == false then vim.keymap.set("t", "", "", { buffer = buf, nowait = true }) end + if opts.ctrl_hjkl == false then + vim.keymap.set("t", "", "", { buffer = buf, nowait = true }) + vim.keymap.set("t", "", "", { buffer = buf, nowait = true }) + vim.keymap.set("t", "", "", { buffer = buf, nowait = true }) + vim.keymap.set("t", "", "", { buffer = buf, nowait = true }) + end + vim.api.nvim_create_autocmd("BufEnter", { buffer = buf, callback = function()