Re-work the keybindings, add new ones for navigating without needing the prefix, re-organize the file, don't specify the output file for a history dump, and update the readme

This commit is contained in:
Kevin MacMartin 2024-03-08 21:40:02 -05:00
parent 9ba3983e5a
commit 88fe711380
3 changed files with 161 additions and 143 deletions

View file

@ -11,34 +11,48 @@
## Installation
1. Choose either **tmux.powerline.conf** if powerline fonts are available or **tmux.normal.conf** if they're not, and install it to __/etc/tmux.conf__ for a system-wide install or __~/.tmux.conf__ for a local install.
1. Install **bwrate** to somewhere available in **$PATH** and make it executable (ie: `install -Dm755 bwrate /usr/local/bin/bwrate`)
1. If your network device isn't named **eth0**, set **$NETDEV** to the name of the device you'd like to use somewhere tmux will see it when it runs (ie: `echo 'export NETDEV="wlan0"' >> ~/.bashrc`)
1. Choose either `tmux.powerline.conf` if powerline fonts are available or `tmux.normal.conf` if they're not, and install it to __/etc/tmux.conf__ for a system-wide install or __~/.tmux.conf__ for a local install.
1. Install **bwrate** to somewhere available in `$PATH` and make it executable (ie: `install -Dm755 bwrate /usr/local/bin/bwrate`)
1. If your network device isn't named `eth0`, set `$NETDEV` to the name of the device you'd like to use somewhere tmux will see it when it runs (ie: `echo 'export NETDEV="wlan0"' >> ~/.bashrc`)
## Key Bindings
* **Prefix**: `<Ctrl><Space>`
### With Prefix
| Key(s) | Behaviour |
|-----------------------------------------|----------------------------------------------------------------------------------------|
| `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 `=` | Select an even layout vertically and horizontally respectively |
| `_` and `+` | Rotate the window counter-clockwise and clockwise respectively |
| `S` | Run the `swap-pane` command to swap the current pane with the marked one |
| `.` 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 pane and window respectively |
| `h`, `j`, `k` and `l` | Move left, down, up and right between panes respectively like the arrow keys |
|-----------------------------------------|--------------------------------------------------------------------|
| `c` and `<Ctrl>c` | Create a new pane and create a new pane in the current directory |
| `[` and `]` | Split the window vertically and horizontally |
| `-` and `=` | Select an even layout vertically and horizontally |
| `_` and `+` | Rotate the panes clockwise and counter-clockwise |
| `S` | Swap the current pane with the marked one (`M` to mark) |
| `,` | Swap the current window with another (using its index) |
| `#` | Rename the current window |
| `<Space>` and `<Ctrl><Space>` | Move to the previously selected pane and window |
| `` ` `` | Toggle synchronized input between the panes on the current window |
| `<Ctrl>r` | Clear the terminal history, tmux history and the current window/pane |
| `r` and `R` | Reload /etc/tmux.conf and ~/.tmux.conf respectively |
| `?` 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 |
| `r` | Reload /etc/tmux.conf |
| `?` and `/` | Show help for available key binding help and command help |
| `W` | Write scrollback buffer to file |
| `Alt-[0-9]` (no prefix) | Switch directly to the given window |
| `V` | Enter **copy mode** |
| `<Ctrl>p` | Paste from the copy buffer |
### Without Prefix
| Key(s) | Behaviour |
|-----------------------------------------|--------------------------------------------------------------------|
| `<Alt><Shift><Up,Down,Left,Right>` | Navigate to the pane in the respective direction |
| `<Alt>N` and `<Alt>P` | Switch to the next and previous window |
| `Alt-[0-9]` | Switch to the window with the respective index |
### Copy Mode
| Key(s) | Behaviour |
|-----------------------------------------|--------------------------------------------------------------------|
| `v` | Start visually selecting text |
| `y` | Copy the selected text |
| `<Escape>` | Exit **copy mode**
## Credits

View file

@ -53,71 +53,71 @@ bind -T root MouseDown3Pane send-keys -M #send right clicks to the application b
# KEY BINDINGS
#
# r and <ctrl>r to reloading ~/.tmux.conf and /etc/tmux.conf respectively
bind r source-file ~/.tmux.conf
bind R source-file /etc/tmux.conf
#
# c and <ctrl>c to create a new pane in the current path and in home respectively
# c and <ctrl>c to create a new pane in the current path and in home
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
# [ and ] to splitting the window into top/bottom and left/right
bind [ split-window -v -c "#{pane_current_path}"
bind ] split-window -h -c "#{pane_current_path}"
#
# - and = to evenly laying out the panes top->bottom and left->right respectively
# - and = to evenly laying out the panes top->bottom and left->right
bind - select-layout even-vertical
bind = select-layout even-horizontal
#
# _ and + to rotate counter-clockwise and clockwise respectively
# _ and + to rotate the panes clockwise and counter-clockwise
bind -r _ rotate-window -U
bind -r + rotate-window -D
#
# S to run the swap-pane command
bind S swap-pane
#
# . and , to move and swap the current window respectively (. is set by default)
# , to swap the current window with another
bind , command-prompt "swap-window -t '%%'"
#
# $ and # to rename the session and current window respectively ($ is set by default)
# # to rename the current window
bind "#" command-prompt -I '#W' "rename-window '%%'"
#
# Space and <ctrl>Space to navigating to the previously selected window and pane respectively
# Space and <ctrl><space> to navigating to the previously selected window and pane
bind Space last-window
bind C-Space last-pane
#
# rebind up,down,left,right to the same without repeat
bind Left select-pane -L
bind Down select-pane -D
bind Up select-pane -U
bind Right select-pane -R
#
# h,j,k,l to movement left,down,up,right between panes respectively
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
#
# ~ to synchronous panes
# ` to synchronous panes
bind ` set-window-option synchronize-panes \; display "synchronize-panes: toggled"
#
# escape to clearing history and screen
bind C-r send-keys -R\; send-keys 'C-l'\; clear-history
# r to reload /etc/tmux.conf
bind r source-file /etc/tmux.conf
#
# ? and <ctrl>? to keyboard and command help respectively
# ? and / to show keyboard and command help
bind ? list-keys
bind / list-commands
#
# y and <ctrl>p to copy mode and pasting the copy buffer respectively
bind y copy-mode
# W to save scrollback to file
bind-key W command-prompt -p 'write scrollback to file:' -I '~/' 'capture-pane -S -32768 ; save-buffer %1 ; delete-buffer'
#
# V to enter copy mode
bind V copy-mode
#
# <ctrl>p paste the copy buffer
bind C-p paste-buffer
#
# (copy mode) v,y and escape to select, copy and cancel respectively
bind -Tcopy-mode-vi y send -X copy-selection
bind -Tcopy-mode-vi v send -X begin-selection
bind -Tcopy-mode-vi Escape send -X cancel
# rebind up,down,left and right to the same without repeat
bind Up select-pane -U
bind Down select-pane -D
bind Left select-pane -L
bind Right select-pane -R
#
# bind <alt>[0-9] to switching directly to the respective window
# (without prefix) <alt><shift> + up,down,left and right to navigate between panes
bind -n M-S-Up select-pane -U
bind -n M-S-Down select-pane -D
bind -n M-S-Left select-pane -L
bind -n M-S-Right select-pane -R
#
# (without prefix) <alt> + N and P to move to the next and previous windows
bind -n M-N next-window
bind -n M-P previous-window
#
# (without prefix) <alt>[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
bind -n M-3 select-window -t 3
@ -129,8 +129,10 @@ bind -n M-8 select-window -t 8
bind -n M-9 select-window -t 9
bind -n M-0 select-window -t 10
#
# save scrollback to file
bind-key W command-prompt -p 'write scrollback to file:' -I '~/tmux-history.txt' 'capture-pane -S -32768 ; save-buffer %1 ; delete-buffer'
# (copy mode) v,y and escape to select, copy and cancel
bind -Tcopy-mode-vi v send -X begin-selection
bind -Tcopy-mode-vi y send -X copy-selection
bind -Tcopy-mode-vi Escape send -X cancel
# STATUS LINE
#

View file

@ -53,71 +53,71 @@ bind -T root MouseDown3Pane send-keys -M #send right clicks to the application b
# KEY BINDINGS
#
# r and <ctrl>r to reloading ~/.tmux.conf and /etc/tmux.conf respectively
bind r source-file ~/.tmux.conf
bind R source-file /etc/tmux.conf
#
# c and <ctrl>c to create a new pane in the current path and in home respectively
# c and <ctrl>c to create a new pane in the current path and in home
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
# [ and ] to splitting the window into top/bottom and left/right
bind [ split-window -v -c "#{pane_current_path}"
bind ] split-window -h -c "#{pane_current_path}"
#
# - and = to evenly laying out the panes top->bottom and left->right respectively
# - and = to evenly laying out the panes top->bottom and left->right
bind - select-layout even-vertical
bind = select-layout even-horizontal
#
# _ and + to rotate counter-clockwise and clockwise respectively
# _ and + to rotate the panes clockwise and counter-clockwise
bind -r _ rotate-window -U
bind -r + rotate-window -D
#
# S to run the swap-pane command
bind S swap-pane
#
# . and , to move and swap the current window respectively (. is set by default)
# , to swap the current window with another
bind , command-prompt "swap-window -t '%%'"
#
# $ and # to rename the session and current window respectively ($ is set by default)
# # to rename the current window
bind "#" command-prompt -I '#W' "rename-window '%%'"
#
# Space and <ctrl>Space to navigating to the previously selected window and pane respectively
# Space and <ctrl><space> to navigating to the previously selected window and pane
bind Space last-window
bind C-Space last-pane
#
# rebind up,down,left,right to the same without repeat
bind Left select-pane -L
bind Down select-pane -D
bind Up select-pane -U
bind Right select-pane -R
#
# h,j,k,l to movement left,down,up,right between panes respectively
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
#
# ~ to synchronous panes
# ` to synchronous panes
bind ` set-window-option synchronize-panes \; display "synchronize-panes: toggled"
#
# escape to clearing history and screen
bind C-r send-keys -R\; send-keys 'C-l'\; clear-history
# r to reload /etc/tmux.conf
bind r source-file /etc/tmux.conf
#
# ? and <ctrl>? to keyboard and command help respectively
# ? and / to show keyboard and command help
bind ? list-keys
bind / list-commands
#
# y and <ctrl>p to copy mode and pasting the copy buffer respectively
bind y copy-mode
# W to save scrollback to file
bind-key W command-prompt -p 'write scrollback to file:' -I '~/' 'capture-pane -S -32768 ; save-buffer %1 ; delete-buffer'
#
# V to enter copy mode
bind V copy-mode
#
# <ctrl>p paste the copy buffer
bind C-p paste-buffer
#
# (copy mode) v,y and escape to select, copy and cancel respectively
bind -Tcopy-mode-vi y send -X copy-selection
bind -Tcopy-mode-vi v send -X begin-selection
bind -Tcopy-mode-vi Escape send -X cancel
# rebind up,down,left and right to the same without repeat
bind Up select-pane -U
bind Down select-pane -D
bind Left select-pane -L
bind Right select-pane -R
#
# bind <alt>[0-9] to switching directly to the respective window
# (without prefix) <alt><shift> + up,down,left and right to navigate between panes
bind -n M-S-Up select-pane -U
bind -n M-S-Down select-pane -D
bind -n M-S-Left select-pane -L
bind -n M-S-Right select-pane -R
#
# (without prefix) <alt> + N and P to move to the next and previous windows
bind -n M-N next-window
bind -n M-P previous-window
#
# (without prefix) <alt>[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
bind -n M-3 select-window -t 3
@ -129,8 +129,10 @@ bind -n M-8 select-window -t 8
bind -n M-9 select-window -t 9
bind -n M-0 select-window -t 10
#
# save scrollback to file
bind-key W command-prompt -p 'write scrollback to file:' -I '~/tmux-history.txt' 'capture-pane -S -32768 ; save-buffer %1 ; delete-buffer'
# (copy mode) v,y and escape to select, copy and cancel
bind -Tcopy-mode-vi v send -X begin-selection
bind -Tcopy-mode-vi y send -X copy-selection
bind -Tcopy-mode-vi Escape send -X cancel
# STATUS LINE
#