LoginSignup
14
6

More than 5 years have passed since last update.

Macにtmuxをインストール

Last updated at Posted at 2016-11-11

公式サイト

インストール

Homebrewでインストール
$ brew install tmux
$ tmux -V
tmux 2.3

カスタマイズ

.tmux.confでキーバインドなどを変更
私のconfはこんな感じ

.tmux.conf
# Set the prefix to C-t
set-option -g prefix C-t
unbind-key C-b
bind-key C-t send-prefix

# Reread the configuration file
bind l source-file ~/.tmux.conf

# Key bindings for the copy mode
set-window-option -g mode-keys vi

# Switching windows
unbind-key t
bind-key t next-window
bind-key r previous-window

# Status line
set -g status-bg black
set -g status-fg white
set -g status-attr dim
set -g status-left-length 50
set -g status-left '#[fg=green,bold][#(whoami)@#H]#[default]'
set -g status-right '#[fg=green,bold][%Y/%m/%d(%a)%H:%M]#[default]'
set -g message-attr bold
set -g message-fg white
set -g message-bg red

set -g pane-active-border-fg white
set -g pane-active-border-bg black

set-window-option -g mode-bg white
set-window-option -g mode-fg black
set-window-option -g window-status-bg black
set-window-option -g window-status-fg white
set-window-option -g window-status-current-bg white
set-window-option -g window-status-current-fg black
set-window-option -g window-status-current-attr bold


# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'

#
set -g @plugin 'nhdaly/tmux-better-mouse-mode'

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

# mouse
set-option -g mouse on

v2.0 → v2.1の変更点

v2.1からmouse関連の設定が変更されているみたいなので
以下2点対応する

  • マウススクロールを有効にする
  • スクロール範囲のコピーを有効にする

マウススクロールを有効にする

変更履歴

このままではスクリーンがスクロールしないようなので、プラグインを導入
tmux-better-mouse-mode

(前準備)TPMを導入

Tmux Plugin Manager

1. インストール

$ git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm

2. tmux.confの最下部に追記
tmux.conf
(中略)
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'

# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'git@github.com/user/plugin'
# set -g @plugin 'git@bitbucket.com/user/plugin'

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
3.tmux.confを再読み込み

$ tmux source ~/.tmux.conf

tmux-better-mouse-mode 導入
1.tmux.confに追記
tmux.conf
(中略)
set -g @plugin 'nhdaly/tmux-better-mouse-mode'
2.プラグインをインストール

tmuxを起動して prefix + I
confに列挙したプラグインのインストールが開始される

スクロール範囲のコピーを有効にする

私は"iTerm2"を利用しているので以下2通りを試す
1. optionを押しながら
2. iTermの設定

1. optionを押しながら

「option」キーを押しながら選択

2. iTermの設定

Preferencesを開き、
General→Selection
"Applications ing terminal may access clipboard" にチェックを入れる

スクリーンショット 2016-11-11 11.13.27.png

v2.1 → v2.2の変更点

以下のエラーが出るようになった
.tmux.conf:10: unknown option: utf8
公式サイトによると不要になったとのこと
なので、関するオプションを削除

.tmux.conf
# 削除
# utf8
# set-window-option -g utf8 on
14
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
6