Tmux – comandi e configurazione
Un riassunto di comandi utili basati sulla mia configurazione
Comandi di base
- Ctrl+a ? Show the list of key bindings (i.e., help)
Sessioni
- Ctrl+a $ Rinomina la sessione
- Ctrl+a s lista delle sessioni
Finestre
- Ctrl+a , Rinomina la finestra corrente
- Ctrl+a & Chiude la finestra
- Ctrl+a c Create a new window
- Ctrl+a n Go to next window
- Ctrl+a p Go to previous window
- Ctrl+a 0 [zero] Go to window 0. Numbers 1-9 are similar.
- Ctrl+a w Mostra la lista delle finestre. Anche la status bar con la lista delle finestre
Pannelli
- Ctrl+a t Apre un orologio digitale
- Ctrl+a Alt-arrow Ridimensiona un pane di 5 caratteri
- Ctrl+a Ctrl-arrow Ridimensiona un pane di 1 carattere
- Ctrl+a arrow Sposta il cursore da un pane all’altro
- Ctrl+a ! Porta un pane in una nuova finestra
- Ctrl+a x Chiude un pane
- Ctrl+a – Split pane horizontally
- Ctrl+a | Split pane vertically
- Ctrl+a z Zoom pannello
Copia
- Ctrl+a [ Abilita la copy-mode (Oppure premere il tasto F4)
- Space Inizio a selezionare muovendo le frecce
- y Copia nella clipboard
- q Ritorno alla normal-mode
- Ctrl+a ] Incolla oppure Ctrl + Shift + v
Comandi tmux
- tmux list-sessions Lista le sessioni tmux attive
- tmux kill-session -a Killa tutte le sessioni
Configurazione
# reload config file (change file location to your the tmux.conf you want to use)
bind r source-file ~/.tmux.conf
# Change the command prefix from Ctrl-b to Ctrl-a
unbind-key C-b
set-option -g prefix C-a
bind-key C-a send-prefix
set-option -gw xterm-keys on
set-option -g default-terminal "xterm-256color"
#split panes using | and -
bind | split-window -h -c '#{pane_current_path}'
bind - split-window -v -c '#{pane_current_path}'
unbind '"'
unbind %
# switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# switch pannelli con il mouse
# resize panneli con il mouse
set -g mouse on
unbind-key -T copy-mode-vi v
setw -g mode-keys vi
bind-key -n F4 copy-mode
bind-key -n C-Right send-keys C-Right
bind-key -n C-Left send-keys C-Left
bind -n End send-key C-e
bind -n Home send-key C-a
bind p paste-buffer # `prefix + p` pastes the latest buffer
bind-key -T copy-mode-vi 'v' send -X begin-selection # Begin selection in copy mode.
bind-key -T copy-mode-vi 'C-v' send -X rectangle-toggle # Begin selection in copy mode.
bind-key -T copy-mode-vi 'y' send -X copy-selection # Yank selection in copy mode.
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
set -g @plugin 'tmux-plugins/tpm'
run -b '~/.tmux/plugins/tpm/tpm'
Dato che la configurazione personalizzata crea una nuova sessione, dovremmo lanciare il comando tmux attach per evitare il comportamento di default che crea automaticamente una nuova sessione. Altrimenti finiremo in una sessione addizionale non voluta.
Ivan - 15 Ottobre 2020 at 8:56 -
I comandi devono essere tutti preceduti da Ctrl+b, Ctrl+a si usa in screen.
admin - 15 Ottobre 2020 at 9:40 -
Da me si usa Ctrl+a come si vede nel file di configurazione sotto nel quale ho appunto ridefinito la chiave
# Change the command prefix from Ctrl-b to Ctrl-a
unbind-key C-b
set-option -g prefix C-a
bind-key C-a send-prefix