From 714a000001367c329090e6f2ebad57158bdc0fb6 Mon Sep 17 00:00:00 2001 From: Nicolas Goudry Date: Wed, 12 Jun 2024 12:04:00 +0200 Subject: [PATCH] feat(plugins/toggleterm): add keymap to rename terminal --- plugins/toggleterm.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plugins/toggleterm.nix b/plugins/toggleterm.nix index cf75cd1..809bdb7 100644 --- a/plugins/toggleterm.nix +++ b/plugins/toggleterm.nix @@ -79,5 +79,19 @@ _: action = ""; options.desc = "Switch to normal mode"; } + { + mode = [ "n" "t" ]; + key = "tn"; + action.__raw = '' + function() + local curterm = require("toggleterm.terminal").get_focused_id() + + if curterm ~= nil then + vim.cmd(curterm .. "ToggleTermSetName") + end + end + ''; + options.desc = "Rename current terminal"; + } ]; }