From 584049ad51be23de46ecf431e30ba62d8bc350b7 Mon Sep 17 00:00:00 2001 From: Prad Nukala Date: Mon, 22 Sep 2025 01:12:22 -0400 Subject: [PATCH] feat: add keybinding for Claude terminal toggle --- lua/plugins/astrocore.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lua/plugins/astrocore.lua b/lua/plugins/astrocore.lua index 8547aff..e868704 100644 --- a/lua/plugins/astrocore.lua +++ b/lua/plugins/astrocore.lua @@ -144,6 +144,16 @@ end local file_filter = create_file_filter() +local claude = Terminal:new { + cmd = "claude", + hidden = true, + direction = "tab", + close_on_exit = true, -- function to run on opening the terminal + on_open = function(term) + vim.cmd "startinsert!" + vim.api.nvim_buf_set_keymap(term.bufnr, "n", "q", "close", { noremap = true, silent = true }) + end, +} local yazi = Terminal:new { cmd = "yazi", hidden = true, @@ -186,6 +196,7 @@ local mk = Terminal:new { } -- Toggle Functions (global so they can be used in other files) +function _G.Claude_toggle() claude:toggle() end function _G.Lazyjournal_toggle() lazyjournal:toggle() end function _G.Mk_toggle() mk:toggle() end function _G.Scooter_toggle() scooter:toggle() end @@ -602,6 +613,7 @@ return { desc = "Find Service files", }, ["a"] = { function() vim.lsp.buf.code_action() end, desc = "LSP Code Action" }, + ["c"] = { _G.Claude_toggle, desc = "Claude Toggle" }, ["h"] = { function() vim.lsp.buf.hover() end, desc = "LSP Hover" }, ["d"] = { function() require("snacks").picker.lsp_definitions() end,