mirror of
https://github.com/zoriya/jj.nvim.git
synced 2026-08-15 23:53:18 +00:00
refactor: remove hardcoded closing keymaps on the terminal buffer
This commit is contained in:
+4
-5
@@ -5,7 +5,6 @@ local utils = require("jj.utils")
|
||||
local runner = require("jj.core.runner")
|
||||
local parser = require("jj.core.parser")
|
||||
local terminal = require("jj.ui.terminal")
|
||||
local editor = require("jj.ui.editor")
|
||||
local diff = require("jj.diff")
|
||||
local log_module = require("jj.cmd.log")
|
||||
local describe_module = require("jj.cmd.describe")
|
||||
@@ -265,7 +264,7 @@ function M.diff(opts)
|
||||
end
|
||||
end
|
||||
|
||||
terminal.run(cmd)
|
||||
terminal.run(cmd, M.close_keymaps())
|
||||
end
|
||||
|
||||
-- Jujutsu rebase
|
||||
@@ -385,13 +384,13 @@ function M.j(args)
|
||||
true
|
||||
)
|
||||
if not success then
|
||||
terminal.run("jj")
|
||||
terminal.run("jj", M.close_keymaps())
|
||||
return
|
||||
end
|
||||
|
||||
local default_cmd = parser.parse_default_cmd(default_cmd_str and default_cmd_str or "")
|
||||
if default_cmd == nil then
|
||||
terminal.run("jj")
|
||||
terminal.run("jj", M.close_keymaps())
|
||||
return
|
||||
end
|
||||
args = default_cmd
|
||||
@@ -449,7 +448,7 @@ function M.j(args)
|
||||
if handlers[subcommand] then
|
||||
handlers[subcommand]()
|
||||
else
|
||||
terminal.run(cmd)
|
||||
terminal.run(cmd, M.close_keymaps())
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
+1
-1
@@ -216,7 +216,7 @@ function M.log_keymaps()
|
||||
},
|
||||
}
|
||||
|
||||
return cmd.resolve_keymaps_from_specs(cfg, specs)
|
||||
return cmd.merge_keymaps(cmd.resolve_keymaps_from_specs(cfg, specs), cmd.close_keymaps())
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
@@ -293,20 +293,6 @@ function M.run(cmd, keymaps)
|
||||
{ modes = { "n", "v" }, lhs = "c", rhs = function() end },
|
||||
{ modes = { "n", "v" }, lhs = "a", rhs = function() end },
|
||||
{ modes = { "n", "v" }, lhs = "u", rhs = function() end },
|
||||
-- Close terminal buffer
|
||||
{
|
||||
modes = { "n", "v" },
|
||||
lhs = "q",
|
||||
rhs = M.close_terminal_buffer,
|
||||
opts = { desc = "Close the terminal buffer" },
|
||||
},
|
||||
-- Close terminal buffer with ESC
|
||||
{
|
||||
modes = "n",
|
||||
lhs = "<ESC>",
|
||||
rhs = M.close_terminal_buffer,
|
||||
opts = { desc = "Close the terminal buffer" },
|
||||
},
|
||||
})
|
||||
|
||||
vim.b[state.buf].jj_keymaps_set = true
|
||||
|
||||
Reference in New Issue
Block a user