diff --git a/lua/lazyvim/config/keymaps.lua b/lua/lazyvim/config/keymaps.lua index 85b64478..0d8759b6 100644 --- a/lua/lazyvim/config/keymaps.lua +++ b/lua/lazyvim/config/keymaps.lua @@ -112,8 +112,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() }) end, { desc = "Lazygit (root dir)" }) -map("n", "gG", function() Util.float_term({ "lazygit" }) end, { desc = "Lazygit (cwd)" }) +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)" }) -- quit map("n", "qq", "qa", { desc = "Quit all" }) @@ -126,7 +126,7 @@ end -- floating terminal map("n", "ft", function() Util.float_term(nil, { cwd = Util.get_root() }) end, { desc = "Terminal (root dir)" }) map("n", "fT", function() Util.float_term() end, { desc = "Terminal (cwd)" }) -map("t", "", "", {desc = "Enter Normal Mode"}) +map("t", "", "", { desc = "Enter Normal Mode" }) -- windows map("n", "ww", "p", { desc = "Other window" }) diff --git a/lua/lazyvim/util/init.lua b/lua/lazyvim/util/init.lua index 1ef39a78..0bbabae2 100644 --- a/lua/lazyvim/util/init.lua +++ b/lua/lazyvim/util/init.lua @@ -102,15 +102,17 @@ function M.telescope(builtin, opts) end end --- FIXME: create a togglable terminal -- Opens a floating terminal (interactive by default) ---@param cmd? string[]|string ----@param opts? LazyCmdOptions|{interactive?:boolean} +---@param opts? LazyCmdOptions|{interactive?:boolean, esc_esc?:false} function M.float_term(cmd, opts) opts = vim.tbl_deep_extend("force", { size = { width = 0.9, height = 0.9 }, }, opts or {}) - require("lazy.util").float_term(cmd, opts) + local float = require("lazy.util").float_term(cmd, opts) + if opts.esc_esc == false then + vim.keymap.set("t", "", "", { buffer = float.buf, nowait = true }) + end end ---@param silent boolean?