Linux/Ubuntu

[Linux, Ubuntu] tmux 설정

Study with Me! 2024. 5. 1. 16:51

아래 명령어로 tmux와 필요한 플러그인을 설치하자.

sudo apt-get install tmux
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm

아래 내용을 ~/.tmux.conf 파일에 입력 후 설정 파일을 적용시키고, 플러그인을 설치해야 한다.

Ctrl+a 입력 후 :source-file ~/.tmux.conf 를 입력하면 설정 파일을 적용시킬 수 있다.

후에 Ctrl+a 입력 후 대문자 i를 입력하면 플러그인이 설치된다.

set -g default-terminal "screen-256color"

set -g prefix C-a
unbind C-b
bind-key C-a send-prefix

unbind %
bind | split-window -h

unbind '"'
bind - split-window -v

unbind r
bind r source-file ~/.tmux.conf

bind -r j resize-pane -D 3
bind -r k resize-pane -U 3
bind -r l resize-pane -R 3
bind -r h resize-pane -L 3

bind -r m resize-pane -Z

set-window-option -g mode-keys vi

set -g mouse on

# tpm plugin
set -g @plugin 'tmux-plugins/tpm'

# list of tmux plugins
set -g @plugin 'christoomey/vim-tmux-navigator' # for navigating panes and vim/nvim with Ctrl-hjkl
set -g @plugin 'jimeh/tmux-themepack' # to configure tmux theme
set -g @plugin 'tmux-plugins/tmux-resurrect' # persist tmux sessions after computer restart
set -g @plugin 'tmux-plugins/tmux-continuum' # automatically saves sessions for you every 15 minutes

set -g @themepack 'powerline/default/cyan' # use this theme for tmux

set -g @resurrect-capture-pane-contents 'on' # allow tmux-ressurect to capture pane contents
set -g @continuum-restore 'on' # enable tmux-continuum functionality

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

블로그 주인장은 쉘 설정파일(.bashrc, .zshrc 등)에 아래 단축키를 등록해 사용한다.

...
alias tn="tmux new -s Session"
alias tm="tmux attach -t Session"
alias td="tmux detach"
...

tmux와 vim을 함께 사용하기 위한 설정과 단축키 설정을 위해 아래 글을 보는 것이 좋을 것이다.

 

[Linux, Ubuntu] 나의 .vimrc 설정

vim의 설정파일 .vimrc은 다음과 같이 설정되어 있다.마지막 세션 Key Setting/Tmux Keyset 파트는 단축키 설정이라 취향에 맞게 설정하면 될 것 같다.(아래 파일을 적용시키기 위해 해야할 일이 아래에

seongmoahn.tistory.com