tools/terminal

tmux-powerline: 내맘대로 tmux상태바 만들기

seul chan 2017. 3. 19. 22:54

tmux-powerline

tmux-powerline 설치 준비

공식 깃 문서에 따르면, 필요한 grep 툴을 설치하여 주어야 한다고 하여 설치했다.

brew install https://raw.github.com/Homebrew/homebrew-dupes/master/grep.rb

일단 깃에서 다운 받아주고

brew tap homebrew/dupes brew install homebrew/dupes/grep 명령어로 설치를 완료 해 주어야 한다. brew가 설치가 안 되있으면 여기()서 보고 설치해 오면 된다.

tmux-powerline 설치

설치는 간단하다.
아래의 예제에서는 ~/some/path/라고 나와 있는데 그냥 아무 폴더나 만들어서 거기에 아래 깃 클론 명령을 실행하면 된다.
나는 

mkdir ~/tmux_powerline을 만든 후 

cd ~/tmux_powerline을 한 후 여기에 설치하였다. 


나중에 설정을 해야하니 잘 모르겠으면 그냥 따라하면 된다. (위의 명령어들을 친 후 git clone으로 시작하는 아래의 명령어만 치면 된다)


cd ~/some/path/ git clone https://github.com/erikw/tmux-powerline.git


이제 설치가 끝났다!! (?!) 정말이다. 간단하지?

사실 아직 설정이 남아있다.

tmux-powerline 설정 백업하기

설치는 미약하였으나 설정은 창대하리라... 이 설정때문에 깨나 고생했다.
~/.tmux.conf 파일이 대부분 없을것이다. 그래서 기본 설정이 없다고 생각하면 안된다. 어딘가에 되어 있는 기본 설정을 찾는 명령어는 다음과 같다.


tmux show -g | sed 's/^/set-option -g /' > ~/.tmux.backup.conf


이러면 ~/ 디렉토리에 .tmux.backup.conf가 만들어지는데, 여기에 현재 설정된 (많은) 기본 설정들이 들어있다. 이걸 저장해놓고 이런저런 장난을 해야 다시 복구하기가 쉬워진다.


tmux conf 파일을 적응하는 명령어는 source-file이다. 자세한 내용은 tmux 공식 문서에서 확인 할 수 있다. tmux source-file ~/.tmux.backup.conf tmux source-file -f ~/.tmux.backup.conf # -f 명령어를 붙여주면 파일이 없어도 오류가 나지 않았다. 이 명령어는 추후에 자신의 tmux.conf 파일을 만들고 입력하면 된다.

tmux.conf 설정하기

구글, 블로그 등에 엄청나게 다양한 tmux.conf 파일이 있고, 자신에게 맞는 파일을 설정하면 tmux를 자기에게 맞게 설정할 수 있다. 자세한 내용은 tmux conf: 내 마음대로 tmux 쓰기를 참고하면 된다.
일단 공식 문서에 있는 설정만 따라하면 문제 없이 powerline을 사용 가능하다.

set-option -g status on 

set-option -g status-interval 2 

set-option -g status-justify "centre" 

set-option -g status-left-length 60 

set-option -g status-right-length 90 

set-option -g status-left "#(~/path/to/tmux-powerline/powerline.sh left)" 

set-option -g status-right "#(~/path/to/tmux-powerline/powerline.sh right)" 위의 ~/path/to/


위 코드를 자신에게 맞는 폴더로 맞추면 된다. 아까 내 글을 보고 ~/tmux_powerline에다가 tmux를 복제했다면 


 set-option -g status-left "#(~/tmux_powerline/tmux-powerline/powerline.sh left)" 

set-option -g status-right "#(~/tmux_powerline/tmux-powerline/powerline.sh right)" 


이 되겠다. 진짜 짱 친절하다.

이 설정만 하면 이제 powerline이 보일 것이다. 여러 문제들이 있으니 추후 참고하겠다.

이제 비전공자도 즐겁게 tmux를 사용하자!

문제: weather이 표시되지 않음

No weather location specified. 라고 뜬다.


참고 url: - https://github.com/erikw/tmux-powerline (깃헙 주소) - https://github.com/erikw/tmux-powerline/issues/219 (야후 날씨 관련 이슈)


location을 제대로 못잡아주는듯... 한국의 location numb: 1132599

설정은 이정도로만 하고,,, 설정은 그만하고 공부하자!