分享一個好用的tmux配置文件


tmux眾所周知,不過多介紹,友好的tmux配置,讓人用起來很舒服,分享一個tmux配置文件

# ------ general ------------------------------------
set -g prefix2 C-s
bind C-s send-prefix -2

set -g escape-time 0
set -g base-index 1
set -g renumber-windows on
set -g mouse on
set -wg pane-base-index 1

# rename-window
set -wg allow-rename off
set -wg automatic-rename off

set -wg mode-keys vi

# last-window
bind a last

# retain current path
bind c new-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind '"' split-window -c "#{pane_current_path}"

# restart and edit
bind r source ~/.tmux.conf\; display "tmux config sourced"
bind e neww -n tmux-config "\${EDITOR:-vim} ~/.tmux.conf"

# ------ move around --------------------------------
bind -r h select-pane -L 
bind l select-pane -R        # remove repeat, because of ls
bind -r j select-pane -D
bind -r k select-pane -U

# ------ status theme -------------------------------
set -g message-style "bg=#00346e, fg=#ffffd7"        # tomorrow night blue, base3

set -g status-style "bg=#00346e, fg=#ffffd7"   # tomorrow night blue, base3
set -g status-left "#[bg=#0087ff] ❐ #S "       # blue
set -g status-left-length 400
set -g status-right "#{?client_prefix, ⌨ , } #[bg=#0087ff] #(whoami)@#h #[bg=red] %Y-%m-%d %H:%M "
set -g status-right-length 600

set -g set-clipboard on
set -g history-limit 8000

set -wg window-status-format " #I #W "
set -wg window-status-current-format " #I #W "
set -wg window-status-separator ""
set -wg window-status-current-style "bg=red" # red
set -wg window-status-last-style "fg=red"

set -wg pane-active-border-style "fg=blue"
set -wg pane-border-style "fg=#585858"       # base01

# ------- copy to clipboard ------------------------
# bind -t vi-copy y copy-pipe 'xclip -selection clipboard > /dev/null'
# bind -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"

注意在添加配置文件的時候,一定要關閉所有tmux窗口,然后source .tmux.conf,之后進入tmux就可以愉快的使用了

--------

更新,進入tmux之后,可能無法使用鼠標選中並且復制的情況,這個時候將配置文件中的

set -g mouse on

這一行注釋掉即可


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM