tmux.conf 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. # Use `Ctrl-A` as the tmux command prefix instead of `Ctrl-B`.
  2. unbind C-b
  3. set-option -g prefix C-a
  4. # Report the same $TERM value as we use for our terminal emulator (yes, go and
  5. # set this) This influences, among other things, certain vim settings related to
  6. # colours, rendering speed and mouse support.
  7. set -g default-terminal "xterm-256color"
  8. # Start windows and panes from `1`, not `0`.
  9. set-option -g base-index 1
  10. set-option -g pane-base-index 1
  11. # History scrollback.
  12. set-option -g history-limit 9999999
  13. # Display a status line message when activity occurs in a window for which the
  14. # monitor-activity window option is enabled.
  15. set-option -g visual-activity on
  16. # Resize the window to the size of the smallest session for which it is the
  17. # current window, rather than the smallest session to which it is attached.
  18. set-window-option -g aggressive-resize on
  19. # Mouse Support! (for scrollback, and lazy manipulation of windows/panes)
  20. # At least with iTerm2, this plays very well with vim mouse support :D Yay!
  21. # Note: text-selection by default does a tmux copy (paste with prefix+]).
  22. # Hold alt/meta/option for system selection/copy.
  23. set-option -g mode-mouse on
  24. set-option -g mouse-select-pane
  25. set-option -g mouse-resize-pane on
  26. set-option -g mouse-select-window on
  27. # Act like vim.
  28. set-option -g status-keys vi
  29. set-window-option -g mode-keys vi # vi keys in copy mode (prefix+[)
  30. #######################
  31. # General Key Bindings
  32. #######################
  33. # Act like vim. Enhance copy mode to use more vim like keys for copying.
  34. bind-key -t vi-copy 'v' begin-selection
  35. bind-key -t vi-copy 'y' copy-selection
  36. # Use prefix+r to reload the config file.
  37. bind-key C-r source-file ~/.tmux.conf \; display-message "tmux.conf reloaded"
  38. # Detach client like screen, <C-a> <C-d>.
  39. bind-key C-d detach-client
  40. ###################################
  41. # Window/Pane/Session Manipulation
  42. ###################################
  43. # Window Movement.
  44. bind-key -r C-h previous-window
  45. bind-key -r C-l next-window
  46. bind-key C-a last-window
  47. bind-key -n M-1 select-window -t 1
  48. bind-key -n M-2 select-window -t 2
  49. bind-key -n M-3 select-window -t 3
  50. bind-key -n M-4 select-window -t 4
  51. bind-key -n M-5 select-window -t 5
  52. bind-key -n M-6 select-window -t 6
  53. bind-key -n M-7 select-window -t 7
  54. bind-key -n M-8 select-window -t 8
  55. bind-key -n M-9 select-window -t 9
  56. bind-key -n M-0 select-window -t 10
  57. # Window Creation/Destruction.
  58. bind-key C-c new-window
  59. # Remember prefix+, for renaming windows.
  60. # Pane Movement.
  61. bind-key h select-pane -L
  62. bind-key j select-pane -D
  63. bind-key k select-pane -U
  64. bind-key l select-pane -R
  65. # Pane Creation/Destruction.
  66. unbind % # Remove default binding for horizontal split since we’re replacing it.
  67. bind-key -n C-\ split-window -h
  68. bind-key -n C-_ split-window -v
  69. bind-key C-x kill-pane
  70. # Pane Sychronisation.
  71. bind-key s set -w synchronize-panes
  72. # Session Switching/Destruction.
  73. bind-key C-s choose-session
  74. bind-key X kill-session
  75. # Remember prefix+$ for renaming sessions.
  76. ########################
  77. # Visual
  78. ########################
  79. # Use solarized colour palette.
  80. source ~/dotfiles/tmux/tmux-colors-solarized/tmuxcolors-256.conf
  81. ########################
  82. # Powerline
  83. ########################
  84. # While the default way of using powerline is something like:
  85. #
  86. # source ~/dotfiles/powerline/powerline/powerline/bindings/tmux/powerline.conf
  87. #
  88. # we would rather roll our own not-so-blue-and-annoying color scheme, so we have
  89. # to replicate the contents of that file, with adjustments.
  90. #
  91. # TODO is it possible to rework this into a powerline config in `~/.config/powerline`?
  92. if-shell 'test -z "$POWERLINE_COMMAND"' 'set-environment -g POWERLINE_COMMAND powerline-render'
  93. set -g status on
  94. set -g status-utf8 on
  95. set -g status-interval 2
  96. # Central window list.
  97. set -g status-justify "centre"
  98. set -g status-fg colour231
  99. set -g status-bg colour234
  100. # `#I` = index, `#F` = last window indicator, `#W` = window name
  101. set -g window-status-format " #[fg=colour244]#I#[fg=red]#F#[fg=colour249]#W "
  102. set -g window-status-current-format "#[fg=red,bg=red] #[fg=colour231]#I #[bold]#W#[fg=red,nobold] "
  103. # Left status.
  104. set -g status-left-length 90
  105. set -g status-left '#[fg=colour189,bg=colour55] #S #[fg=colour55,bg=colour233]#(eval $POWERLINE_COMMAND tmux left)'
  106. # Right status.
  107. set -g status-right-length 90
  108. set -g status-right '#(eval $POWERLINE_COMMAND tmux right) #(~/dotfiles/tmux/rainbarf/rainbarf --remaining --rgb --width 10)'
  109. # Some instructions above are deprecated in 1.9+ so rewrite them where necessary.
  110. if-shell '[[ `tmux -V` == *1.9* ]]' 'source ~/dotfiles/tmux/tmux19.conf'
  111. # vim: ft=tmux