tmux.conf 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. # Act like vim. Enhance copy mode to use more vim like keys for copying.
  27. bind-key -t vi-copy 'v' begin-selection
  28. bind-key -t vi-copy 'y' copy-selection
  29. # Use prefix+r to reload the config file.
  30. bind-key C-r source-file ~/.tmux.conf \; display-message "tmux.conf reloaded"
  31. # Detach client like screen, <C-a> <C-d>.
  32. bind-key C-d detach-client
  33. ###################################
  34. # Window/Pane/Session Manipulation
  35. ###################################
  36. # Window Movement.
  37. bind-key -r C-h previous-window
  38. bind-key -r C-l next-window
  39. bind-key C-a last-window
  40. bind-key -n M-1 select-window -t 1
  41. bind-key -n M-2 select-window -t 2
  42. bind-key -n M-3 select-window -t 3
  43. bind-key -n M-4 select-window -t 4
  44. bind-key -n M-5 select-window -t 5
  45. bind-key -n M-6 select-window -t 6
  46. bind-key -n M-7 select-window -t 7
  47. bind-key -n M-8 select-window -t 8
  48. bind-key -n M-9 select-window -t 9
  49. bind-key -n M-0 select-window -t 10
  50. # Window Creation/Destruction.
  51. bind-key C-c new-window
  52. # Remember prefix+, for renaming windows.
  53. # Pane Movement.
  54. bind-key h select-pane -L
  55. bind-key j select-pane -D
  56. bind-key k select-pane -U
  57. bind-key l select-pane -R
  58. # Pane Creation/Destruction.
  59. unbind-key % # Remove default binding for horizontal split since we’re replacing it.
  60. bind-key \ split-window -h
  61. bind-key - split-window -v
  62. bind-key C-x kill-pane
  63. # Pane Sychronisation.
  64. bind-key s set -w synchronize-panes
  65. # Session Switching/Destruction.
  66. bind-key C-s choose-session
  67. bind-key X kill-session
  68. # Remember prefix+$ for renaming sessions.
  69. # Version-specific configuration.
  70. if-shell '[[ $(version-compare $(tmux -V | sed "s/[tmux ]//g") 2.1) -lt 0 ]]' 'source-file ~/dotfiles/tmux/tmux1.conf'
  71. if-shell '[[ $(version-compare $(tmux -V | sed "s/[tmux ]//g") 2.1) -ge 0 ]]' 'source-file ~/dotfiles/tmux/tmux2.conf'
  72. # Colours and status line.
  73. source-file ~/dotfiles/tmux/tmuxcolours.conf