diff options
author | sinanmohd <sinan@sinanmohd.com> | 2025-09-03 10:38:29 +0530 |
---|---|---|
committer | sinanmohd <sinan@sinanmohd.com> | 2025-09-03 10:38:29 +0530 |
commit | 572096a58cda232f26be8cc0ad30cbf72bffcc5b (patch) | |
tree | 9e0b35244a47e924fdc7466cda7fd595634c1f7d | |
parent | 07ffb347de3ae614a57503c9875eac391a8ad9a3 (diff) |
chore(home/common/neovim): tmux session handling
-rw-r--r-- | home/common/modules/neovim/config/lua/pacman/plugins/toggleterm.lua | 5 | ||||
-rw-r--r-- | home/common/modules/tmux.nix | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/home/common/modules/neovim/config/lua/pacman/plugins/toggleterm.lua b/home/common/modules/neovim/config/lua/pacman/plugins/toggleterm.lua index 83a3c65..e47af46 100644 --- a/home/common/modules/neovim/config/lua/pacman/plugins/toggleterm.lua +++ b/home/common/modules/neovim/config/lua/pacman/plugins/toggleterm.lua @@ -6,7 +6,10 @@ return { direction = "float", open_mapping = [[<c-\>]], on_create = function(term) - term:send("exec tmux") + local session_name = "_nvim_toggleterm_" .. vim.fn.getcwd() .. "_$(date +%s%4N)" + term:send("exec tmux new-session -A -s " .. session_name) + term:send("tmux set-option destroy-unattached") + term:clear() end, }, } diff --git a/home/common/modules/tmux.nix b/home/common/modules/tmux.nix index 433a02c..d9a6c7e 100644 --- a/home/common/modules/tmux.nix +++ b/home/common/modules/tmux.nix @@ -6,7 +6,7 @@ programs.bash.initExtra = lib.mkOrder 2000 '' if [ -z "$TMUX" ] && { [ -n "$WAYLAND_DISPLAY" ] || [ -n "$SSH_TTY" ]; }; then - exec tmux new-session -A > /dev/null 2>&1 + exec tmux new-session -A -s _root_session_managed_by_home_manager > /dev/null 2>&1 fi ''; |