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.

77 lines
2.7 KiB

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