You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

129 lines
2.8 KiB

  1. # load TMUX_VERSION
  2. run-shell "\
  3. echo #{version} | sed -e 's|\\.| |g' -e 's|[a-z]*$||' |\
  4. while read x y; do\
  5. tmux set-environment -g TMUX_VERSION \$((x * 100 + y));\
  6. done"
  7. # https://github.com/tmux/tmux/blob/master/CHANGES
  8. #
  9. # 2.9
  10. # * individual -fg/-bg removed, use -style instead
  11. # 2.4
  12. # * vi-copy syntax changes
  13. # 2.2
  14. # * UTF8 autodetected, `set status-utf8` not accepted.
  15. #
  16. # same prefix as `screen`
  17. set -g prefix C-a
  18. unbind C-b
  19. # 0-indexed is not keyboard friendly
  20. set -g base-index 1
  21. set -g pane-base-index 1
  22. # misc features
  23. set -s escape-time 1
  24. setw -g mode-keys vi
  25. # reload
  26. bind r source-file ~/.tmux.conf \; display "Reloaded!"
  27. # send C-a
  28. bind C-a send-prefix
  29. # status bar
  30. #
  31. if-shell -b 'test $TMUX_VERSION -lt 202' 'set -g status-utf8 on'
  32. set -g monitor-activity on
  33. set -g visual-activity on
  34. # Toggle mouse on with ^A m
  35. bind m \
  36. set -g mode-mouse on \;\
  37. set -g mouse-resize-pane on \;\
  38. set -g mouse-select-pane on \;\
  39. set -g mouse-select-window on \;\
  40. display 'Mouse: ON'
  41. # Toggle mouse off with ^A M
  42. bind M \
  43. set -g mode-mouse off \;\
  44. set -g mouse-resize-pane off \;\
  45. set -g mouse-select-pane off \;\
  46. set -g mouse-select-window off \;\
  47. display 'Mouse: OFF'
  48. # sessions
  49. #
  50. bind -r ( switch-client -p
  51. bind -r ) switch-client -n
  52. # windows
  53. #
  54. bind -r b select-window -t :-
  55. bind -r n select-window -t :+
  56. # panes
  57. #
  58. bind | split-window -h -c "#{pane_current_path}"
  59. bind - split-window -v -c "#{pane_current_path}"
  60. bind h select-pane -L
  61. bind j select-pane -D
  62. bind k select-pane -U
  63. bind l select-pane -R
  64. bind -r H resize-pane -L 5
  65. bind -r J resize-pane -D 5
  66. bind -r K resize-pane -U 5
  67. bind -r L resize-pane -R 5
  68. # buffers
  69. #
  70. bind = paste-buffer
  71. if-shell -b 'test $TEST_VERSION -lt 204' "\
  72. bind -t vi-copy 'v' begin-selection; \
  73. bind -t vi-copy 'y' copy-selection; \
  74. "
  75. if-shell -b 'test $TMUX_VERSION -ge 204' "\
  76. bind-key -T copy-mode-vi v send -X begin-seletion; \
  77. bind-key -T copy-mode-vi y send -X copy-seletion; \
  78. "
  79. # clear scroll
  80. #
  81. bind k send-keys -R \; clear-history
  82. # http://stahlke.org/dan/tmux-nested/
  83. set -g status-bg colour40
  84. if-shell -b 'test $TMUX_VERSION -lt 209' 'setw -g window-status-current-bg colour40'
  85. bind -n C-t new-window -a
  86. bind -n S-left prev
  87. bind -n S-right next
  88. bind -n S-C-left swap-window -t -1
  89. bind -n S-C-right swap-window -t +1
  90. bind -n M-F11 set -qg status-bg colour25
  91. bind -n M-F12 set -qg status-bg colour40
  92. bind -n S-up \
  93. send-keys M-F12 \; \
  94. set -qg status-bg colour25 \; \
  95. unbind -n S-left \; \
  96. unbind -n S-right \; \
  97. unbind -n S-C-left \; \
  98. unbind -n S-C-right \; \
  99. unbind -n C-t \; \
  100. set -qg prefix C-b
  101. bind -n S-down \
  102. send-keys M-F11 \; \
  103. set -qg status-bg colour40 \; \
  104. bind -n S-left prev \; \
  105. bind -n S-right next \; \
  106. bind -n S-C-left swap-window -t -1 \; \
  107. bind -n S-C-right swap-window -t +1 \; \
  108. bind -n C-t new-window -a -c "#{pane_current_path}" \; \
  109. set -qg prefix C-a