tmux.conf 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. # vim: ft=tmux
  2. # Use `Ctrl-A` as the tmux command prefix instead of `Ctrl-B`.
  3. unbind-key C-b
  4. set-option -g prefix C-a
  5. # Report the same $TERM value as we use for our terminal emulator (yes, go and
  6. # set this) This influences, among other things, certain vim settings related to
  7. # colours, rendering speed and mouse support.
  8. set-option -g default-terminal "xterm-256color"
  9. # Start windows and panes from `1`, not `0`.
  10. set-option -g base-index 1
  11. set-option -g pane-base-index 1
  12. # History scrollback.
  13. set-option -g history-limit 9999999
  14. # Display a status line message when activity occurs in a window for which the
  15. # monitor-activity window option is enabled.
  16. set-option -g visual-activity on
  17. # Resize the window to the size of the smallest session for which it is the
  18. # current window, rather than the smallest session to which it is attached.
  19. set-window-option -g aggressive-resize on
  20. # Act like vim.
  21. set-option -g status-keys vi
  22. set-window-option -g mode-keys vi # vi keys in copy mode (prefix+[)
  23. #######################
  24. # General Key Bindings
  25. #######################
  26. # Use prefix+r to reload the config file.
  27. bind-key C-r source-file ~/.tmux.conf \; display-message "tmux.conf reloaded"
  28. # Detach client like screen, <C-a> <C-d>.
  29. bind-key C-d detach-client
  30. ###################################
  31. # Window/Pane/Session Manipulation
  32. ###################################
  33. # Window Movement.
  34. bind-key -r C-h previous-window
  35. bind-key -r C-l next-window
  36. bind-key C-a last-window
  37. bind-key -n M-1 select-window -t 1
  38. bind-key -n M-2 select-window -t 2
  39. bind-key -n M-3 select-window -t 3
  40. bind-key -n M-4 select-window -t 4
  41. bind-key -n M-5 select-window -t 5
  42. bind-key -n M-6 select-window -t 6
  43. bind-key -n M-7 select-window -t 7
  44. bind-key -n M-8 select-window -t 8
  45. bind-key -n M-9 select-window -t 9
  46. bind-key -n M-0 select-window -t 10
  47. # Window Creation/Destruction.
  48. bind-key C-c new-window
  49. # Remember prefix+, for renaming windows.
  50. # Pane Movement.
  51. bind-key h select-pane -L
  52. bind-key j select-pane -D
  53. bind-key k select-pane -U
  54. bind-key l select-pane -R
  55. # Pane Creation/Destruction.
  56. unbind-key % # Remove default binding for horizontal split since we’re replacing it.
  57. bind-key \ split-window -h
  58. bind-key - split-window -v
  59. bind-key C-x kill-pane
  60. # Pane Sychronisation.
  61. bind-key s set -w synchronize-panes
  62. # Session Switching/Destruction.
  63. bind-key C-s choose-session
  64. bind-key X kill-session
  65. # Remember prefix+$ for renaming sessions.
  66. # Version-specific configuration.
  67. if-shell '[[ $(version-compare $(tmux -V | sed "s/[tmux ]//g") 2.1) -lt 0 ]]' 'source-file ~/dotfiles/tmux/tmux1.conf'
  68. if-shell '[[ $(version-compare $(tmux -V | sed "s/[tmux ]//g") 2.1) -ge 0 ]]' 'source-file ~/dotfiles/tmux/tmux2.conf'
  69. # Colours and status line.
  70. source-file ~/dotfiles/tmux/tmuxcolours.conf