Another copy of my dotfiles. Because I don't completely trust GitHub.
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.

148 lines
5.2 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. # Bind escape to copy mode
  2. unbind [
  3. bind v copy-mode
  4. # p = paste
  5. unbind p
  6. bind p paste-buffer
  7. # no escape delay
  8. set -sg escape-time 0
  9. # remap prefix to Control + a
  10. set -g prefix C-a
  11. unbind C-b
  12. bind C-a send-prefix
  13. # Start window numbering at 1 (default => 0)
  14. set -g base-index 1
  15. set -g clock-mode-style 12
  16. # Renumber windows after removing one
  17. set -g renumber-windows on
  18. # Set the thumbs key to f, I don't use find-window anyways
  19. unbind f
  20. set -g @thumbs-key f
  21. # use 256 colors
  22. set -g default-terminal screen-256color
  23. set -ag terminal-overrides ",xterm-256color:Tc"
  24. # Keep plenty of history for scrollback
  25. set -g history-limit 50000
  26. # mouse
  27. set -g mouse on
  28. # Act like vim in copy mode
  29. set -g status-keys vi
  30. setw -g mode-keys vi
  31. bind-key -Tcopy-mode-vi 'v' send -X begin-selection
  32. bind-key -Tcopy-mode-vi 'y' send -X copy-selection
  33. bind y run-shell "tmux show-buffer | xclip -sel clip -i" \; display-message "Copied tmux buffer to system clipboard"
  34. # Smart pane switching with awareness of Vim splits.
  35. # See: https://github.com/christoomey/vim-tmux-navigator
  36. is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
  37. | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
  38. bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
  39. bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
  40. bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
  41. bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
  42. bind-key -n C-\\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
  43. # Secondary binding for C-l to retain redraw
  44. bind C-l send-keys 'C-l'
  45. # Easy rotating of panes
  46. bind C-k swap-pane -U
  47. # increase display time
  48. set -g display-panes-time 1200
  49. # status bar stuff
  50. set -g status-left-length 40
  51. # Dismiss current pane to background window
  52. bind b break-pane -d
  53. bind-key j command-prompt -p "join pane from: " "join-pane -h -s '%%'"
  54. # more intuitive keybindings for splitting
  55. bind \\ split-window -h -c "#{pane_current_path}"
  56. bind - split-window -v -c "#{pane_current_path}"
  57. # Easy return to Vim from tmux runner zoom runner pane
  58. bind C-p run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys ':VtrZoomRunnerPane' 'C-m') || tmux send-keys 'C-c' && tmux select-pane -l"
  59. # Make C-j display a selectable list of sessions
  60. bind C-j choose-tree
  61. # Keep window names as I set them
  62. setw -g automatic-rename off
  63. # Reload tmux.conf with prefix-r
  64. bind C-r source-file ~/.tmux.conf \; display "Reloaded ~/.tmux.conf"
  65. # Provide access to the clipboard for pbpaste, pbcopy (details: http://goo.gl/DN82E)
  66. set-window-option -g automatic-rename on
  67. # Enable VI mode
  68. set-window-option -g mode-keys vi
  69. # Set ability to capture on start and restore on exit window data when running an application
  70. setw -g alternate-screen on
  71. # bind resizing of panes to H,J,K,L (resizes by steps of 10 lines/columns)
  72. # # Note, bindings are repeatable (within the default 500ms time limit) so that
  73. # # you don't have to keep entering the prefix. (Prefix-H-H-H resizes by 15)
  74. bind -n S-Left resize-pane -L 2
  75. bind -n S-Right resize-pane -R 2
  76. bind -n S-Down resize-pane -D 1
  77. bind -n S-Up resize-pane -U 1
  78. unbind -n C-Left
  79. unbind -n C-Down
  80. unbind -n C-Up
  81. unbind -n C-Right
  82. bind -n C-Left resize-pane -L 10
  83. bind -n C-Right resize-pane -R 10
  84. bind -n C-Down resize-pane -D 5
  85. bind -n C-Up resize-pane -U 5
  86. unbind %
  87. unbind '"'
  88. # Split panes
  89. bind | split-window -h -c "#{pane_current_path}"
  90. bind _ split-window -v -c "#{pane_current_path}"
  91. bind-key "\\" split-window -fh -c "#{pane_current_path}"
  92. bind-key "_" split-window -fv -c "#{pane_current_path}"
  93. # Plugins
  94. set -g @plugin 'tmux-plugins/tpm'
  95. set -g @plugin 'tmux-plugins/tmux-sensible'
  96. set -g @plugin 'tmux-plugins/tmux-resurrect'
  97. set -g @plugin 'fcsonline/tmux-thumbs'
  98. set -g @plugin 'wfxr/tmux-fzf-url'
  99. set -g @plugin 'tmux-plugins/tmux-yank'
  100. set -g @plugin 'Alkindi42/tmux-bitwarden'
  101. run '~/.tmux/plugins/tpm/tpm'
  102. set -as terminal-overrides ',*:indn@' # This fixes the clear bug on tmate
  103. # status bar theme
  104. set -g status-bg 'colour235'
  105. set -g status-justify 'centre'
  106. set -g status-left-length '100'
  107. set -g status 'on'
  108. set -g status-right-length '100'
  109. set -g status-left '#[fg=colour232,bg=colour154] #S #[fg=colour154,bg=colour238,nobold,nounderscore,noitalics]#[fg=colour222,bg=colour238] #W #[fg=colour238,bg=colour235,nobold,nounderscore,noitalics]#[fg=colour121,bg=colour235] #(whoami)  #(uptime | cut -d " " -f 1,2,3) #[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]'
  110. set -g status-right '#[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]#[fg=colour121,bg=colour235] %r  %a  %Y #[fg=colour238,bg=colour235,nobold,nounderscore,noitalics]#[fg=colour222,bg=colour238] #H #[fg=colour154,bg=colour238,nobold,nounderscore,noitalics]#[fg=colour232,bg=colour154] #(rainbarf --battery --remaining --no-rgb) '
  111. setw -g window-status-format '#[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]#[default] #I  #W #[fg=colour235,bg=colour235,nobold,nounderscore,noitalics]'
  112. setw -g window-status-current-format '#[fg=colour235,bg=colour238,nobold,nounderscore,noitalics]#[fg=colour222,bg=colour238] #I  #W  #F #[fg=colour238,bg=colour235,nobold,nounderscore,noitalics]'
  113. # Capture contents on tmux-ressurect save
  114. set -g @resurrect-capture-pane-contents 'on'