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

@ -25,99 +25,99 @@ bind Space send-prefix
# SETTINGS
#
# general
set-option -g default-terminal "tmux-256color" #set $TERM variable so programs know how to behave
set-option -ag terminal-overrides ",alacritty:RGB,xterm-256color:RGB,gnome*:RGB" #enable truecolor where supported
set-option -g base-index 1 #start counting windows at 1 instead of 0 (for more logical keboard-switching)
set-option -g pane-base-index 1 #start counting panes at 1 instead of 0
set-option -g renumber-windows on #when a window is closed, renumber the remaining windows
set-option -g set-titles on #attempt to set the terminal title
set-option -g set-titles-string "#I:#P - #W - #T" #string used to set the terminal title
set-option -g history-limit 100000 #maximum number of lines kept in history
set-option -g display-time 2000 #number of ms for status line messages and other on-screen indicators to display
set-option -g display-panes-time 2000 #number of ms to show indicators from the display-panes command
set-option -sg escape-time 0 #allow commands immediately following send-prefix
set-option -sg repeat-time 600 #allow 600ms between repeatable commands
set-option -g default-terminal "tmux-256color" # set $TERM variable so programs know how to behave
set-option -ag terminal-overrides ",alacritty:RGB,xterm-256color:RGB,gnome*:RGB" # enable truecolor where supported
set-option -g base-index 1 # start counting windows at 1 instead of 0 (for more logical keboard-switching)
set-option -g pane-base-index 1 # start counting panes at 1 instead of 0
set-option -g renumber-windows on # when a window is closed, renumber the remaining windows
set-option -g set-titles on # attempt to set the terminal title
set-option -g set-titles-string "#I:#P - #W - #T" # string used to set the terminal title
set-option -g history-limit 100000 # maximum number of lines kept in history
set-option -g display-time 2000 # number of ms for status line messages and other on-screen indicators to display
set-option -g display-panes-time 2000 # number of ms to show indicators from the display-panes command
set-option -sg escape-time 0 # allow commands immediately following send-prefix
set-option -sg repeat-time 600 # allow 600ms between repeatable commands
set-option -g focus-events on
set-window-option -g aggressive-resize on #only resize a window if a smaller client is actively looking
set-window-option -g monitor-activity on #monitor for activity in windows
set-window-option -g visual-activity off #show the activity being monitored for in the status bar
set-window-option -g xterm-keys on #generate xterm-style function key sequences for better compatibility
set-window-option -g mode-keys vi #use vi-style keys in copy and choice modes
set-window-option -g aggressive-resize on # only resize a window if a smaller client is actively looking
set-window-option -g monitor-activity on # monitor for activity in windows
set-window-option -g visual-activity off # show the activity being monitored for in the status bar
set-window-option -g xterm-keys on # generate xterm-style function key sequences for better compatibility
set-window-option -g mode-keys vi # use vi-style keys in copy and choice modes
#
# clipboard (sync with the system)
set -s set-clipboard external
#
# mouse
set-option -g mouse on
bind -T root MouseDown3Pane send-keys -M #send right clicks to the application below
bind -T root MouseDown3Pane send-keys -M # send right clicks to the application below
# 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,18 +129,20 @@ 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
#
# settings
set-option -g status on #enable the status bar
set-option -g status-interval 2 #the number of seconds to wait before refreshing
set-option -g status-justify left #justify the window list on the left
set-option -g status-left-length '100' #the width in characters of the left side of the status line
set-option -g status-right-length '100' #the width in characters of the right side of the status line
set-window-option -g window-status-separator '' #the character to separate entries of the status line with
set-option -g status on # enable the status bar
set-option -g status-interval 2 # the number of seconds to wait before refreshing
set-option -g status-justify left # justify the window list on the left
set-option -g status-left-length '100' # the width in characters of the left side of the status line
set-option -g status-right-length '100' # the width in characters of the right side of the status line
set-window-option -g window-status-separator '' # the character to separate entries of the status line with
#
# general theme
set-option -g status-style bg=colour236

View file

@ -25,99 +25,99 @@ bind Space send-prefix
# SETTINGS
#
# general
set-option -g default-terminal "tmux-256color" #set $TERM variable so programs know how to behave
set-option -ag terminal-overrides ",alacritty:RGB,xterm-256color:RGB,gnome*:RGB" #enable truecolor where supported
set-option -g base-index 1 #start counting windows at 1 instead of 0 (for more logical keboard-switching)
set-option -g pane-base-index 1 #start counting panes at 1 instead of 0
set-option -g renumber-windows on #when a window is closed, renumber the remaining windows
set-option -g set-titles on #attempt to set the terminal title
set-option -g set-titles-string "#I:#P - #W - #T" #string used to set the terminal title
set-option -g history-limit 100000 #maximum number of lines kept in history
set-option -g display-time 2000 #number of ms for status line messages and other on-screen indicators to display
set-option -g display-panes-time 2000 #number of ms to show indicators from the display-panes command
set-option -sg escape-time 0 #allow commands immediately following send-prefix
set-option -sg repeat-time 600 #allow 600ms between repeatable commands
set-option -g default-terminal "tmux-256color" # set $TERM variable so programs know how to behave
set-option -ag terminal-overrides ",alacritty:RGB,xterm-256color:RGB,gnome*:RGB" # enable truecolor where supported
set-option -g base-index 1 # start counting windows at 1 instead of 0 (for more logical keboard-switching)
set-option -g pane-base-index 1 # start counting panes at 1 instead of 0
set-option -g renumber-windows on # when a window is closed, renumber the remaining windows
set-option -g set-titles on # attempt to set the terminal title
set-option -g set-titles-string "#I:#P - #W - #T" # string used to set the terminal title
set-option -g history-limit 100000 # maximum number of lines kept in history
set-option -g display-time 2000 # number of ms for status line messages and other on-screen indicators to display
set-option -g display-panes-time 2000 # number of ms to show indicators from the display-panes command
set-option -sg escape-time 0 # allow commands immediately following send-prefix
set-option -sg repeat-time 600 # allow 600ms between repeatable commands
set-option -g focus-events on
set-window-option -g aggressive-resize on #only resize a window if a smaller client is actively looking
set-window-option -g monitor-activity on #monitor for activity in windows
set-window-option -g visual-activity off #show the activity being monitored for in the status bar
set-window-option -g xterm-keys on #generate xterm-style function key sequences for better compatibility
set-window-option -g mode-keys vi #use vi-style keys in copy and choice modes
set-window-option -g aggressive-resize on # only resize a window if a smaller client is actively looking
set-window-option -g monitor-activity on # monitor for activity in windows
set-window-option -g visual-activity off # show the activity being monitored for in the status bar
set-window-option -g xterm-keys on # generate xterm-style function key sequences for better compatibility
set-window-option -g mode-keys vi # use vi-style keys in copy and choice modes
#
# clipboard (sync with the system)
set -s set-clipboard external
#
# mouse
set-option -g mouse on
bind -T root MouseDown3Pane send-keys -M #send right clicks to the application below
bind -T root MouseDown3Pane send-keys -M # send right clicks to the application below
# 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,18 +129,20 @@ 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
#
# settings
set-option -g status on #enable the status bar
set-option -g status-interval 2 #the number of seconds to wait before refreshing
set-option -g status-justify left #justify the window list on the left
set-option -g status-left-length '100' #the width in characters of the left side of the status line
set-option -g status-right-length '100' #the width in characters of the right side of the status line
set-window-option -g window-status-separator '' #the character to separate entries of the status line with
set-option -g status on # enable the status bar
set-option -g status-interval 2 # the number of seconds to wait before refreshing
set-option -g status-justify left # justify the window list on the left
set-option -g status-left-length '100' # the width in characters of the left side of the status line
set-option -g status-right-length '100' # the width in characters of the right side of the status line
set-window-option -g window-status-separator '' # the character to separate entries of the status line with
#
# general theme
set-option -g status-style bg=colour236