tmux常用配置
2020-02-29 01:09:07    9    0    0
yuziyue

 

如果是crt或xshell的话需要设置alt为meta键

 

Ubuntu18.04 tmux 2.6 版本

# BASIC
set -g prefix C-g                 # C-b C-a C-f conflict with cursor move
set -g base-index 1               # window index from 1
set -g pane-base-index 1          # panel index from 1
set -g display-panes-time 5000    # select pane pause ms
set -g renumber-windows on        # renew window number after kill a window
set -gs escape-time 0             # No delay for escape key press
set -g history-limit 100000       # scrollback buffer n lines
set -g mouse off                  # mouse settings
setw -g automatic-rename off      # disable auto rename window
setw -g mode-keys vi              # vi like paste mode
setw -g monitor-activity off      # disable activity inform

# THEME
set -g message-style "bg=blue, fg=black"
set -g window-status-separator ""
set -g window-status-format " #I #W#F "
set -g window-status-current-format " #I #W#F "
set -g window-status-current-style "bg=red, fg=black"
set -g status-interval 10
set -g status-left-length 80
set -g status-right-length 80
set -g status-style "bg=blue, fg=black"
set -g status-left "#[bg=green, fg=black] [#S] "
set -g status-right "#[bg=green, fg=black] #(whoami)@#h #[bg=red] CPU: #(cut -d \" \" -f 1-3 /proc/loadavg) #[bg=green] T:#(numfmt --to=iec-i --suffix=B `free -b|awk 'FNR==2{print $2}'`) A:#(numfmt --to=iec-i --suffix=B `free -b|awk 'FNR==2{print $7}'`) #[bg=red] %m-%d %H:%M "

# Change prefix: Ctrl + g
unbind C-b
bind C-g send-prefix

# Reload config: prefix + r
bind -n M-R source-file ~/.tmux.conf \; display-message "Reloaded!"

# Switch pane: Alt hjkl
bind -n M-h select-pane -L
bind -n M-j select-pane -D 
bind -n M-k select-pane -U
bind -n M-l select-pane -R

# Select window: Alt Number
bind -n M-1 select-window -t 1
bind -n M-2 select-window -t 2
bind -n M-3 select-window -t 3
bind -n M-4 select-window -t 4
bind -n M-5 select-window -t 5
bind -n M-6 select-window -t 6
bind -n M-7 select-window -t 7
bind -n M-8 select-window -t 8
bind -n M-9 select-window -t 9

# Create pane: Alt+| Alt+_
bind -n M-_ splitw -v -c '#{pane_current_path}'
bind -n M-| splitw -h -c '#{pane_current_path}'

# Close panel and quit window: Alt+C Alt+Q
bind -n M-C confirm-before -p "kill current pane #P? (y/n)" kill-pane
bind -n M-Q confirm-before -p "kill current windows #W? (y/n)" kill-window

# Swap pane up and down: Alt+J Alt+K
bind -n M-Up swap-pane -U
bind -n M-Down swap-pane -D

# Resize panel: Alt+HJKL
bind -n M-H resize-pane -L 5
bind -n M-J resize-pane -D 5
bind -n M-K resize-pane -U 5
bind -n M-L resize-pane -R 5

# Pane full screen: Alt+Z
bind -n M-Z resize-pane -Z

 

CentOS7.7.1908 tmux 1.8 版本

# BASIC
set -g prefix C-g                             # C-b C-a C-f conflict with cursor move
set -g base-index 1                           # window index from 1
set -g pane-base-index 1                      # panel index from 1
set -g display-panes-time 5000                # select pane pause ms
set -g renumber-windows on                    # renew window number after kill a window
set -gs escape-time 0                         # No delay for escape key press
set-option -g history-limit 100000            # scrollback buffer n lines
set-option -g allow-rename off                # disable auto rename window
set-window-option -g automatic-rename off     # disable auto rename window
setw -g mode-keys vi                          # vi like paste mode
setw -g monitor-activity off                  # disable activity inform

# THEME
set -g status-fg black
set -g status-bg blue
set -g window-status-separator ""
set -g window-status-format " #I #W#F "
set -g window-status-current-format "#[bg=red]#[fg=black] #I #W#F "
set -g status-interval 10
set -g status-left-length 80
set -g status-right-length 80
set -g status-left "#[bg=green, fg=black] [#S] "
set -g status-right "#[bg=green, fg=black] #(whoami)@#h #[bg=red] CPU: #(cut -d \" \" -f 1-3 /proc/loadavg) #[bg=green] T:#(numfmt --to=iec-i --suffix=B `free -b|awk 'FNR==2{print $2}'`) A:#(numfmt --to=iec-i --suffix=B `free -b|awk 'FNR==2{print $7}'`) #[bg=red] %m-%d %H:%M "

# Change prefix: Ctrl + g
unbind C-b
bind C-g send-prefix

# Reload config: prefix + r
bind -n M-R source-file ~/.tmux.conf \; display-message "Config reloaded..."

# Switch pane: Alt hjkl
bind -n M-h select-pane -L
bind -n M-j select-pane -D 
bind -n M-k select-pane -U
bind -n M-l select-pane -R

# Select window: Alt Number
bind -n M-1 select-window -t 1
bind -n M-2 select-window -t 2
bind -n M-3 select-window -t 3
bind -n M-4 select-window -t 4
bind -n M-5 select-window -t 5
bind -n M-6 select-window -t 6
bind -n M-7 select-window -t 7
bind -n M-8 select-window -t 8
bind -n M-9 select-window -t 9

# Create pane: Alt+| Alt+_
bind -n M-_ splitw -v -c '#{pane_current_path}'
bind -n M-| splitw -h -c '#{pane_current_path}'

# Close panel and quit window: Alt+C Alt+Q
bind -n M-C confirm-before -p "kill current pane #P? (y/n)" kill-pane
bind -n M-Q confirm-before -p "kill current windows #W? (y/n)" kill-window

# Swap pane up and down: Alt+J Alt+K
bind -n M-Up swap-pane -U
bind -n M-Down swap-pane -D

# Resize panel: Alt+HJKL
bind -n M-H resize-pane -L 5
bind -n M-J resize-pane -D 5
bind -n M-K resize-pane -U 5
bind -n M-L resize-pane -R 5

# Pane full screen: Alt+Z
bind -n M-Z resize-pane -Z

 

 

上一篇: Bash解析命令行参数

下一篇: tmux常用命令总结

9 人读过
文档导航