.tmux.confを書き直した
なぜ
今まで.tmux.confにprefixの変更くらいしか書いていなかったのだが、緑一色でダサいのでもう少しいい感じにしたかった
この2つのページを参考にした(パクったともいう)
結果こんな感じになった
環境
- ArchLinux
- tmux 3.0a
書いたもの
.tmux.conf
# enable mouse operate set -g mouse on # into copymode with scroll up bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'" # out of copymode with scroll to end bind -n WheelDownPane select-pane -t= \; send-keys -M # prefix change to C-t unbind C-b set -g prefix C-t bind C-t send-prefix # scroll buffer set -g history-limit 65535 # buffer scllol on xterm #set-window-option -g mode-mouse on #set -g terminal-overrides 'xterm*:smcup@:rmcup@' bind c new-window -c "#{pane_current_path}" bind \" split-window -v -c "#{pane_current_path}" bind % split-window -h -c "#{pane_current_path}" # vi mode setw -g mode-keys vi # less delay of key stroke set -sg escape-time 1 # move pane with vi key binds bind h select-pane -L bind j select-pane -D bind k select-pane -U bind l select-pane -R # resize pane with vi key binds bind -r H resize-pane -L 5 bind -r J resize-pane -D 5 bind -r K resize-pane -U 5 bind -r L resize-pane -R 5 # number start with 0 set -g base-index 1 setw -g pane-base-index 1 # renumber window closed set -g renumber-windows on # X clipboard ## vi style bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xsel -i -p && xsel -o -p | xsel -i -b" bind p run "xsel -o | tmux load-buffer ~ ; tmux paste-buffer" ## emacs style #bind-key -T copy-mode y send-keys -X copy-pipe-and-cancel "xsel -i -p && xsel -o -p | xsel -i -b" #bind C-y run "xsel -o | tmux load-buffer ~ ; tmux paste-buffer" # 256 color terminal set -g default-terminal "screen-256color" # color set -g status-style fg="white",bg="colour238" setw -g window-status-style fg="default","bright" setw -g window-status-current-style fg="black",bg="yellow","dim" set -g pane-border-style fg="colour023" set -g pane-active-border-style fg="cyan" set -g message-style fg="white",bg="black","bright" # status line ## left set -g status-left-length 40 set -g status-left "#[fg=green]Session:#S#[fg=default]:#[fg=yellow]#I#[fg=default]:#[fg=cyan]#P" ## right set -g status-right "%Y/%m/%d %H:%M" ## pane set -g pane-border-status "bottom" set -g pane-border-format "#[fg=black,bg=cyan,dim] #P #(tmux-pane-border '#{pane_current_path}')" ## reflash time (/s) set -g status-interval 60 ## window list position set -g status-justify "centre" ## notification setw -g monitor-activity on set -g visual-activity on
補助スクリプト
tmux-pane-border
#!/bin/bash current_path="#[fg=cyan,bg=colour238] $1 " git_status=$(cd $1; git status -s) if $? ; then echo "$current_path#[bg=cyan] " exit 0 fi branch=$(cd $1; git branch | sed -n 's/^\* //p') if [ -z "$git_status" ]; then echo "$current_path#[fg=black,bg=cyan,dim] $branch " exit 0 fi if echo "$git_status" | grep '^.[^ ] ' > /dev/null; then echo "$current_path#[fg=white,bg=red,bright] $branch " exit 0 fi echo "$current_path#[fg=black,bg=yellow,dim] $branch "
.zshrcへの追記
# precmd precmd() { vcs_info if [ -n "$TMUX" ]; then tmux refresh-client -S fi }
学びを得たもの
- setはset-optionの略
- setwはset-window-optionの略
- pane-border-formatにはtmuxの変数を渡さないと更新してくれない