aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xexecutables/bin/tmux-toggle-term21
-rw-r--r--nvim/.config/nvim/lua/plugins/toggleterm.lua14
-rw-r--r--tmux/.config/tmux/key-remappings.tmux3
3 files changed, 24 insertions, 14 deletions
diff --git a/executables/bin/tmux-toggle-term b/executables/bin/tmux-toggle-term
new file mode 100755
index 0000000..7012392
--- /dev/null
+++ b/executables/bin/tmux-toggle-term
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+set -uo pipefail
+FLOAT_TERM="${1:-}"
+LIST_PANES="$(tmux list-panes -F '#F')"
+PANE_ZOOMED="$(echo "${LIST_PANES}" | grep Z)"
+PANE_COUNT="$(echo "${LIST_PANES}" | wc -l | bc)"
+if [ -n "${FLOAT_TERM}" ]; then
+ if [ "$(tmux display-message -p -F "#{session_name}")" = "popup" ]; then
+ tmux detach-client
+ else
+ tmux popup -d '#{pane_current_path}' -xC -yC -w90% -h80% -E "tmux attach -t popup || tmux new -s popup"
+ fi
+else
+ if [ "${PANE_COUNT}" = 1 ]; then
+ tmux split-window -c "#{pane_current_path}"
+ elif [ -n "${PANE_ZOOMED}" ]; then
+ tmux select-pane -t:.-
+ else
+ tmux resize-pane -Z -t1
+ fi
+fi
diff --git a/nvim/.config/nvim/lua/plugins/toggleterm.lua b/nvim/.config/nvim/lua/plugins/toggleterm.lua
deleted file mode 100644
index 283123f..0000000
--- a/nvim/.config/nvim/lua/plugins/toggleterm.lua
+++ /dev/null
@@ -1,14 +0,0 @@
-return {
- {
- 'akinsho/toggleterm.nvim',
- config = function()
- require('toggleterm').setup {
- size = 15,
- open_mapping = [[<C-\>]],
- shade_filetypes = {},
- shade_terminals = true,
- direction = 'horizontal',
- }
- end,
- },
-}
diff --git a/tmux/.config/tmux/key-remappings.tmux b/tmux/.config/tmux/key-remappings.tmux
index 2e71dfe..65318d7 100644
--- a/tmux/.config/tmux/key-remappings.tmux
+++ b/tmux/.config/tmux/key-remappings.tmux
@@ -16,3 +16,6 @@ unbind %
bind-key r source-file ~/.config/tmux/tmux.conf \; display-message "Config reloaded!"
bind-key x kill-pane
+bind-key -n 'C-t' run-shell -b "${HOME}/bin/tmux-toggle-term"
+bind-key -n 'C-f' run-shell -b "${HOME}/bin/tmux-toggle-term float"
+