From f5d00f3a0e7d9adfcec499e18bd72d6d09239d4f Mon Sep 17 00:00:00 2001 From: Kevin MacMartin Date: Sat, 9 Mar 2024 16:06:38 -0500 Subject: [PATCH] Swap with the next and previous windows with N and P, show a notification after the config has been reloaded and stay on the current window when swapping with "," --- readme.md | 1 + tmux.normal.conf | 8 ++++++-- tmux.powerline.conf | 8 ++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/readme.md b/readme.md index 1aa8ffc..358a2ce 100644 --- a/readme.md +++ b/readme.md @@ -44,6 +44,7 @@ |-----------------------------------------|--------------------------------------------------------------------| | `` | Navigate to the pane in the respective direction | | `N` and `P` | Switch to the next and previous window | +| `N` and `P` | Swap the current window with the next and previous window | | `Alt-[0-9]` | Switch to the window with the respective index | ### Copy Mode diff --git a/tmux.normal.conf b/tmux.normal.conf index 7869cbc..a0810a6 100644 --- a/tmux.normal.conf +++ b/tmux.normal.conf @@ -73,7 +73,7 @@ bind -r + rotate-window -D bind S swap-pane # # , to swap the current window with another -bind , command-prompt "swap-window -t '%%'" +bind , command-prompt "swap-window -d -t '%%'" # # # to rename the current window bind "#" command-prompt -I '#W' "rename-window '%%'" @@ -86,7 +86,7 @@ bind C-Space last-pane bind ` set-window-option synchronize-panes \; display "synchronize-panes: toggled" # # r to reload /etc/tmux.conf -bind r source-file /etc/tmux.conf +bind r source-file /etc/tmux.conf \; display "configuration reloaded" # # ? and / to show keyboard and command help bind ? list-keys @@ -117,6 +117,10 @@ bind -n M-S-Right select-pane -R bind -n M-N next-window bind -n M-P previous-window # +# (without prefix) + N and P to swap with the next and previous windows +bind -n C-M-N swap-window -d -t + +bind -n C-M-P swap-window -d -t - +# # (without prefix) [0-9] to switch directly to the window with the respective index bind -n M-1 select-window -t 1 bind -n M-2 select-window -t 2 diff --git a/tmux.powerline.conf b/tmux.powerline.conf index c5508cb..afed2eb 100644 --- a/tmux.powerline.conf +++ b/tmux.powerline.conf @@ -73,7 +73,7 @@ bind -r + rotate-window -D bind S swap-pane # # , to swap the current window with another -bind , command-prompt "swap-window -t '%%'" +bind , command-prompt "swap-window -d -t '%%'" # # # to rename the current window bind "#" command-prompt -I '#W' "rename-window '%%'" @@ -86,7 +86,7 @@ bind C-Space last-pane bind ` set-window-option synchronize-panes \; display "synchronize-panes: toggled" # # r to reload /etc/tmux.conf -bind r source-file /etc/tmux.conf +bind r source-file /etc/tmux.conf \; display "configuration reloaded" # # ? and / to show keyboard and command help bind ? list-keys @@ -117,6 +117,10 @@ bind -n M-S-Right select-pane -R bind -n M-N next-window bind -n M-P previous-window # +# (without prefix) + N and P to swap with the next and previous windows +bind -n C-M-N swap-window -d -t + +bind -n C-M-P swap-window -d -t - +# # (without prefix) [0-9] to switch directly to the window with the respective index bind -n M-1 select-window -t 1 bind -n M-2 select-window -t 2