ファイルの貼り付け
tmuxを使うと,
bind-key i command-prompt -p "(load-and-paste) file?" "load-buffer %%" \; paste-buffer
bind-key I command-prompt -p "(load-buffer) file?" "load-buffer %%"
この設定が実現する動作は,
なお,
独自のステータス表示
ある程度以上にtmuxの設定を増やしてしまうと,
このような場合に備えて,
STATUS_LEFT_SIMPLE="#[fg=black,bg=$MYHOSTCOLOR] #h #[fg=brightcyan,bg=black][#S:#I:#P]#[default]"
STATUS_LEFT_DETAIL="#[fg=green,bg=black] #(lsb_release -c --short) #[fg=black,bg=$MYHOSTCOLOR] #h #[default]#[fg=black,bg=yellow]<#(echo $SSH_CONNECTION | cut -d ' ' -f1)#[fg=brightcyan,bg=black][#S:#I:#P]#[fg=blue,bg=yellow] #[default]"
STATUS_RIGHT_SIMPLE="#[default]#[fg=black,bg=white] %h %m(%a)|%H:%M#[default]"
STATUS_RIGHT_DETAIL="#[fg=white,bg=red]?#(cat /var/lib/update-notifier/updates-available | cut -s -d ' ' -f1 | paste -d ' ' -s)!#[fg=yellow,bg=blue]#(cut -d ' ' -f 1-3 /proc/loadavg)#[default]#[fg=black,bg=white] %h %m(%a) %Y|%H:%M#[default]"
set-option -g status-left $STATUS_LEFT_DETAIL
set-option -g status-right $STATUS_RIGHT_DETAIL
unbind l
bind-key l refresh-client \; source ~/.tmux.conf.status1
.tmux.
set -g status-left $STATUS_LEFT_SIMPLE
set -g status-right $STATUS_RIGHT_SIMPLE
bind-key l refresh-client \; source ~/.tmux.conf.status2
# vim syntax sugars{{{1
# vim:set ft=tmux ts=2 sw=2 sts=2 foldmethod=marker:
# }}}
.tmux.
set -g status-left $STATUS_LEFT_DETAIL
set -g status-right $STATUS_RIGHT_DETAIL
bind-key l refresh-client \; source ~/.tmux.conf.status1
# vim syntax sugars{{{1
# vim:set ft=tmux ts=2 sw=2 sts=2 foldmethod=marker:
# }}}
なお,
alias str2num="hexdump -v -e '8/1 \"%03o\" \"\n\"'"
alias host2color="echo $[`hostname | str2num -n5` % 8]"
MYHOSTCOLOR="$((`host2color`+2))"
また,
複数ペインへの同時入力
tmuxには,
たとえば次のように設定しておくと,
set-option -g synchronize-panes off
bind-key e set-window-option synchronize-panes on \; display 'synchronize begin'
bind-key E set-window-option synchronize-panes off \; display 'synchronize end'
このモードはかなり危険なので,
set-option -g synchronize-panes off
bind-key e set-window-option synchronize-panes on \; set-option -g status-bg red \; display 'synchronize begin'
bind-key E set-window-option synchronize-panes off \; set-option -g status-bg $MYHOSTCOLOR \; display 'synchronize end'
なお,