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.

76 lines
2.6 KiB

  1. set -g default-terminal "screen-256color"
  2. # easy reload config
  3. bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded."
  4. set-option -g status-position top
  5. # set window split
  6. bind-key v split-window -h
  7. bind-key b split-window
  8. # C-b is not acceptable -- Vim uses it
  9. set-option -g prefix C-a
  10. bind-key C-a last-window
  11. # Start numbering at 1
  12. set -g base-index 1
  13. # Allows for faster key repetition
  14. set -s escape-time 50
  15. # Rather than constraining window size to the maximum size of any client
  16. # connected to the *session*, constrain window size to the maximum size of any
  17. # client connected to *that window*. Much more reasonable.
  18. setw -g aggressive-resize on
  19. is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?\.?(view|n?vim?x?)(-wrapped)?(diff)?$'"
  20. bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' { if -F '#{pane_at_left}' '' 'select-pane -L' }
  21. bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' { if -F '#{pane_at_bottom}' '' 'select-pane -D' }
  22. bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' { if -F '#{pane_at_top}' '' 'select-pane -U' }
  23. bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' { if -F '#{pane_at_right}' '' 'select-pane -R' }
  24. bind-key -T copy-mode-vi 'C-h' if -F '#{pane_at_left}' '' 'select-pane -L'
  25. bind-key -T copy-mode-vi 'C-j' if -F '#{pane_at_bottom}' '' 'select-pane -D'
  26. bind-key -T copy-mode-vi 'C-k' if -F '#{pane_at_top}' '' 'select-pane -U'
  27. bind-key -T copy-mode-vi 'C-l' if -F '#{pane_at_right}' '' 'select-pane -R'
  28. bind-key C command-prompt -p "Name of new window: " "new-window -n '%%'"
  29. bind -r j resize-pane -D 5
  30. bind -r k resize-pane -U 5
  31. bind -r l resize-pane -R 5
  32. bind -r h resize-pane -L 5
  33. set-window-option -g mode-keys vi
  34. bind-key -T copy-mode-vi 'v' send -X begin-selection
  35. bind-key -T copy-mode-vi 'y' send -X copy-selection
  36. bind 'V' copy-mode
  37. # Enable mouse control (clickable windows, panes, resizable panes)
  38. set -g mouse on
  39. unbind -T copy-mode-vi MouseDragEnd1Pane
  40. bind S command-prompt -p "New Session:" "new-session -A -s '%%'"
  41. bind K confirm kill-session
  42. bind-key -r f run-shell "tmux neww ~/.local/bin/tmux-sessionizer"
  43. # List of plugins
  44. set -g @plugin 'tmux-plugins/tpm'
  45. set -g @plugin 'tmux-plugins/tmux-sensible'
  46. set -g @plugin 'catppuccin/tmux'
  47. set -g @catppuccin_flavour 'mocha' # or frappe, macchiato, mocha
  48. set -g @catppuccin_status_left_separator ""
  49. set -g @catppuccin_window_middle_separator " "
  50. set -g @catppuccin_status_modules_right "application session directory date_time"
  51. # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
  52. run '~/.tmux/plugins/tpm/tpm'