tmux 安装、使用、配置

30349阅读 0评论2012-03-20 
分类:LINUX

tmux功能:

安装:

         sudo apt-get install tmux

          或下载源码包安装

-- 基本使用

-- 快捷键

tmux 的使用主要就是依靠快捷键,通过 C-b 来调用。

配置:

配置文件位于:~/.tmux.conf

点击(此处)折叠或打开

  1. # author: XuTao
  2. # time: Sun Jul 15 21:57:17 CST 2012
  3. # Usage: mv tmux_conf.txt ~/.tmux.conf
  4. #------------------------------------------

  5. #-- base --#
  6. set -g default-terminal "screen"
  7. set -g display-time 3000
  8. set -g history-limit 65535
  9. #----------------------------------------------

  10. #将默认按键前缀改为与C-i避免与终端快捷键冲突

  11. set-option -g prefix C-i
  12. unbind-key C-b
  13. bind-key C-i send-prefix
  14. #----------------------------------------------

  15. #按键绑定


  16. #水平或垂直分割窗口 (C+A+ :split-window + v/h)
  17. unbind '"'
  18. bind - splitw -v #分割成上下两个窗口
  19. unbind %
  20. bind | splitw -h #分割成左右两个窗口
  21. #----------------------------------------------

  22. #选择分割的窗格
  23. bind k selectp -U #选择上窗格
  24. bind j selectp -D #选择下窗格
  25. bind h selectp -L #选择左窗格
  26. bind l selectp -R #选择右窗格
  27. #----------------------------------------------

  28. #重新调整窗格的大小
  29. bind ^k resizep -U 10
  30. bind ^j resizep -D 10
  31. bind ^h resizep -L 10
  32. bind ^l resizep -R 10
  33. #----------------------------------------------

  34. #交换两个窗格
  35. bind ^u swapp -U
  36. bind ^d swapp -D

  37. bind ^a last
  38. bind q killp
  39. #----------------------------------------------

  40. bind '~' splitw htop
  41. bind ! splitw ncmpcpp
  42. bind m command-prompt "splitw -h 'exec man %%'"

  43. unbind s
  44. #----------------------------------------------

  45. #定制状态行

  46. set -g status-left "#[fg=white,bg=blue] > #I < #[default] |" # 0:bash
  47. #set -g status-left "#[fg=white,bg=blue] > #I < #[default] |" # session-name
  48. set -g status-right "#[fg=yellow,bright][ #[fg=cyan]#W #[fg=yellow]]#[default] #[fg=yellow,bright]- %Y.%m.%d #[fg=green]%H:%M #[default]"
  49. set -g status-right-attr bright

  50. set -g status-bg black
  51. set -g status-fg white
  52. set -g set-clipboard on

  53. setw -g window-status-current-attr bright
  54. #setw -g window-status-current-bg red
  55. setw -g window-status-current-bg green
  56. setw -g window-status-current-fg white

  57. set -g status-utf8 on
  58. set -g status-interval 1

  59. #set -g visual-activity on
  60. #setw -g monitor-activity on

  61. set -g status-keys vi
  62. #----------------------------------------------

  63. setw -g mode-keys vi
  64. setw -g mode-mouse on

  65. #setw -g mouse-resize-pane on
  66. #setw -g mouse-select-pane on
  67. #setw -g mouse-select-window on

  68. # move x clipboard into tmux paste buffer
  69. bind C-p run "tmux set-buffer \"$(xclip -o -sel clipbaord)\"; tmux paste-buffer"
  70. # move tmux copy buffer into x clipboard
  71. bind C-y run "tmux show-buffer | xclip -i -sel clipbaord"

  72. #默认启动应用

  73. #new -s work # 新建名为 work 的会话,并启动 mutt
  74. #neww rtorrent # 启动 rtorrent
  75. #neww vim # 启动 vim
  76. #neww zsh
  77. #selectw -t 3 # 默认选择标号为 3 的窗口

更多功能请 man tmux 或进入 tmux 后 C-b ?




上一篇:一步一步坚持--->通向Linux成熟者
下一篇:命令行音乐播放器moc (解决mp3乱码)