Tmux – comandi e configurazione
29 Giugno 2017

Tmux – comandi e configurazione

Un riassunto di comandi utili basati sulla mia configurazione

Comandi di base

Sessioni

Finestre

Pannelli

Copia

Comandi tmux

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.


Comments

  1. Ivan - 15 Ottobre 2020 at 8:56 - Rispondi

    I comandi devono essere tutti preceduti da Ctrl+b, Ctrl+a si usa in screen.

    • admin - 15 Ottobre 2020 at 9:40 - Rispondi

      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


Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *