源码编译tmux

 

(1)clone 源代码仓库:

$ git clone https://github.com/tmux/tmux.git

(2) 编译之前先安装libevent,去官网下载tar包:
http://libevent.org

选择需要下载的版本复制链接地址,使用wget下载到本地(图形化的也可以直接下载),如(选择合适的版本,一般选stable即可):

    wget https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz 
    tar -xzf  libevent-2.0.22-stable.tar.gz
    cd  libevent-2.0.22-stable/ $ ./configure && make $ sudo make install 

(3) 编译tmux:

    cd tmux/
    sh autogen.sh
   ./configure && make

安装编译过程可能会提示一些错误:

1)aclocal command not found
原因:自动编译工具未安装,安装上即可:

centOS: yum install automake
  1. configure: error: "curses or ncurses not found"
ubuntu:apt-get install libncurses5-dev
centos: yum install ncurses-devel

(4) 编译成功之后会在tmux下生成一个可执行程序:tmux

    ./tmux

执行的时候可能会出现找不到库的情况:

./tmux: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory

把安装好的libevent库的路径使用软链接到对应的目录:

    64位:
        ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib64/libevent-2.0.so.5
    32位:
        ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib/libevent-2.0.so.5

(5)设置环境变量

  export PATH=xxx

(6)常用的tmux配置:

[root@c936a812-4ccb-491f-8eee-1dd4f670494b ~]# cat .tmux.conf
set -g prefix C-x
unbind C-b
setw -g mode-keys vi
#允许用鼠标切换窗口/调节分屏大小
setw -g mouse-resize-pane on
setw -g mouse-select-pane on
setw -g mouse-select-window on
setw -g mode-mouse on

set-option -g history-limit 5000

bind -t vi-copy 'v' begin-selection     # Begin selection in copy mode.
bind -t vi-copy 'C-v' rectangle-toggle  # Begin selection in copy mode.
bind -t vi-copy 'y' copy-selection      # Yank selection in copy mode.

bind Left swap-window -t -1
bind Right swap-window -t +1

bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"

bind k selectp -U
bind j selectp -D
bind h selectp -L
bind l selectp -R

bind ^k resizep -U 10
bind ^j resizep -D 10
bind ^h resizep -L 10
bind ^l resizep -R 10

bind ^u swapp -U
bind ^d swapp -D

bind ^a last
bind ^q killp

set-window-option -g window-status-current-bg yellow
set-window-option -g window-status-current-fg black

# Plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'

# Plugin configure
set -g @continuum-restore 'on'

run '~/.tmux/plugins/tpm/tpm'
You have new mail in /var/spool/mail/root

 

其中需要用到插件管理,需要先安装插件管理器:

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

 

转载于:https://www.cnblogs.com/kuang17/p/9836839.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值