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.

163 lines
5.0 KiB

4 years ago
4 years ago
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-option -g default-shell /sbin/zsh
  24. set -ag terminal-overrides ",xterm-256color:Tc"
  25. # Keep plenty of history for scrollback
  26. set -g history-limit 50000
  27. # mouse
  28. set -g mouse on
  29. # Act like vim in copy mode
  30. set -g status-keys vi
  31. setw -g mode-keys vi
  32. bind-key -Tcopy-mode-vi 'v' send -X begin-selection
  33. bind-key -Tcopy-mode-vi 'y' send -X copy-selection
  34. bind y run-shell "tmux show-buffer | xclip -sel clip -i" \; display-message "Copied tmux buffer to system clipboard"
  35. # Smart pane switching with awareness of Vim splits.
  36. # See: https://github.com/christoomey/vim-tmux-navigator
  37. is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
  38. | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
  39. bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
  40. bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
  41. bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
  42. bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
  43. bind-key -n C-\\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
  44. # Secondary binding for C-l to retain redraw
  45. bind C-l send-keys 'C-l'
  46. # Easy rotating of panes
  47. bind C-k swap-pane -U
  48. # increase display time
  49. set -g display-panes-time 1200
  50. # status bar stuff
  51. set -g status-left-length 40
  52. # Dismiss current pane to background window
  53. bind b break-pane -d
  54. bind-key j command-prompt -p "join pane from: " "join-pane -h -s '%%'"
  55. # more intuitive keybindings for splitting
  56. bind \\ split-window -h -c "#{pane_current_path}"
  57. bind - split-window -v -c "#{pane_current_path}"
  58. # Easy return to Vim from tmux runner zoom runner pane
  59. 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"
  60. # Make C-j display a selectable list of sessions
  61. bind C-j choose-tree
  62. # Keep window names as I set them
  63. setw -g automatic-rename off
  64. # Reload tmux.conf with prefix-r
  65. bind C-r source-file ~/.config/tmux/tmux.conf \; display "Reloaded ~/.config/tmux/tmux.conf"
  66. # Provide access to the clipboard for pbpaste, pbcopy (details: http://goo.gl/DN82E)
  67. set-window-option -g automatic-rename on
  68. # Enable VI mode
  69. set-window-option -g mode-keys vi
  70. # Set ability to capture on start and restore on exit window data when running an application
  71. setw -g alternate-screen on
  72. # bind resizing of panes to H,J,K,L (resizes by steps of 10 lines/columns)
  73. # # Note, bindings are repeatable (within the default 500ms time limit) so that
  74. # # you don't have to keep entering the prefix. (Prefix-H-H-H resizes by 15)
  75. bind -n S-Left resize-pane -L 2
  76. bind -n S-Right resize-pane -R 2
  77. bind -n S-Down resize-pane -D 1
  78. bind -n S-Up resize-pane -U 1
  79. unbind -n C-Left
  80. unbind -n C-Down
  81. unbind -n C-Up
  82. unbind -n C-Right
  83. bind -n C-Left resize-pane -L 10
  84. bind -n C-Right resize-pane -R 10
  85. bind -n C-Down resize-pane -D 5
  86. bind -n C-Up resize-pane -U 5
  87. unbind %
  88. unbind '"'
  89. # Split panes
  90. bind | split-window -h -c "#{pane_current_path}"
  91. bind _ split-window -v -c "#{pane_current_path}"
  92. bind-key "\\" split-window -fh -c "#{pane_current_path}"
  93. bind-key "_" split-window -fv -c "#{pane_current_path}"
  94. # Disable status bar for weechat sessions
  95. set-hook -g session-created 'if -F "#{==:#{session_name},weechat}" "set status off" "set status on"'
  96. set-hook -g session-created 'if -F "#{==:#{session_name},weechat}" "set status off" "set status on"'
  97. # Plugins
  98. set -g @plugin 'tmux-plugins/tpm'
  99. set -g @plugin 'tmux-plugins/tmux-sensible'
  100. set -g @plugin 'tmux-plugins/tmux-resurrect'
  101. set -g @plugin 'fcsonline/tmux-thumbs'
  102. set -g @plugin 'wfxr/tmux-fzf-url'
  103. set -g @plugin 'tmux-plugins/tmux-yank'
  104. set -g @plugin 'wfxr/tmux-power'
  105. set -g @plugin 'wfxr/tmux-web-reachable'
  106. set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
  107. set -g @plugin 'wfxr/tmux-net-speed'
  108. set -as terminal-overrides ',*:indn@' # This fixes the clear bug on tmate
  109. # status bar theme
  110. set -g status-bg 'colour235'
  111. set -g status-justify 'centre'
  112. set -g status-left-length '100'
  113. set -g status 'on'
  114. set -g status-right-length '100'
  115. # Capture contents on tmux-ressurect save
  116. set -g @resurrect-capture-pane-contents 'on'
  117. # tmux-power config
  118. set -g @tmux_power_theme 'sky'
  119. set -g @tmux_power_show_upload_speed true
  120. set -g @tmux_power_show_download_speed true
  121. set -g @tmux_power_prefix_highlight_pos 'L'
  122. set -g @tmux_power_show_web_reachable true
  123. if "test ! -d ~/.local/share/tmux/plugins/tpm" \
  124. "run 'git clone https://github.com/tmux-plugins/tpm ~/.local/share/tmux/plugins/tpm && ~/.local/share/tmux/plugins/tpm/bin/install_plugins'"
  125. run -b '~/.local/share/tmux/plugins/tpm/tpm'