From decdcd6971672e72fe4dc0e0655a8ce275375d4d Mon Sep 17 00:00:00 2001 From: Pranav Rao <56097527+pranavrao145@users.noreply.github.com> Date: Sat, 23 Oct 2021 16:41:42 -0400 Subject: [PATCH] feat(tmux): added configuration option for autoclosing terminals This commit adds a config option so that if the user wants to close all tmux terminals opened by harpoon on Vim exit, they can. --- lua/harpoon/init.lua | 1 + lua/harpoon/tmux.lua | 8 ++++++++ 2 files changed, 9 insertions(+) mode change 100755 => 100644 lua/harpoon/tmux.lua diff --git a/lua/harpoon/init.lua b/lua/harpoon/init.lua index 48fb8bd..94667a7 100644 --- a/lua/harpoon/init.lua +++ b/lua/harpoon/init.lua @@ -157,6 +157,7 @@ M.setup = function(config) ["save_on_toggle"] = false, ["save_on_change"] = true, ["enter_on_sendcmd"] = false, + ["tmux_autoclose_windows"] = false, }, }, expand_dir( c_config diff --git a/lua/harpoon/tmux.lua b/lua/harpoon/tmux.lua old mode 100755 new mode 100644 index fecfe29..c343269 --- a/lua/harpoon/tmux.lua +++ b/lua/harpoon/tmux.lua @@ -6,6 +6,14 @@ local utils = require("harpoon.utils") local M = {} local tmux_windows = {} +if global_config.tmux_autoclose_windows then + vim.cmd([[ + augroup HARPOON_TMUX + autocmd! + autocmd VimLeave * :lua require('harpoon.tmux').clear_all() + ]]) +end + local function create_terminal() log.trace("tmux: _create_terminal())")