local M = {} M.packer = function(use) use({ "akinsho/toggleterm.nvim", tag = "v2.1.0", config = function() require("toggleterm").setup({ open_mapping = [[]], hide_numbers = true, direction = "float", shell = "fish", -- Force fish for everything }) vim.keymap.set("t", "", "") --- Exit terminal mode -- Only set these keymaps for toggleterm vim.api.nvim_create_autocmd("TermOpen", { pattern = "term://*toggleterm#*", callback = function() -- vim.keymap.set("t", "", "") --- Exit terminal mode vim.keymap.set("t", "", "h") vim.keymap.set("t", "", "j") vim.keymap.set("t", "", "k") vim.keymap.set("t", "", "l") end, }) local terminal = require("toggleterm.terminal").Terminal local basicterminal = terminal:new() function TERM_TOGGLE() basicterminal:toggle() end local nixpkgs = terminal:new({ cmd = "nix repl ''" }) function NIXPKGS_TOGGLE() nixpkgs:toggle() end local gitwatch = terminal:new({ cmd = "fish --interactive --init-command 'gh run watch'" }) function GITWATCH_TOGGLE() gitwatch:toggle() end local k9s = terminal:new({ cmd = "k9s" }) function K9S_TOGGLE() k9s:toggle() end vim.keymap.set("n", "t", TERM_TOGGLE) vim.keymap.set("n", "P", NIXPKGS_TOGGLE) vim.keymap.set("n", "gw", GITWATCH_TOGGLE) vim.keymap.set("n", "", K9S_TOGGLE) end, }) -- Connect to telescope -- use({ -- "https://git.sr.ht/~havi/telescope-toggleterm.nvim", -- event = "TermOpen", -- requires = { -- "akinsho/nvim-toggleterm.lua", -- "nvim-telescope/telescope.nvim", -- "nvim-lua/popup.nvim", -- "nvim-lua/plenary.nvim", -- }, -- config = function() -- require("telescope").load_extension("toggleterm") -- require("telescope-toggleterm").setup({ -- telescope_mappings = { -- -- : kill the terminal buffer (default) . -- [""] = require("telescope-toggleterm").actions.exit_terminal, -- }, -- }) -- end, -- }) end return M