[NOTE] Updated November 16, 2019. This article may have outdated content or subject matter.
编译安装
安装依赖
1
2
|
apt-get install libevent-dev
apt-get install libcurses-ocaml-dev
|
下载源码编译安装
1
2
3
4
5
6
|
$ wget https://github.com/tmux/tmux/releases/download/2.9a/tmux-2.9a.tar.gz
$ tar -xvf tmux-2.9a.tar.gz
$ cd tmux-2.9a
$ ./configure
$ make
$ make install
|
install powerline
tmux-powerline已经不维护了,所以转为使用powerline.
安装
-
安装pip源的版本,稳定版本
1
|
pip install powerline-status
|
-
安装github上面的最新版本
1
|
pip install --user git+git://github.com/powerline/powerline
|
查看powerline的安装位置
1
2
3
4
5
6
7
8
9
10
11
|
$ pip3 show powerline-status
Name: powerline-status
Version: 2.7
Summary: The ultimate statusline/prompt utility.
Home-page: https://github.com/powerline/powerline
Author: Kim Silkebaekken
Author-email: [email protected]
License: MIT
Location: /usr/local/lib/python3.7/site-packages
Requires:
Required-by:
|
如果是安装在用户目录的.local目录下面,要将下面的目录加入到PATH的环境变量中
1
|
export PATH=$PATH:$HOME/.local/bin
|
安装nerd-font字体
1
2
|
brew tap homebrew/cask-fonts
brew cask install font-hack-nerd-font
|
修改iTerm字体
iTerm2配置 –> Profiles –> Text –> Use a different font for non-ASCII Text
将Non-ASCII Font设置为 Knack Nerd Font
Powerline 配置
安装完powerline后,找到对应的poweline.conf位置, 替换掉下面的配置
1
|
if-shell 'test -f ~/.local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf' 'source-file ~/.local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf'
|
配置文档
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
#设置PREFIX为Ctrl-a
set -g prefix C-Space
#解除Ctrl-b与PREFIX的对应关系
unbind C-b
#copy-mode将快捷键设置为vi模式
#setw -g mode-keys vi
# Use vim keybindings in copy mode
# Setup 'v' to begin selection as in Vim
# bind-key -t vi-copy v begin-selection
# bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# Update default binding of Enter to also use copy-pipe
# unbind -t vi-copy Enter
set-window-option -g mode-keys vi
# vi-style copying
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
#将r键设置为加载配置文件,并显示"reloaded!"信息
bind r source-file ~/.tmux.conf \; display "Reloaded!"
#设置终端颜色为256色
set -g default-terminal "screen-256color"
#开启status-bar uft-8支持
#set -g status-utf8 on
# 开启鼠标模式
set-option -g mouse on
# 水平分割面板
unbind '"'
bind - splitw -v
# 垂直分割面板
unbind %
bind | splitw -h
# 绑定上j下k左l右h来方便在面板中切换
bind k selectp -U
bind j selectp -D
bind h selectp -L
bind l selectp -R
if-shell 'test -f ~/.local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf' 'source-file ~/.local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf'
|
参考
- Example tmux configuration
- 让命令行更炫酷