# tmux Topics: [[Linux shell]] `tmux` is a terminal multiplexer that allows to manage sessions with multiple shell windows. ## Keybinds This section lists important default keybindings. - Copy mode: `<leader>[` - Split vertically: `<leader>%` - Split horizontally: `<leader>"` ### Layout - `<leader> Ctrl+o`: Toggle through layouts - `<leader> M-1`: Switch to layout 1 (layout 2, 3, 4 analogous) ## Sharing tmux sessions See [[tmate]]. ## vi copy mode ```tmux bind-key -T edit-mode-vi Up send-keys -X history-up bind-key -T edit-mode-vi Down send-keys -X history-down unbind-key -T copy-mode-vi Space ; bind-key -T copy-mode-vi v send-keys -X begin-selection unbind-key -T copy-mode-vi Enter ; bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel “reattach-to-user-namespace pbcopy” unbind-key -T copy-mode-vi C-v ; bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle unbind-key -T copy-mode-vi [ ; bind-key -T copy-mode-vi [ send-keys -X begin-selection unbind-key -T copy-mode-vi ] ; bind-key -T copy-mode-vi ] send-keys -X copy-selection ``` ## SSH directly into tmux ```bash if [[ -n "$SSH_TTY" ]]; then export TMPDIR=$HOME/tmp sname="ssh-$(hostname | cut -d. -f1)" if [[ -z "$TMUX" ]] && [ "$SSH_CONNECTION" != "" ]; then exec tmux new-session -A -s $sname fi fi ``` ## Bookmarks - [Curly underline support](http://evantravers.com/articles/2021/02/05/curly-underlines-in-kitty-tmux-neovim/) - [tmux plugin manager](https://github.com/tmux-plugins/tpm) - [How To Use and Configure Tmux Alongside Neovim](https://www.josean.com/posts/tmux-setup) - [tmux cheat sheet](https://tmuxcheatsheet.com/) --- ## Related -