Make ,, work in terminal mode nvim
This commit is contained in:
@@ -3,6 +3,10 @@ local map = vim.keymap.set
|
||||
-- Insert/command-mode escape via ,,
|
||||
map("i", ",,", "<Esc>", { desc = "Escape insert mode" })
|
||||
map("c", ",,", "<Esc><Esc>", { desc = "Escape command mode" })
|
||||
-- Terminal mode is a separate mode from Insert, so the above doesn't cover
|
||||
-- it (e.g. the Claude Code terminal). <C-\><C-n> is the real escape back to
|
||||
-- Normal mode there.
|
||||
map("t", ",,", "<C-\\><C-n>", { desc = "Escape terminal mode" })
|
||||
|
||||
-- Move by display line, not physical line
|
||||
map("n", "j", "gj", { desc = "Move down by display line" })
|
||||
|
||||
@@ -40,6 +40,19 @@ return {
|
||||
end
|
||||
return default_find_main_editor_window()
|
||||
end
|
||||
|
||||
-- claudecode's unified diff buffers pick up treesitter's foldexpr via
|
||||
-- the normal FileType autocmd, so they otherwise inherit the global
|
||||
-- foldlevelstart and open partially collapsed. Fully expand folds in
|
||||
-- these specifically instead of changing the default for all buffers.
|
||||
vim.api.nvim_create_autocmd("BufWinEnter", {
|
||||
group = vim.api.nvim_create_augroup("ClaudeCodeDiffUnfold", { clear = true }),
|
||||
callback = function(args)
|
||||
if vim.b[args.buf].claudecode_inline_diff then
|
||||
vim.wo.foldlevel = 99
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
keys = {
|
||||
{ "<leader>ac", "<cmd>ClaudeCode<CR>", desc = "Toggle Claude Code" },
|
||||
|
||||
Reference in New Issue
Block a user