From e16d7ede0b615d4bdb59cb2819f1b0b1100b5a76 Mon Sep 17 00:00:00 2001 From: Kevin MacMartin Date: Tue, 28 Oct 2014 10:34:03 -0400 Subject: [PATCH] change README mappings to table, improve <,> + join as split + tweaks --- README.md | 44 +++++++++++++++++++++++--------------------- tmux.normal.conf | 38 +++++++++++++++++++------------------- tmux.powerline.conf | 38 +++++++++++++++++++------------------- 3 files changed, 61 insertions(+), 59 deletions(-) diff --git a/README.md b/README.md index be2a70a..6e604a4 100644 --- a/README.md +++ b/README.md @@ -17,27 +17,29 @@ ## Key Bindings ## -* **Prefix**: `Ctrl-Space` -* `m` and `Ctrl-m`: Toggle mouse mode on and off respectively. -* `\` and `Ctrl-\`: Toggle the status bar on and off respectively. -* `c` and `Ctrl-c`: Create a new pane and create a new pane in the current directory respectively. -* `[` and `]`: Split the window vertically and horizontally respectively. -* `{` and `}`: Rotate the window up and down respectively. -* `=` and `-`: Select an even layout horizontally and vertically respectively. -* `+` and `_`: Select a main layout horizontally and vertically respectively. -* `<` and `>`: Swap the current window with the first and last window respectively. -* `.` and `,`: Move and swap the current window with the provided window number respectively. -* `$` and `#`: Rename the current session and window with the provided name respectively. -* `Space` and `Ctrl-Space`: Move to the previously selected window and pane respectively. -* `h`, `j`, `k` and `l`: Move left, down, up and right between panes respectively like the arrow keys. -* `` ` ``: Toggle synchronized input between the panes on the current window. -* `Escape`: Clear the terminal history, tmux history and the current window/pane. -* `?` and `/`: Show help for available key bindings and commands respectively. -* `y` and `Ctrl-p`: Enter __copy mode__ and paste from the copy buffer respectively. -* `Ctrl-v` and `Ctrl-y`: Pastes the X buffer in tmux, and sends the tmux buffer to X respectively. -* (**copy mode**) `v`, `y` and `Escape`: Begin selection, copy selection and cancel **copy mode** respectively. -* `Alt-[0-9]` (no prefix): Switch directly to the given window. -* `W`: Write scrollback buffer to file. +* **Prefix**: `` + +| Key(s) | Behaviour | +|-----------------------------------------|----------------------------------------------------------------------------------------| +| `` and `` | Toggle the status bar on and off respectively | +| `c` and `c` | Create a new pane and create a new pane in the current directory respectively | +| `_` and `+` | Join a window as a split pane top/bottom and left/right respectively (leave pane: `!`) | +| `[` and `]` | Split the window vertically and horizontally respectively | +| `{` and `}` | Rotate the window up and down respectively | +| `=` and `-` | Select an even layout horizontally and vertically respectively | +| `<` and `>` | Move the current window to the first and last window respectively | +| `.` and `,` | Move and swap the current window with the provided window number respectively | +| `$` and `#` | Rename the current session and window with the provided name respectively | +| `` and `` | Move to the previously selected window and pane respectively | +| `h`, `j`, `k` and `l` | Move left, down, up and right between panes respectively like the arrow keys | +| `` ` `` | Toggle synchronized input between the panes on the current window | +| `` | Clear the terminal history, tmux history and the current window/pane | +| `?` and `/` | Show help for available key bindings and commands respectively | +| `y` and `p` | Enter __copy mode__ and paste from the copy buffer respectively | +| `v` and `y` | Pastes the X buffer in tmux, and sends the tmux buffer to X respectively | +| (**copy mode**) `v`, `y` and `` | Begin selection, copy selection and cancel **copy mode** respectively | +| `Alt-[0-9]` (no prefix) | Switch directly to the given window | +| `W` | Write scrollback buffer to file | ## Italics Support ## diff --git a/tmux.normal.conf b/tmux.normal.conf index 5f14b2a..f28bb9a 100644 --- a/tmux.normal.conf +++ b/tmux.normal.conf @@ -49,25 +49,29 @@ set-option -g mouse-select-window on # KEY BINDINGS # -# m and ctrl-m to enabling and disabling the mouse respectively +# m and m to enabling and disabling the mouse respectively bind m set-option -g mode-mouse on \; set-option -g mouse-resize-pane on \; set-option -g mouse-select-pane on \; set-option -g mouse-select-window on \; display 'Mouse: ON' bind C-m set-option -g mode-mouse off \; set-option -g mouse-resize-pane off \; set-option -g mouse-select-pane off \; set-option -g mouse-select-window off \; display 'Mouse: OFF' # -# r and ctrl-r to reloading ~/.tmux.conf and /etc/tmux.conf respectively +# r and r to reloading ~/.tmux.conf and /etc/tmux.conf respectively bind r source-file ~/.tmux.conf bind C-r source-file /etc/tmux.conf # -# \ and ctrl-\ to enabling and disabling the status bar respectively +# \ and \ to enabling and disabling the status bar respectively bind \ set-option -g status on bind C-\ set-option -g status off # -# c and ctrl-c to create a new pane in the current path and in home respectively -bind C-c new-window -c '#{pane_current_path}' +# c and c to create a new pane in the current path and in home respectively +bind C-c new-window -c "#{pane_current_path}" bind c new-window # # [ and ] to splitting the window into top/bottom and left/right respectively -bind [ split-window -v -c '#{pane_current_path}' -bind ] split-window -h -c '#{pane_current_path}' +bind [ split-window -v -c "#{pane_current_path}" +bind ] split-window -h -c "#{pane_current_path}" +# +# [ and ] join another window as a pane split top/bottom and left/right respectively +bind _ choose-window 'join-pane -v -s "%%"' +bind + choose-window 'join-pane -h -s "%%"' # # { and } to rotating up and down respectively bind -r { rotate-window -U @@ -77,13 +81,9 @@ bind -r } rotate-window -D bind = select-layout even-horizontal bind - select-layout even-vertical # -# + and _ to vertically/horizontally laying out the panes with one large one on the top/left respectively -bind + select-layout main-horizontal -bind _ select-layout main-vertical -# -# < and > to swap the current window with the first and last windows respectively -bind < swap-window -t '1' -bind > run-shell "tmux swap-window -s $(tmux list-windows | grep -e '(active)$' | sed 's|:.*$||') -t $(tmux list-windows | tail -n 1 | sed 's|:.*$||')" +# < and > to move the current window to the first and last windows respectively +bind < run-shell "while [[ ! $(tmux list-windows | grep -e '(active)$' | sed 's|:.*$||') = 1 ]]; do tmux swap-window -s $(tmux list-windows | grep -e '(active)$' | sed 's|:.*$||') -t $(expr $(tmux list-windows | grep -e '(active)$' | sed 's|:.*$||') - 1); done" +bind > run-shell "while [[ ! $(tmux list-windows | grep -e '(active)$' | sed 's|:.*$||') = $(tmux list-windows | tail -n 1 | sed 's|:.*$||') ]]; do tmux swap-window -s $(tmux list-windows | grep -e '(active)$' | sed 's|:.*$||') -t $(expr $(tmux list-windows | grep -e '(active)$' | sed 's|:.*$||') + 1); done" # # . and , to move and swap the current window respectively (. is set by default) bind , command-prompt "swap-window -t '%%'" @@ -91,7 +91,7 @@ bind , command-prompt "swap-window -t '%%'" # $ and # to rename the session and current window respectively ($ is set by default) bind "#" command-prompt -I '#W' "rename-window '%%'" # -# Space and ctrl-Space to navigating to the previously selected pane and window respectively +# Space and Space to navigating to the previously selected pane and window respectively bind Space last-pane bind C-Space last-window # @@ -108,16 +108,16 @@ bind k select-pane -U bind l select-pane -R # # ~ to synchronous panes -bind ` set-window-option synchronize-panes \; display 'Toggling pane synchronization' +bind ` set-window-option synchronize-panes \; display "synchronize-panes: toggled" # # escape to clearing history and screen bind Escape send-keys -R\; send-keys 'C-l'\; clear-history # -# ? and ctrl-? to keyboard and command help respectively +# ? and ? to keyboard and command help respectively bind ? list-keys bind / list-commands # -# y and ctrl-p to copy mode and pasting the copy buffer respectively +# y and p to copy mode and pasting the copy buffer respectively bind y copy-mode bind C-p paste-buffer # @@ -130,7 +130,7 @@ bind -t vi-copy y copy-selection bind -t vi-copy v begin-selection bind -t vi-copy Escape cancel # -# bind ctrl-[0-9] to switching directly to the respective window +# bind [0-9] to switching directly to the respective window bind -n M-1 select-window -t 1 bind -n M-2 select-window -t 2 bind -n M-3 select-window -t 3 diff --git a/tmux.powerline.conf b/tmux.powerline.conf index 28eb956..0ab3475 100644 --- a/tmux.powerline.conf +++ b/tmux.powerline.conf @@ -49,25 +49,29 @@ set-option -g mouse-select-window on # KEY BINDINGS # -# m and ctrl-m to enabling and disabling the mouse respectively +# m and m to enabling and disabling the mouse respectively bind m set-option -g mode-mouse on \; set-option -g mouse-resize-pane on \; set-option -g mouse-select-pane on \; set-option -g mouse-select-window on \; display 'Mouse: ON' bind C-m set-option -g mode-mouse off \; set-option -g mouse-resize-pane off \; set-option -g mouse-select-pane off \; set-option -g mouse-select-window off \; display 'Mouse: OFF' # -# r and ctrl-r to reloading ~/.tmux.conf and /etc/tmux.conf respectively +# r and r to reloading ~/.tmux.conf and /etc/tmux.conf respectively bind r source-file ~/.tmux.conf bind C-r source-file /etc/tmux.conf # -# \ and ctrl-\ to enabling and disabling the status bar respectively +# \ and \ to enabling and disabling the status bar respectively bind \ set-option -g status on bind C-\ set-option -g status off # -# c and ctrl-c to create a new pane in the current path and in home respectively -bind C-c new-window -c '#{pane_current_path}' +# c and c to create a new pane in the current path and in home respectively +bind C-c new-window -c "#{pane_current_path}" bind c new-window # # [ and ] to splitting the window into top/bottom and left/right respectively -bind [ split-window -v -c '#{pane_current_path}' -bind ] split-window -h -c '#{pane_current_path}' +bind [ split-window -v -c "#{pane_current_path}" +bind ] split-window -h -c "#{pane_current_path}" +# +# [ and ] join another window as a pane split top/bottom and left/right respectively +bind _ choose-window 'join-pane -v -s "%%"' +bind + choose-window 'join-pane -h -s "%%"' # # { and } to rotating up and down respectively bind -r { rotate-window -U @@ -77,13 +81,9 @@ bind -r } rotate-window -D bind = select-layout even-horizontal bind - select-layout even-vertical # -# + and _ to vertically/horizontally laying out the panes with one large one on the top/left respectively -bind + select-layout main-horizontal -bind _ select-layout main-vertical -# -# < and > to swap the current window with the first and last windows respectively -bind < swap-window -t '1' -bind > run-shell "tmux swap-window -s $(tmux list-windows | grep -e '(active)$' | sed 's|:.*$||') -t $(tmux list-windows | tail -n 1 | sed 's|:.*$||')" +# < and > to move the current window to the first and last windows respectively +bind < run-shell "while [[ ! $(tmux list-windows | grep -e '(active)$' | sed 's|:.*$||') = 1 ]]; do tmux swap-window -s $(tmux list-windows | grep -e '(active)$' | sed 's|:.*$||') -t $(expr $(tmux list-windows | grep -e '(active)$' | sed 's|:.*$||') - 1); done" +bind > run-shell "while [[ ! $(tmux list-windows | grep -e '(active)$' | sed 's|:.*$||') = $(tmux list-windows | tail -n 1 | sed 's|:.*$||') ]]; do tmux swap-window -s $(tmux list-windows | grep -e '(active)$' | sed 's|:.*$||') -t $(expr $(tmux list-windows | grep -e '(active)$' | sed 's|:.*$||') + 1); done" # # . and , to move and swap the current window respectively (. is set by default) bind , command-prompt "swap-window -t '%%'" @@ -91,7 +91,7 @@ bind , command-prompt "swap-window -t '%%'" # $ and # to rename the session and current window respectively ($ is set by default) bind "#" command-prompt -I '#W' "rename-window '%%'" # -# Space and ctrl-Space to navigating to the previously selected pane and window respectively +# Space and Space to navigating to the previously selected pane and window respectively bind Space last-pane bind C-Space last-window # @@ -108,16 +108,16 @@ bind k select-pane -U bind l select-pane -R # # ~ to synchronous panes -bind ` set-window-option synchronize-panes \; display 'Toggling pane synchronization' +bind ` set-window-option synchronize-panes \; display "synchronize-panes: toggled" # # escape to clearing history and screen bind Escape send-keys -R\; send-keys 'C-l'\; clear-history # -# ? and ctrl-? to keyboard and command help respectively +# ? and ? to keyboard and command help respectively bind ? list-keys bind / list-commands # -# y and ctrl-p to copy mode and pasting the copy buffer respectively +# y and p to copy mode and pasting the copy buffer respectively bind y copy-mode bind C-p paste-buffer # @@ -130,7 +130,7 @@ bind -t vi-copy y copy-selection bind -t vi-copy v begin-selection bind -t vi-copy Escape cancel # -# bind ctrl-[0-9] to switching directly to the respective window +# bind [0-9] to switching directly to the respective window bind -n M-1 select-window -t 1 bind -n M-2 select-window -t 2 bind -n M-3 select-window -t 3