From d7c7c7dd922f21c5dce9430eaae9cf310f587744 Mon Sep 17 00:00:00 2001 From: srdusr Date: Sat, 3 Dec 2022 23:08:18 +0200 Subject: Fixed formatting of text --- tools/tmux.md | 433 +++++++++++++++++++++++++++++++--------------------------- 1 file changed, 229 insertions(+), 204 deletions(-) diff --git a/tools/tmux.md b/tools/tmux.md index 2189e0a..90d8b2b 100644 --- a/tools/tmux.md +++ b/tools/tmux.md @@ -1,296 +1,321 @@ ## Tmux Notes +#### Quick Summary +If a command/keybinding starts with a colon `:` assume that a prefix precedes it. +Usually the default prefix is `Ctrl-b` but can be different if set to something +else. +To set a different prefix put the following into tmux.conf: +```bash +# Setting the prefix from C-b to C-s +unbind C-b +set -g prefix C-s +# Ensure that we can send Ctrl-S to other apps +bind C-s send-prefix +``` + +#### Basic commands/keys +* Enter command mode +` :` +* List keybindings +$ `tmux list-keys` +`:list-keys` +` ?` +* Close current pane +$ `exit` +` x` + +- - - + #### Plugins -* Key bindings for tmux-resurrect -` + Ctrl-s` # save changed to 'W' -` + Ctrl-r` # restore changed to 'E' * Installing plugins -` + I` +` I` then reload tmux environment with either: $ `tmux source ~/.tmux.conf` or if tmux config is in a XDG config base directory $ `tmux source ~/.config/tmux/tmux.conf` +or use this keybinding +` r` * Plugin uninstall Delete or comment out the plugin in .tmux.conf Then save and reload - - - -#### Basic commands/keys -* List keybindings -$ `tmux list-keys` -or -`:list-keys` -or -`:?` - -* Panes Management -`:swap-pane -U` # move current pane up or anti-clockwise -`:swap-pane -D` # move current pane down or clockwise -`{` or `(:swap-pane -L)` # move current pane to the left -`}` or `(:swap-pane -R)` # move current pane to the right -`q` # show pane numbers (type number to move cursor) -`` # toggle pane arrangements -`Ctrl-o` # rotate window -* Move cursor to next window -`o` +#### Panes +#### PANES +* Toggle last active pane +` ;` -* Close Window -`&` or `:kill-window` # kill window -- - - -#### SESSIONS -* Start a new session -$ `tmux` -$ `tmux new` -$ `tmux new-session` -`:new` +* Split pane horizontally +` %` -* Start a new session with the name ***mysession*** -$ `tmux new -s mysession` -`:new -s mysession` +* Split pane vertically +` "` -* Kill/delete session mysession -$ `tmux kill-ses -t mysession` -$ `tmux kill-session -t mysession` +* Move the current pane left +` {` -* Kill/delete all sessions but the current -$ `tmux kill-session -a` +* Move the current pane right +` }` -* Kill/delete all sessions but mysession -$ `tmux kill-session -a -t mysession` +* Switch to another pane depending on it's direction +` ` +` ` +` ` +` ` -* Rename session -`$` +* Toggle synchronize-panes(send command to all panes) +`:setw synchronize-panes` -* Detach from session -`d` +* Switch to next pane +` o` -* Detach others on the session (Maximize window by detaching other clients) -`:attach -d` +* Show pane numbers +` q` -* Show all sessions -$ `tmux ls` -$ `tmux list-sessions` -`s` +* Switch/select pane by number +` q 0 ... 9` -* Attach to last session -$ `tmux a` -$ `tmux at` -$ `tmux attach` -$ `tmux attach-session` - -* Attach to a session with the name mysession -$ `tmux a -t mysession` -$ `tmux at -t mysession` -$ `tmux attach -t mysession` -$ `tmux attach-session -t mysession` +* Resize current pane height +` Ctrl + ` +` Ctrl + ` -* Move to previous session -`(` +* Resize current pane width +` Ctrl + ` +` Ctrl + ` -* Move to next session -`)` +* move current pane up or anti-clockwise +`:swap-pane -U` -#### WINDOWS +* move current pane down or clockwise +`:swap-pane -D` -* Start a new session with the name mysession and window mywindow -$ tmux new -s mysession -n mywindow +* move current pane to the left +` {` +`:swap-pane -L` -* Create window - c +* move current pane to the right +` }` +`:swap-pane -R` -* Rename current window - , +* show pane numbers (type number to move cursor) +` q` -* Close current window - & +* toggle pane arrangements/layouts +` ` -* Previous window - p -* Next window - n +* Toggle pane zoom +` z` -* Switch/select window by number - 0 ... 9 +* Convert pane into a window +` !` -* Reorder window, swap window number 2(src) and 1(dst) -:swap-window -s 2 -t 1 +* Close current pane +` x` +or just type +$ `exit` -* Move current window to the left by one position -:swap-window -t -1 - - - -* PANES - -* Toggle last active pane - ; +- - - -* Split pane horizontally - % +#### WINDOWS +* Start a new session with the name ***mysession*** and window ***mywindow*** +$ `tmux new -s mysession -n mywindow` -* Split pane vertically - " +* Create window +` c` -* Move the current pane left - { +* Rename current window +` ,` -* Move the current pane right - } +* Previous window +` p` -* Switch to pane to the direction - - - - +* Next window +` n` -* Toggle synchronize-panes(send command to all panes) -:setw synchronize-panes +* rotate window +` Ctrl-o` -* Toggle between pane layouts - Spacebar +* Move cursor to next window +` o` -* Switch to next pane - o +* Switch/select window by number +` 0 ... 9` -* Show pane numbers - q +* Reorder window, swap window number 2(src) and 1(dst) +`:swap-window -s 2 -t 1` -* Switch/select pane by number - q 0 ... 9 +* Move current window to the left by one position +`:swap-window -t -1` -* Toggle pane zoom - z +* Close Window +` &` +`:kill-window` +- - - -* Convert pane into a window - ! +#### SESSIONS +* Start a new session +$ `tmux` +$ `tmux new` +$ `tmux new-session` +` :new` -* Resize current pane height(holding second key is optional) - + - Ctrl + - + - Ctrl + +* Start a new session with the name ***mysession*** +$ `tmux new -s mysession` +` :new -s mysession` -* Resize current pane width(holding second key is optional) - + - Ctrl + - + - Ctrl + +* Kill/delete session ***mysession*** +$ `tmux kill-ses -t mysession` +$ `tmux kill-session -t mysession` -* Close current pane - x +* Kill/delete all sessions but the current +$ `tmux kill-session -a` +* Kill/delete all sessions but ***mysession*** +$ `tmux kill-session -a -t mysession` +* Rename session +` $` -* COPY MODE +* Detach from session +` d` -* Use vi keys in buffer -:setw -g mode-keys vi +* Detach others on the session (Maximize window by detaching other clients) +`:attach -d` -* Enter copy mode - [ +* Show all sessions +$ `tmux ls` +$ `tmux list-sessions` +` s` -* Enter copy mode and scroll one page up - PgUp +* Attach to last session +$ `tmux a` +$ `tmux at` +$ `tmux attach` +$ `tmux attach-session` -* Quit mode - +* Attach to a session with the name ***mysession*** +$ `tmux a -t mysession` +$ `tmux at -t mysession` +$ `tmux attach -t mysession` +$ `tmux attach-session -t mysession` -* Go to top line - +* Move to previous session +` (` -* Go to bottom line - +* Move to next session +` )` +- - - -* Scroll up - +#### Copy Mode +* Use vi keys +`:setw -g mode-keys vi` +or put this into tmux.conf: +```bash +set-window-option -g mode-keys vi +``` -* Scroll down - +* Enter copy mode +` [` -* Move cursor left - +* Enter copy mode and scroll one page up +` ` -* Move cursor down - +* Quit mode +`` -* Move cursor up - +* Go to top line +`` -* Move cursor right - +* Go to bottom line +`` -* Move cursor forward one word at a time - +* Scroll up +`` -* Move cursor backward one word at a time - +* Scroll down +`` -* Search forward - +* Move cursor left +`` -* Search backward - +* Move cursor down +`` -* Next keyword occurance - +* Move cursor up +`` -* Previous keyword occurance - +* Move cursor right +`` -* Start selection - +* Move cursor forward one word at a time +`` -* Clear selection - +* Move cursor backward one word at a time +`` -* Copy selection - +* Search forward +`` -* Paste contents of buffer_0 - ] +* Search backward +`` -* Display buffer_0 contents -:show-buffer +* Next keyword occurance +`` -* Copy entire visible contents of pane to a buffer -:capture-pane +* Previous keyword occurance +`` -* Show all buffers -:list-buffers +* Start selection +`` -* Show all buffers and paste selected -:choose-buffer +* Clear selection +`` -* Save buffer contents to buf.txt -:save-buffer buf.txt +* Copy selection +`` -* Delete buffer_1 -:delete-buffer -b 1 +* Paste contents of buffer_0 +` ]` +* Display buffer_0 contents +`:show-buffer` +* Copy entire visible contents of pane to a buffer +`:capture-pane` -* MISC +* Show all buffers +`:list-buffers` -* Enter command mode - : +* Show all buffers and paste selected +`:choose-buffer` -* Set OPTION for all sessions -:set -g OPTION +* Save buffer contents to buf.txt +`:save-buffer buf.txt` -* Set OPTION for all windows -:setw -g OPTION +* Delete buffer_1 +`:delete-buffer -b 1` +- - - -* Enable mouse mode -:set mouse on +#### MISC +* Enter command mode +` :` +* Set OPTION for all sessions +`:set -g OPTION` +* Set OPTION for all windows +`:setw -g OPTION` -* HELP +* Enable mouse mode +`:set mouse on` +- - - -* List key bindings(shortcuts) -$ tmux list-keys -:list-keys - ? +#### HELP +* List key bindings(shortcuts) +$ `tmux list-keys` +`:list-keys` +` ?` -* Show every session, window, pane, etc... -$ tmux info +* Show every session, window, pane, etc... +$ `tmux info` +- - - -- cgit v1.2.3