29
Go to list of users who liked
29
More than 5 years have passed since last update.
tmux内のvimで256色を設定する+複数ペインでのコピペ
Last updated atPosted at 2013-03-30
tmuxをインストールした時にvimで256色を設定するのにハマったのでメモっときます。
設定ファイルの中身はほとんど
http://n.blueblack.net/articles/2012-07-20_04_comfortable_cui_environment_tmux/
のコピペです。
tmux.conf
## tmux内のvimで256色を設定する方法# まず# tmux kill-server でtmuxのセッション?をすべて削除# このファイルを~/.tmux.conf として設置# シェルがzshでない場合は# 設定内部で使用するシェルは一番下に記載する# 作成したシェルを~/bin に作成してパスを通す# 最後に tmux -f ~/.tmux.conf で設定ファイルを読み込ませて起動すると設定が反映される## スクリーンにxtermを使用するのは非推奨の用だがvimで動きがおかしくなるのと、# 今のところ問題ないのでxtermを指定する## 参考# 設定の内容は↓のコピペ# http://n.blueblack.net/articles/2012-07-20_04_comfortable_cui_environment_tmux/## ペインが複数になった時にはteratermなどでコピペが効かなくなるけど# windows:Ctrl# mac:option# を押しながらだとできるようになる### +----------------------------------------------------------------------------------------+# セッションオプション# +----------------------------------------------------------------------------------------+# 新しいウィンドウのベース番号set-option -g base-index 1# 全てのベルを無視set-option -g bell-action none# 各セッションで保持するバッファ数set-option -g buffer-limit 20# 256色端末を使用# "screen-256color" にするとvimの<Home><End>が変わるのでxtermに変更# set-option -g default-terminal "screen-256color"set-option -g default-terminal "xterm"# ウィンドウ履歴で保持される最大行数set-option -g history-limit 5000# Escapeキー入力時の待ち時間(0.5秒)をキャンセルset-option -s escape-time 0# 起動シェルを指定set-option -g default-shell /bin/zsh# +----------------------------------------------------------------------------------------+# ステータスライン# +----------------------------------------------------------------------------------------+# status-left 及び status-right の非ASCII文字をUTF-8として扱う# set-option -g status-utf8 on# set-option -g status-left '#[fg=white,bg=blue][S:#S]#[default]'# set-option -g status-right '#[fg=black,bg=cyan][CPU=#(getCpuUsage.sh) MEM=#(getMemUsage.sh)]#[fg=white,bg=blue][%Y/%m/%d(%a)%H:%M]#[default]'set-option -g status-left '#[fg=black,bg=green][S:#S]#[default]'set-option -g status-right '#[fg=black,bg=green][CPU=#(getCpuUsage.sh) MEM=#(getMemUsage.sh)]#[fg=black,bg=green][%Y/%m/%d(%a)%H:%M]#[default]'set-option -g status-right-length 50# set-option -g status-fg white# set-option -g status-bg black# set-window-option -g window-status-fg blue# set-window-option -g window-status-bg black# set-window-option -g window-status-current-fg white# set-window-option -g window-status-current-bg blue# +----------------------------------------------------------------------------------------+# ウィンドウオプション# +----------------------------------------------------------------------------------------+# ウィンドウを実行コマンド名で自動リネームset-window-option -g automatic-rename on# スクロールモード、コピーモード、選択モードで vi のキーバインドを使うset-window-option -g mode-keys vi# ウィンドウで動作があるとステータスラインでハイライトset-window-option -g monitor-activity on# UTF-8 シーケンスが現れることに備えるset-window-option -g utf8 on# +----------------------------------------------------------------------------------------+# その他# +----------------------------------------------------------------------------------------+# マウス関連# set-option -gw mode-mouse on# set-option -g mouse-utf8 on## mouse-resize-pane on にするとteratermでのコピー&ペーストがCtrlボタンを押しながらやる必要があるのでOFF# set-option -g mouse-resize-pane onset-option -g mouse-select-pane on# set-option -g mouse-select-window on# prefix + r で設定ファイルを再読み込みunbind rbind r source-file ~/.tmux.conf# キーバインド# 各種ペインの移動bind h select-pane -Lbind j select-pane -Dbind k select-pane -Ubind l select-pane -R# 各種ペインのリサイズbind H resize-pane -L 5bind J resize-pane -D 5bind K resize-pane -U 5
以下設定ファイル内で使用するシェル
getCpuUsage.sh
# !/bin/bashtop-bn1 |grep"^Cpu(s)" |sed"s/.*, *\([0-9.]*\)%id.*/\1/" |awk'{printf ("%3d%\n", 100 - $1 + 0.5)}'
getMemUsage.sh
# !/bin/bashfree |grep"^Mem:" |awk'{printf ("%3d%\n", (($3 / $2) * 100) + 0.5)}'
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme