一半君的总结纸

听话只听一半君

Going to the dark side, tmux 教程

高逼格的你怎么能不使用 tmux 呢,所以…

Mode-dependent highlighting

  • Normal mode
  • Insert mode
  • Visual mode
  • Replace mode

Automatic truncation of segments in small windows

  • Truncation illustration
  • Truncation illustration
  • Truncation illustration

我在 synology NAS 上也装了,首先需要有装ipkg, 然后

ipkg install tmux

保存当前所有设置先

tmux show -g | cat > ~/.tmux.conf

# 或者说应该这样,前面加上set-option -g
tmux show -g | sed 's/^/set-option -g /' > ~/.tmux.conf

改好以后

# 刷新当前配置
tmux source-file ~/.tmux.conf
  • rename session :
    prefix, then dollar sign:

    <C-b> $
    

    or

    tmux rename-session -t 1 yeah
    
    # 显示所有的session
    >tmux ls
    mine: 1 windows (created Fri May 16 11:55:01 2014) [118x43] (attached)
    yeah: 1 windows (created Fri May 16 11:52:34 2014) [118x20]
    
    
  • powerline (新的python版)和patch过的字体安装 , 见官网doc
  • vim里上下左右箭头键会插入A B C D
    解决方法是在~/.vimrc里第一行加入

    set nocompatible
    

cygwin 里的 vim 的配置文件

set nocompatible

set rtp+=/cygdrive/c/python27/lib/site-packages/powerline/bindings/vim/

# Always show statusline
set laststatus=2

# Use 256 colours (Use this setting only if your terminal supports 256 colours)
set t_Co=256

常用命令

    • session的
      # 新开 session
      tmux new -s session_name
      
      # 列出已有 session
      tmux ls
      
    • pane的
      # 交换pane
      tmux swap-pane -[UDLR] # (prefix + { or })
      
      # 垂直分割
      tmux split-window # (prefix + ")
      
      # 水平分割
      tmux split-window -h # (prefix + %)
      
      # 移动pane到另一个session
      tmux join-pane -s session1:window1 -t session2:window2
      
      # 切换layout,比如水平换垂直
      C-a space 或者 select-layout 命令
      
    • 乱搞 如果是嵌套的session,内层的关不掉怎么办
      # 可以试试prefix 按两次,然后按d 比如
      C-a C-a d
      
      # 或者 在"外面"运行
      tmux attach -d
      # 这意思是 attach to the default session, and detach all other sessions currently attached.
      
      
    • 出现 no more processes 错误提示
      可以试试这样 tmux session lost in unknown pts, cause and possible solution?
      According to the tmux mapage:If the socket is accidentally removed, the SIGUSR1 signal may be sent to the tmux server process to recreate it.So sending the signal and attaching works:

      killall -s SIGUSR1 tmux
      tmux attach
      
    • 出现错误提示
      ExceptionPexpect: pty.fork() failed: [Errno 11] Resource temporarily unavailable
      这可能是file descriptor耗尽,参考 fork: retry: Resource temporarily unavailable
      Find Out How Many File Descriptors Are Being Used

备忘录:
人肉备份

待续 …

参考:
終端機必備的多工良伴:tmux
Workflow in Tmux
tmux Tutorial – Split Terminal Windows Easily
Tmux: A Simple Start
A tmux Tutorial and PrimerIntro to Tmux
How can I install and use powerline plugin?
http://blog.sanctum.geek.nz/vi-mode-in-tmux/

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: