summaryrefslogtreecommitdiff
path: root/ar/.config/tmux/tmux.conf
diff options
context:
space:
mode:
Diffstat (limited to 'ar/.config/tmux/tmux.conf')
-rw-r--r--ar/.config/tmux/tmux.conf303
1 files changed, 303 insertions, 0 deletions
diff --git a/ar/.config/tmux/tmux.conf b/ar/.config/tmux/tmux.conf
new file mode 100644
index 0000000..21bd6c1
--- /dev/null
+++ b/ar/.config/tmux/tmux.conf
@@ -0,0 +1,303 @@
+### --- TPM --- ###
+set-environment -gF TMUX_PLUGIN_MANAGER_PATH '#{HOME}/.local/bin/tmux/'
+
+if 'test ! -d "${TMUX_PLUGIN_MANAGER_PATH}/tpm"' {
+ run 'mkdir -p "${TMUX_PLUGIN_MANAGER_PATH}" &&
+ git clone https://github.com/tmux-plugins/tpm "${TMUX_PLUGIN_MANAGER_PATH}/tpm" &&
+ ${TMUX_PLUGIN_MANAGER_PATH}/tpm/bin/install_plugins'
+}
+
+
+### --- Settings --- ###
+# general
+set -g base-index 1
+set -g pane-base-index 1
+set -g default-shell /usr/bin/zsh
+set -g detach-on-destroy off
+set -g focus-events on
+set -g history-limit 1000000
+set -g mouse on
+set -g renumber-windows on
+set -g set-clipboard on
+set -g xterm-keys on
+set -gq allow-passthrough on
+set -sg escape-time 0
+setw -g mode-keys vi
+setw -g aggressive-resize on
+
+# activity
+set -g monitor-activity on
+set -g visual-activity off
+
+# color
+set -g default-terminal "tmux-256color"
+# set -g default-terminal 'screen-256color'
+set -ga terminal-overrides ',xterm-256color:Tc'
+set -sa terminal-features ',xterm-256color:RGB'
+
+# status
+set -g status-interval 1
+set -g status-justify absolute-centre
+set -g status-left ""
+set -g status-left-length 10
+set -g status-position top
+set -g status-right ""
+set -g status-style "bg=default"
+
+
+### --- Key Bindings --- ###
+# clear
+bind 'l' "send-keys C-l; send-keys -R; clear-history"
+
+# lazygit
+bind -n 'M-g' popup -d "#{pane_current_path}" -E -h 95% -w 95% -x 100% "EDITOR=nvim lazygit"
+
+# pane
+bind '%' split-window -h -c '#{pane_current_path}'
+bind '"' split-window -v -c '#{pane_current_path}'
+bind '|' split-window -h
+bind '-' split-window -v
+bind -r 'C-down' resize-pane -D 5
+bind -r 'C-up' resize-pane -U 5
+bind -r 'C-left' resize-pane -L 5
+bind -r 'C-right' resize-pane -R 5
+bind '@' choose-window 'join-pane -h -s "%%"'
+bind '#' choose-window 'join-pane -s "%%"'
+bind 'x' kill-pane
+bind -n 'M-k' move-pane -h -t '.{up-of}'
+bind -n 'M-l' move-pane -t '.{right-of}'
+bind -n 'M-h' move-pane -t '.{left-of}'
+bind -n 'M-j' move-pane -h -t '.{down-of}'
+
+# prefix
+unbind 'C-b'
+set -g prefix 'C-Space'
+bind 'C-Space' send-prefix
+
+# reload
+unbind 'r'
+bind 'r' source-file "~/.config/tmux/tmux.conf"
+
+# scripts
+bind 'h' run-shell -b "~/.local/bin/tmuxtogglebar"
+bind 'b' run-shell -b "~/.local/bin/tmuxtoggleborder"
+bind -T copy-mode M-\\ run-shell -b "~/.local/bin/tmuxtoggleterm"
+bind -T copy-mode-vi M-\\ run-shell -b "~/.local/bin/tmuxtoggleterm"
+bind -n 'C-t' run-shell "~/.local/bin/sessionizer"
+bind -n 'M-t' run-shell "~/.local/bin/sessionizer"
+bind -T copy-mode M-t run-shell "~/.local/bin/sessionizer"
+bind -T copy-mode-vi M-t run-shell "~/.local/bin/sessionizer"
+
+# sesh
+bind -N "last-session (via sesh)" -n "M-'" run-shell 'sesh last'
+bind -N "switch to root session (via sesh)" 9 run-shell 'sesh connect --root "$(pwd)"'
+
+# session
+bind -r '(' switch-client -p \; refresh-client -S
+bind -nr 'M-P' switch-client -p \; refresh-client -S
+bind -r ')' switch-client -n \; refresh-client -S
+bind -nr 'M-N' switch-client -n \; refresh-client -S
+bind "'" switch-client -t'{marked}'
+bind -r 'BSpace' switch-client -l
+
+# window
+bind -r '<' swap-window -d -t -1
+bind -r '>' swap-window -d -t +1
+bind -nr 'M-H' previous-window \; refresh-client -S
+bind -nr 'M-L' next-window \; refresh-client -S
+bind 'c' new-window -c "#{pane_current_path}"
+bind -nr 'M-BSpace' last-window
+
+
+### --- Plugins --- ###
+set -g @plugin 'tmux-plugins/tpm'
+set -g @plugin 'alexwforsythe/tmux-which-key'
+set -g @plugin 'aserowy/tmux.nvim'
+set -g @plugin 'catppuccin/tmux#v2.1.2'
+set -g @plugin 'olimorris/tmux-pomodoro-plus'
+set -g @plugin 'sainnhe/tmux-fzf'
+set -g @plugin 'tmux-plugins/tmux-battery'
+set -g @plugin 'tmux-plugins/tmux-continuum'
+set -g @plugin 'tmux-plugins/tmux-copycat'
+set -g @plugin 'tmux-plugins/tmux-cpu'
+set -g @plugin 'tmux-plugins/tmux-online-status'
+set -g @plugin 'tmux-plugins/tmux-open'
+set -g @plugin 'tmux-plugins/tmux-resurrect'
+set -g @plugin 'tmux-plugins/tmux-sensible'
+set -g @plugin 'tmux-plugins/tmux-yank'
+set -g @plugin 'xamut/tmux-weather'
+
+
+### --- Plugins Settings --- ###
+# continuum
+# set -g @continuum-boot 'on'
+# set -g @continuum-boot-options 'kitty'
+# set -g @continuum-restore 'on'
+# set -g @continuum-save-interval '1' # min, 0 for disable
+
+# copycat
+bind -T copy-mode-vi 'v' send-keys -X begin-selection
+bind -T copy-mode-vi 'C-v' send-keys -X rectangle-toggle
+bind -T copy-mode-vi 'y' send-keys -X copy-selection-and-cancel
+
+# navigation
+set -g @tmux-nvim-navigation true
+set -g @tmux-nvim-navigation-cycle false
+set -g @tmux-nvim-navigation-keybinding-left 'C-h'
+set -g @tmux-nvim-navigation-keybinding-down 'C-j'
+set -g @tmux-nvim-navigation-keybinding-up 'C-k'
+set -g @tmux-nvim-navigation-keybinding-right 'C-l'
+set -g @tmux-nvim-resize true
+set -g @tmux-nvim-resize-step-x 2
+set -g @tmux-nvim-resize-step-y 2
+set -g @tmux-nvim-resize-keybinding-left 'C-left'
+set -g @tmux-nvim-resize-keybinding-down 'C-down'
+set -g @tmux-nvim-resize-keybinding-up 'C-up'
+set -g @tmux-nvim-resize-keybinding-right 'C-right'
+
+# open
+set -g @open 'O'
+set -g @open-editor 'e'
+set -g @open-W 'https://www.searx.thesiah.xyz/?q='
+
+# pomodoro
+set -g @pomodoro_toggle 'a' # Start/pause a Pomodoro/break
+set -g @pomodoro_cancel 'A' # Cancel the current session
+set -g @pomodoro_menu 'C-a' # Pomodoro menu
+set -g @pomodoro_restart 'R' # Restart
+set -g @pomodoro_skip 'B' # Skip a Pomodoro/break
+set -g @pomodoro_custom '' # Custom menu
+set -g @pomodoro_mins 25 # The duration of the Pomodoro
+set -g @pomodoro_break_mins 5 # The duration of the break after the Pomodoro completes
+set -g @pomodoro_intervals 4 # The number of intervals before a longer break is started
+set -g @pomodoro_interval_display "[%s/%s]"
+set -g @pomodoro_long_break_mins 25 # The duration of the long break
+set -g @pomodoro_repeat 'off' # Automatically repeat the Pomodoros?
+set -g @pomodoro_disable_breaks 'off' # Turn off breaks
+set -g @pomodoro_on "#[fg=#{@thm_red}] "
+set -g @pomodoro_complete "#[fg=#{@thm_red}]󱫑 "
+set -g @pomodoro_pause "#[fg=#{@thm_yellow}]󱫟 "
+set -g @pomodoro_prompt_break "#[fg=#{@thm_mauve}]󱫫 "
+set -g @pomodoro_prompt_pomodoro "#[fg=#{@thm_green}]󱫡 "
+set -g @pomodoro_sound 'on' # Sound for desktop notifications (Run `ls /System/Library/Sounds` for a list of sounds to use on Mac)
+set -g @pomodoro_notifications 'off'
+set -g @pomodoro_granularity 'on'
+
+# resurrect
+set -g @resurrect-save 'S'
+set -g @resurrect-restore 'C-r'
+
+# tmux-fzf
+TMUX_FZF_LAUNCH_KEY="F"
+TMUX_FZF_ORDER='session|window|pane|command|keybinding|clipboard|process'
+TMUX_FZF_OPTIONS="-p -w 75% -h 85% -m"
+TMUX_FZF_PANE_FORMAT=' \
+ [#{window_name}] \
+ #{pane_current_command} \
+ [#{pane_width}x#{pane_height}] \
+ [history #{history_size}/#{history_limit}, #{history_bytes} bytes] \
+ #{?pane_active,[active],[inactive]}'
+
+bind 'C-b' run-shell -b "~/.local/bin/tmux/tmux-fzf/scripts/keybinding.sh"
+bind 'C-c' run-shell -b "~/.local/bin/tmux/tmux-fzf/scripts/command.sh"
+bind 'C-k' run-shell -b "~/.local/bin/tmux/tmux-fzf/scripts/process.sh"
+bind 'C-p' run-shell -b "~/.local/bin/tmux/tmux-fzf/scripts/pane.sh"
+bind 'C-s' run-shell -b "~/.local/bin/tmux/tmux-fzf/scripts/session.sh"
+bind 'C-w' run-shell -b "~/.local/bin/tmux/tmux-fzf/scripts/window.sh"
+
+# tpm
+set -g @tpm-clean 'X'
+
+
+### --- Theme --- ###
+# catppuccin
+set -g @catppuccin_flavor "mocha"
+set -g @catppuccin_pane_border_status "off"
+set -g @catppuccin_pane_status_enabled "off"
+set -g @catppuccin_window_number_position "left"
+set -g @catppuccin_window_status_style "none" # basic or none
+set -g @catppuccin_status_background "none"
+set -g @catppuccin_window_left_separator ""
+set -g @catppuccin_window_middle_separator ""
+set -g @catppuccin_window_right_separator ""
+set -g @catppuccin_window_current_middle_separator ""
+set -ogq @catppuccin_status_left_separator ""
+set -ogq @catppuccin_status_middle_separator ""
+set -ogq @catppuccin_status_right_separator ""
+set -ogq @catppuccin_status_connect_separator "yes" # yes, no
+set -ogq @catppuccin_status_module_bg_color "none"
+
+# online
+set -g @online_icon "ok"
+set -g @offline_icon "nok"
+
+# status left style
+set -ogq @thm_bg "default" # transparent background
+set -g status-left ""
+set -g status-left-length 90
+set -ga status-left "#[bg=default,fg=#{@thm_red}] #(tmux list-sessions | nl | grep -w \"$(tmux display-message -p '#S')\" | awk '{print \$1}')/#(tmux list-sessions | wc -l) "
+set -ga status-left "#[bg=default,fg=#{@thm_overlay_0},none]│"
+set -ga status-left "#{?client_prefix,#{#[bg=#{@thm_surface_2},fg=#{@thm_green},bold,italics]  #S },#{#[bg=default,fg=#{@thm_green}]  #S }}"
+set -ga status-left "#[bg=default,fg=#{@thm_overlay_0},none]│"
+set -ga status-left "#[bg=default,fg=#{@thm_subtext_0}]  #{pane_current_command} "
+set -ga status-left "#[bg=default,fg=#{@thm_overlay_0},none]│"
+set -ga status-left "#[bg=default,fg=#{@thm_blue}]  #{=/-32/...:#{s|$USER|~|:#{b:pane_current_path}}} "
+set -ga status-left "#[bg=default,fg=#{@thm_overlay_0},none]#{?#(gitmux -cfg $HOME/.config/gitmux/gitmux.conf '#{pane_current_path}'),│,}"
+set -ga status-left "#{?#(gitmux -cfg $HOME/.config/gitmux/gitmux.conf '#{pane_current_path}'),#{#[bg=default,fg=#{@thm_subtext_0}] #(gitmux -cfg $HOME/.config/gitmux/gitmux.conf '#{pane_current_path}') }, }"
+set -ga status-left "#[bg=default,fg=#{@thm_overlay_0},none]#{?window_zoomed_flag,│,}"
+set -ga status-left "#[bg=default,fg=#{@thm_subtext_0}]#{?window_zoomed_flag,  zoom ,}"
+
+# status right style
+set -ogq @batt_icon_charge_tier8 "󰁹"
+set -ogq @batt_icon_charge_tier7 "󰂁"
+set -ogq @batt_icon_charge_tier6 "󰁿"
+set -ogq @batt_icon_charge_tier5 "󰁾"
+set -ogq @batt_icon_charge_tier4 "󰁽"
+set -ogq @batt_icon_charge_tier3 "󰁼"
+set -ogq @batt_icon_charge_tier2 "󰁻"
+set -ogq @batt_icon_charge_tier1 "󰁺"
+set -ogq @batt_icon_status_charged "󰚥"
+set -ogq @batt_icon_status_charging "󰂄"
+set -ogq @batt_icon_status_discharging "󰂃"
+set -ogq @batt_icon_status_unknown "󰂑"
+set -ogq @batt_icon_status_attached "󱈑"
+set -g status-right ""
+set -g status-right-length 90
+set -ga status-right "#{?#{pomodoro_status},#{pomodoro_status},#{#[bg=default,fg=#{@thm_peach}]  }}"
+set -ga status-right "#[bg=default,fg=#{@thm_overlay_0},none]│"
+set -ga status-right "#[bg=default,fg=#{@thm_mauve}]  #{continuum_status} "
+set -ga status-right "#[bg=default,fg=#{@thm_overlay_0},none]│"
+# TODO: configure when the battery is available
+set -ga status-right "#{?#{<=:#{battery_percentage},0},#{#[bg=default,fg=#{@thm_red}] #{battery_icon} },#{#[bg=default,fg=#{@thm_green}]} #{battery_icon} #{battery_percentage} }"
+set -ga status-right "#[bg=default,fg=#{@thm_overlay_0},none]│"
+set -ga status-right "#[bg=default]#{?#{==:#{online_status},ok},#[fg=#{@thm_pink}] 󰖩 ,#[fg=#{@thm_red},bold]#[reverse] 󰖪 }"
+set -ga status-right "#[bg=default,fg=#{@thm_overlay_0},none]│"
+set -ga status-right "#[bg=default,fg=#{@thm_red}] #{weather} "
+set -ga status-right "#[bg=default,fg=#{@thm_overlay_0},none]│"
+set -ga status-right "#[bg=default,fg=#{@thm_rosewater}] 󰔟 #(uptime | awk -F 'up ' '{print $2}' | awk -F ',' '{print $1}' | sed 's/:/h /;s/$/m/;s/^ //') "
+set -ga status-right "#[bg=default,fg=#{@thm_overlay_0},none]│"
+set -ga status-right "#[bg=default,fg=#{@thm_blue}] 󰭦 %a,%d 󰅐 %H:%M "
+set -ga status-right "#[bg=default,fg=#{@thm_overlay_0},none] "
+
+# pane border style
+setw -g pane-active-border-style "bg=#{@thm_bg},fg=#{@thm_overlay_0}"
+setw -g pane-border-format ""
+setw -g pane-border-lines single
+setw -g pane-border-status top # top or off
+setw -g pane-border-style "bg=#{@thm_bg},fg=#{@thm_surface_0}"
+
+# window style
+set -wg automatic-rename on
+set -g automatic-rename-format "Window" # Window or ""
+set -g window-status-format " #I#{?#{!=:#{window_name},Window},: #W,} "
+set -g window-status-style "bg=default,fg=#{@thm_rosewater}"
+set -g window-status-last-style "bg=#{@thm_crust},fg=#{@thm_peach}"
+set -g window-status-activity-style "bg=#{@thm_red},fg=#{@thm_surface_0}"
+set -g window-status-bell-style "bg=#{@thm_red},fg=#{@thm_surface_0},bold"
+set -g window-status-separator '|'
+set -g window-status-current-format " #I#{?#{!=:#{window_name},Window},: #W,} "
+set -g window-status-current-style "bg=#{@thm_peach},fg=#{@thm_surface_0},bold"
+
+
+### --- RUN TPM --- ###
+run '${TMUX_PLUGIN_MANAGER_PATH}/tpm/tpm'