242 lines
11 KiB
Bash
242 lines
11 KiB
Bash
## Base Config
|
|
|
|
set-option -sa terminal-overrides ",xterm*:Tc"
|
|
# set -g default-terminal "screen-256color"
|
|
set -g mouse on
|
|
set -g history-limit 100000
|
|
set -g base-index 1 # start windows in 1
|
|
set-window-option -g pane-base-index 1
|
|
set-window-option -g mode-keys vi
|
|
unbind -T copy-mode-vi Space; #Default for begin-selection
|
|
unbind -T copy-mode-vi Enter; #Default for copy-selection
|
|
bind -T copy-mode-vi v send-keys -X begin-selection
|
|
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "wl-copy"
|
|
# set -g -a terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q'
|
|
set -sg escape-time 0
|
|
set-option -g focus-events on
|
|
set-option -g renumber-windows on
|
|
|
|
# Yazi need this config to show image preview
|
|
set -g allow-passthrough on
|
|
set -ga update-environment TERM
|
|
set -ga update-environment TERM_PROGRAM
|
|
|
|
## Keybindings
|
|
unbind C-b
|
|
unbind C-Space
|
|
set -g prefix C-Space
|
|
|
|
# Reload Config
|
|
unbind R
|
|
bind R source-file ~/.config/tmux/tmux.conf \; display "Reloaded ~/.config/tmux/tmux.conf"
|
|
|
|
# Copy Mode
|
|
unbind [
|
|
bind V copy-mode
|
|
|
|
# Panes
|
|
unbind v
|
|
unbind s
|
|
unbind D
|
|
unbind % # Split vertically
|
|
unbind '"' # Split horizontally
|
|
|
|
bind s split-window -h -c "#{pane_current_path}"
|
|
bind v split-window -v -c "#{pane_current_path}"
|
|
bind D respawn-pane -k
|
|
|
|
bind -r m resize-pane -Z # maximize pane
|
|
|
|
bind-key M choose-window -Nwf"##{==:##{session_name},#{session_name}}" "join-pane -h -t '%%'" # Send pane to window
|
|
bind-key N break-pane # send current pane to new window
|
|
bind-key S command-prompt -p "Swap window with:" "swap-window -d -t '%%'" # send current pane to new window
|
|
|
|
# Windows
|
|
unbind r
|
|
unbind n
|
|
unbind h
|
|
unbind l
|
|
|
|
bind r command-prompt "rename-window '%%'"
|
|
bind n new-window -c "#{pane_current_path}"
|
|
bind h previous-window
|
|
bind l next-window
|
|
|
|
# ╭──────────────────────────────────────────────────────────╮
|
|
# │ Plugins │
|
|
# ╰──────────────────────────────────────────────────────────╯
|
|
|
|
## Auto install plugins
|
|
if "test ! -d ~/.config/tmux/plugins/tpm" \
|
|
"run 'git clone https://github.com/tmux-plugins/tpm ~/.config/tmux/plugins/tpm && ~/.config/tmux/plugins/tpm/bin/install_plugins'"
|
|
|
|
run -b '~/.config/tmux/plugins/tpm/tpm'
|
|
set -g @plugin 'tmux-plugins/tpm'
|
|
|
|
# ╭──────────────────────────────────────────────────────────╮
|
|
# │ Utils │
|
|
# ╰──────────────────────────────────────────────────────────╯
|
|
|
|
set -g @plugin 'tmux-plugins/tmux-copycat'`
|
|
set -g @plugin 'laktak/extrakto'
|
|
set -g @plugin 'christoomey/vim-tmux-navigator'
|
|
set -g @plugin 'soyuka/tmux-current-pane-hostname'
|
|
|
|
# ╭──────────────────────────────────────────────────────────╮
|
|
# │ Session Management │
|
|
# ╰──────────────────────────────────────────────────────────╯
|
|
|
|
set -g @plugin 'tmux-plugins/tmux-resurrect'
|
|
set -g @plugin 'tmux-plugins/tmux-continuum'
|
|
|
|
set -g @continuum-restore 'on'
|
|
set -g @resurrect-processes 'vi vim nvim man "~pnpm dev->pnpm dev *"'
|
|
|
|
# ╭──────────────────────────────────────────────────────────╮
|
|
# │ Theme │
|
|
# ╰──────────────────────────────────────────────────────────╯
|
|
|
|
set -g @plugin 'catppuccin/tmux'
|
|
|
|
set -g @catppuccin_flavor 'macchiato'
|
|
# set -g @catppuccin_status_default "on"
|
|
# set -g @catppuccin_status_background "default"
|
|
#
|
|
# set -g @catppuccin_window_right_separator "█ "
|
|
# set -g @catppuccin_window_number_position "right"
|
|
# set -g @catppuccin_window_middle_separator " | "
|
|
# set -g @catppuccin_window_flags "no"
|
|
#
|
|
# set -g @catppuccin_window_default_fill "none"
|
|
# set -g @catppuccin_window_current_fill "all"
|
|
#
|
|
# set -g @catppuccin_window_default_text "#{?window_zoomed_flag, ,}#W"
|
|
# set -g @catppuccin_window_current_text "#{?window_zoomed_flag, ,}#W"
|
|
# set -g @catppuccin_window_current_text_color "#{thm_blue}" # text color
|
|
#
|
|
# set -g @catppuccin_status_modules_right "directory session"
|
|
# set -g @catppuccin_status_left_separator ""
|
|
# set -g @catppuccin_status_right_separator ""
|
|
# set -g @catppuccin_status_fill "all"
|
|
# set -g @catppuccin_status_connect_separator "yes"
|
|
#
|
|
# set -g @catppuccin_session_color "#{thm_red}"
|
|
# set -g @catppuccin_directory_color "#{thm_magenta}"
|
|
# set -g @catppuccin_directory_text "#{pane_current_path}"
|
|
|
|
# new
|
|
|
|
set -g @catppuccin_status_background "none"
|
|
set -g @catppuccin_window_status_style "none"
|
|
set -g @catppuccin_pane_status_enabled "off"
|
|
set -g @catppuccin_pane_border_status "off"
|
|
|
|
# status left look and feel
|
|
set -g status-left-length 100
|
|
set -g status-left ""
|
|
set -ga status-left "#{?client_prefix,#{#[bg=#{@thm_teal},fg=#{@thm_bg},bold] #S },#{#[bg=#{@thm_bg},fg=#{@thm_teal}] #S }}" # session
|
|
set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_overlay_0},none]│"
|
|
set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_blue}] #{=/-32/...:#{s|$USER|~|:#{b:pane_current_path}}} " # path
|
|
set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_overlay_0},none]│"
|
|
set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_maroon}] #{pane_current_command} "
|
|
set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_overlay_0},none]#{?window_zoomed_flag,│,}"
|
|
set -ga status-left "#[bg=#{@thm_bg},fg=#{@thm_flamingo}]#{?window_zoomed_flag, zoom ,}"
|
|
|
|
# status right look and feel
|
|
set -g status-right-length 100
|
|
set -g status-right ""
|
|
set -ga status-right "#{?#{pane_ssh_connected},#{#[bg=#{@thm_mauve},fg=#{@thm_bg},bold] #U@#H },#{#[bg=#{@thm_bg},fg=#{@thm_text}] #U@#H }}" # SSH connection
|
|
|
|
# Configure Tmux
|
|
set -g status-position top
|
|
set -g status-style "bg=#{@thm_bg}"
|
|
set -g status-justify "absolute-centre"
|
|
|
|
# pane border look and feel
|
|
setw -g pane-border-status top
|
|
setw -g pane-border-format ""
|
|
setw -g pane-active-border-style "bg=#{@thm_bg},fg=#{@thm_overlay_0}"
|
|
setw -g pane-border-style "bg=#{@thm_bg},fg=#{@thm_surface_0}"
|
|
setw -g pane-border-lines single
|
|
|
|
# window look and feel
|
|
set -wg automatic-rename on
|
|
set -g automatic-rename-format "Window"
|
|
|
|
set -g window-status-format " #I#{?#{!=:#{window_name},Window},: #W,} "
|
|
set -g window-status-style "bg=#{@thm_bg},fg=#{@thm_mauve}"
|
|
set -g window-status-last-style "bg=#{@thm_bg},fg=#{@thm_mauve}"
|
|
set -g window-status-activity-style "bg=#{@thm_red},fg=#{@thm_bg}"
|
|
set -g window-status-bell-style "bg=#{@thm_red},fg=#{@thm_bg},bold"
|
|
set -gF window-status-separator "#[bg=#{@thm_bg},fg=#{@thm_overlay_0}]│"
|
|
|
|
set -g window-status-current-format " #I#{?#{!=:#{window_name},Window},: #W,} "
|
|
set -g window-status-current-style "bg=#{@thm_mauve},fg=#{@thm_bg},bold"
|
|
|
|
# ╭──────────────────────────────────────────────────────────╮
|
|
# │ Scratch FLating Pane │
|
|
# ╰──────────────────────────────────────────────────────────╯
|
|
|
|
set -g @plugin 'omerxx/tmux-floax'
|
|
|
|
# Setting the main key to toggle the floating pane on and off
|
|
set -g @floax-bind 'C-Space'
|
|
|
|
# When the pane is toggled, using this bind pops a menu with additional options
|
|
# such as resize, fullscreen, resetting to defaults and more.
|
|
set -g @floax-bind-menu 'p'
|
|
|
|
# The default width and height of the floating pane
|
|
set -g @floax-width '80%'
|
|
set -g @floax-height '80%'
|
|
|
|
# The border color can be changed, these are the colors supported by Tmux:
|
|
# black, red, green, yellow, blue, magenta, cyan, white
|
|
set -g @floax-border-color 'cyan'
|
|
|
|
# The text color can also be changed, by default it's blue
|
|
# to distinguish from the main window
|
|
# Optional colors are as shown above in @floax-border-color
|
|
set -g @floax-text-color 'blue'
|
|
|
|
# By default when floax sees a change in session path
|
|
# it'll change the floating pane's path
|
|
# You can disable this by setting it to false
|
|
# You could also "cd -" when the pane is toggled to go back
|
|
set -g @floax-change-path 'true'
|
|
|
|
# The default session name of the floating pane is 'scratch'
|
|
# You can modify the session name with this option:
|
|
set -g @floax-session-name 'scratch'
|
|
|
|
# ╭──────────────────────────────────────────────────────────╮
|
|
# │ Tmux toggle Popup │
|
|
# │ https://github.com/loichyan/tmux-toggle-popup │
|
|
# ╰──────────────────────────────────────────────────────────╯
|
|
|
|
set -g @plugin "loichyan/tmux-toggle-popup"
|
|
|
|
# customize how popups are shared across sessions, windows, and panes
|
|
set -g @popup-id-format '#{b:socket_path}/#{session_name}/#{b:pane_current_path}/#{@popup_name}'
|
|
|
|
# Use this to open specific programs in floating panes
|
|
bind C-p run "#{@popup-toggle}"
|
|
bind C-g run "#{@popup-toggle} -Ed'#{pane_current_path}' -w90% -h90% --name=lazygit lazygit"
|
|
bind C-o run "#{@popup-toggle} -Ed'#{pane_current_path}' -w90% -h90% --name=tool $HOME/Repos/Private/dots/scripts/fzf-tmux-tools-popup"
|
|
bind C-w run "#{@popup-toggle} -Ed'#{pane_current_path}' -w90% -h90% --name=wiki fzf-wikis"
|
|
bind C-z run "#{@popup-toggle} -Ed'#{pane_current_path}' -w90% -h90% --name=wiki fzf-wikis void"
|
|
|
|
# ╭──────────────────────────────────────────────────────────╮
|
|
# │ FZF │
|
|
# ╰──────────────────────────────────────────────────────────╯
|
|
|
|
set -g @plugin 'sainnhe/tmux-fzf'
|
|
|
|
TMUX_FZF_LAUNCH_KEY="w"
|
|
TMUX_FZF_OPTIONS="-p -w 80% -h 60% -m"
|
|
|
|
# Tmux Management
|
|
bind-key "f" run-shell "~/Repos/Private/dots/scripts/fzf-tmux-sessions"
|
|
|
|
bind-key "F" run-shell -b "$HOME/.config/tmux/plugins/tmux-fzf/scripts/session.sh switch"
|
|
# bind-key "F" run-shell -b "$HOME/.config/tmux/plugins/tmux-fzf/scripts/window.sh switch"
|