프로그래밍

tmux에서 마우스 사용하기

hydragon 2021. 7. 11. 12:07
반응형

tmux 설치

sudo apt-get install tmux

 

tmux에서 마우스 클릭, 스크롤 기능 등을 사용하려면 tmux.conf 파일을 추가해야 한다.

편집기로 tmux.conf를 추가하자.

nano ~/.tmux.conf

 

파일에 아래 내용을 붙여 넣고 저장한다.

set -g mouse on

setw -g mode-keys vi

# Use Alt-arrow keys without prefix key to switch panes
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D

# Shift arrow to switch windows
bind -n S-Left  previous-window
bind -n S-Right next-window

# scrollback buffer size increase
set -g history-limit 100000

# change window order
bind-key -n C-S-Left swap-window -t -1
bind-key -n C-S-Right swap-window -t +1

# disable window name auto change
set-option -g allow-rename off

# bar color
set -g status-bg black
set -g status-fg white

# toggle pane title visibility
bind T run 'zsh -c "arr=( off top ) && tmux setw pane-border-status \${arr[\$(( \${arr[(I)#{pane-border-status}]} % 2 + 1 ))]}"'
# rename pane
bind t command-prompt -p "(rename-pane)" -I "#T" "select-pane -T '%%'"

 

이제 새로운, 혹은 기존의 tmux 세션을 열고 단축키 "ctrl + b, :"를 입력한다. 

다음으로 tmux 하단 명령줄에 다음과 같이 입력하면 된다.

source-file ~/.tmux.conf

 

이제 마우스를 이용한 pane 사이즈 변경, window 변경 등 활용이 가능하다. vi 키 모드를 지원하고 마우스 클릭으로 pane 간, window 간 이동하는 것이 가능하다.

 

아래처럼 tmux 창을 좀 더 쉽게 분할해 사용하는 것이 가능하다.

 

반응형