diff options
author | sinanmohd <sinan@sinanmohd.com> | 2025-09-06 12:04:17 +0530 |
---|---|---|
committer | sinanmohd <sinan@sinanmohd.com> | 2025-09-06 12:04:17 +0530 |
commit | 30ae7ba8d16c39767b48396ebaeba98a231c3cf2 (patch) | |
tree | 808ad48186915f8d5df5c967b2476b9cf7dfa464 /home | |
parent | 7d15d6b8332043a1fb05e042b5e20a6b643373db (diff) |
chore(home/neovim/toggleterm): clean up
Diffstat (limited to 'home')
-rw-r--r-- | home/common/modules/neovim/config/lua/pacman/plugins/toggleterm.lua | 20 |
1 files changed, 12 insertions, 8 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 e61b9b6..3a10b0c 100644 --- a/home/common/modules/neovim/config/lua/pacman/plugins/toggleterm.lua +++ b/home/common/modules/neovim/config/lua/pacman/plugins/toggleterm.lua @@ -1,3 +1,14 @@ +math.randomseed(os.time()) +local session_name = "_nvim_toggleterm_" .. vim.fn.getcwd() .. math.random() +session_name = session_name:gsub('%W', '') + +local cmd = "tmux new-session -ds " .. session_name .. + [[ \; set -t ]] .. session_name .. " destroy-unattached " .. + [[ \; set -t ]] .. + session_name .. " window-status-current-format '#{window_index}:#{pane_current_command}' " .. + [[ \; set -t ]] .. session_name .. " window-status-format '#{window_index}:#{pane_current_command}' " .. + [[ \; attach -t ]] .. session_name + return { { "akinsho/toggleterm.nvim", @@ -5,14 +16,7 @@ return { opts = { direction = "float", open_mapping = [[<c-\>]], - on_create = function(term) - 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:send("tmux set window-status-current-format '#{window_index}:#{pane_current_command}'") - term:send("tmux set window-status-format '#{window_index}:#{pane_current_command}'") - term:clear() - end, + shell = cmd, }, } } |