tmux.conf 2.6 KB

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