Compare commits

...

6 Commits

Author SHA1 Message Date
jsarthak c0bb8b5f9a Fix fzf 2026-07-18 23:10:20 +05:30
jsarthak a7246fe879 Fix tmux paths 2026-07-18 22:55:40 +05:30
jsarthak e53b81fe55 Some shell fixes 2026-07-18 22:42:08 +05:30
jsarthak dd47827e13 feat(tmux): auto-name sessions with emoji + codename
- scripts/tmux-session-name.sh: generates random emoji + adj-noun name
  40 emojis x 40 adjectives x 40 nouns = 64,000 combinations
  Only renames numerically-named sessions (skips explicit names)

- tmux.conf.local: session-created hook calls the script automatically

- shell/common: added DOTFILES=$HOME/dotfiles env var so hooks and
  scripts can find the dotfiles root without hardcoded paths

Examples: '🐉 sonic-oracle', '🌟 electric-nebula', '🔱 nova-comet'
2026-07-18 15:18:50 +05:30
jsarthak 1ec7aff593 fix(tmux): always-on Neovim-style NORMAL/VISUAL mode indicator
NORMAL = always visible when working in tmux (green)
VISUAL = switches in when entering copy-mode via prefix+Enter (blue)

Uses pane-mode-changed hook with -F flag for clean format evaluation.
Default @mode_indicator set to NORMAL on config load.
2026-07-18 14:47:18 +05:30
jsarthak 04b03d85cd fix(tmux): fix NORMAL/VISUAL mode indicators
The #{?pane_in_mode,...} inline conditional was getting mangled by
oh-my-tmux's awk/sed pipeline that processes tmux_conf_theme_status_right.

Fix: use #{@mode_indicator} user-option in status_right, driven by:
  - bind Enter  → sets NORMAL indicator (green) on copy-mode entry
  - bind v      → sets VISUAL indicator (blue) on selection start
  - bind y/Esc  → clears indicator on copy/exit
  - pane-mode-changed hook → clears indicator when mode exits

Also fixed: encoding artifacts in status_right, missing bullet separator.
2026-07-18 14:44:53 +05:30
6 changed files with 93 additions and 12 deletions
+54
View File
@@ -0,0 +1,54 @@
#!/usr/bin/env bash
# tmux-session-name.sh — Auto-name new tmux sessions with emoji + codename
#
# Called by the session-created hook in .tmux.conf
# Usage: tmux-session-name.sh <current_session_name> <session_id>
CURRENT_NAME="${1:-}"
SESSION_ID="${2:-}"
# Skip if name is empty or not a plain number (user explicitly named it)
if [[ -z "$CURRENT_NAME" || ! "$CURRENT_NAME" =~ ^[0-9]+$ ]]; then
exit 0
fi
# ── Name pool ─────────────────────────────────────────────────────────────────
EMOJIS=(
"⚡" "🔥" "🌙" "🚀" "🎯" "💎" "🌊" "🎸" "🦊" "🐉"
"🌟" "🎭" "🔮" "🦋" "🌸" "🏔️" "🎪" "🦁" "🐺" "🦅"
"🐬" "🌋" "⚗️" "🧠" "🔭" "🎲" "🏹" "🌀" "🦄" "🐙"
"🎮" "🛸" "🌈" "🔱" "⚜️" "🧬" "🦾" "💫" "🎆" "🌌"
)
ADJECTIVES=(
swift blazing cosmic silent wild golden dark frozen epic neon
cyber ghost storm iron crystal hyper zen rogue nova apex
void shadow turbo lunar sonic electric primal ancient savage brave
mystic toxic ultra prime omega alpha delta sigma raging burning
)
NOUNS=(
wolf phoenix raven otter falcon dragon viper lynx shark cobra
titan spectre nexus cipher forge matrix pulse blade hawk panther
manta kraken hydra mantis raptor condor jaguar orca wraith banshee
golem oracle anvil tempest quasar nebula comet prism zenith apex
)
# ── Pick random combination ───────────────────────────────────────────────────
# We use absolute arithmetic expansion to avoid negative index quirks
EMOJI="${EMOJIS[$((RANDOM % ${#EMOJIS[@]}))]}"
ADJ="${ADJECTIVES[$((RANDOM % ${#ADJECTIVES[@]}))]}"
NOUN="${NOUNS[$((RANDOM % ${#NOUNS[@]}))]}"
NEW_NAME="${EMOJI} ${ADJ}-${NOUN}"
# ── Rename ────────────────────────────────────────────────────────────────────
if [[ -n "$SESSION_ID" ]]; then
# Use -t with the specific session ID to avoid targeting the wrong session
tmux rename-session -t "$SESSION_ID" "$NEW_NAME" 2>/dev/null
else
# Called standalone — just print the name
echo "$NEW_NAME"
fi
+3
View File
@@ -5,6 +5,9 @@
export EDITOR='nvim'
export VISUAL='nvim'
# Dotfiles root — used by scripts and tmux hooks
export DOTFILES="$HOME/dotfiles"
# Man page rendering
export MANROFFOPT="-c"
+2 -2
View File
@@ -11,8 +11,8 @@ if command -v xclip >/dev/null 2>&1; then
fi
# fzf shell integration (Linux path)
[[ -f /usr/share/doc/fzf/examples/key-bindings.zsh ]] && \
source /usr/share/doc/fzf/examples/key-bindings.zsh
# Set up fzf key bindings and fuzzy completion
eval "$(fzf --bash)"
[[ -f ~/.fzf.zsh ]] && source ~/.fzf.zsh
# Zoxide (smarter cd) — in case not already initialized by bashrc
+1
View File
@@ -10,6 +10,7 @@ export PATH="/Users/jsarthak/.antigravity/antigravity/bin:$PATH"
# Flutter SDK
export PATH="/Users/jsarthak/flutter-sdk/flutter/bin:$PATH"
export PATH="/Users/jsarthak/.local/bin:$PATH"
# fzf shell integration (macOS path)
source <(fzf --zsh) 2>/dev/null || true
+4 -4
View File
@@ -1,7 +1,7 @@
# starship.toml - Fully riced modern prompt config aligned with Carbonfox theme
format = """
$os$username$hostname$directory$git_branch$git_state$git_status$python$nodejs$rust$golang$cmd_duration$line_break\
$os$username$hostname$directory$git_branch$git_state$git_status$cmd_duration$line_break\
$character"""
# Wait 10 milliseconds for starship to check files under the current directory.
@@ -44,12 +44,12 @@ vimcmd_symbol = "[](bold cyan)" # Use terminal cyan
[git_branch]
symbol = "🌱 "
style = "bold red" # Use terminal red
format = "on [$symbol$branch]($style) "
format = "on [$symbol $branch]($style) "
truncation_symbol = ""
[git_status]
style = "bold red"
format = "([$all_status$ahead_behind]($style) )"
format = "([$all_status $ahead_behind]($style) )"
conflicted = "🏳"
ahead = "🏎💨"
behind = "😰"
@@ -88,7 +88,7 @@ format = "via [$symbol$version]($style) "
[cmd_duration]
min_time = 100
style = "bold yellow"
format = "underwent [$duration]($style) "
format = "took [$duration]($style) "
[status]
style = "bg:blue"
+28 -5
View File
@@ -181,7 +181,7 @@ tmux_conf_theme_window_status_attr="none"
# tmux_conf_theme_window_status_format="#I #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,!,}#{?window_zoomed_flag,Z,}"
#tmux_conf_theme_window_status_format="#{circled_window_index} #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,!,}#{?window_zoomed_flag,Z,}"
# tmux_conf_theme_window_status_format=" #I: #(despell -e #W) #W #{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}"
tmux_conf_theme_window_status_format="#[fg=$color_light_gray,bg=default]#I: #(bash /Users/jsarthak/dotfiles/tmux/tmux-window-name.sh '#W' '#{pane_current_path}')#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}"
tmux_conf_theme_window_status_format="#[fg=$color_light_gray,bg=default]#I: #(bash $HOME/dotfiles/tmux/tmux-window-name.sh '#W' '#{pane_current_path}')#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}"
# window current status style
# - built-in variables are:
@@ -196,7 +196,7 @@ tmux_conf_theme_window_status_format="#[fg=$color_light_gray,bg=default]#I: #(ba
# tmux_conf_theme_window_status_current_format="#I #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,!,}#{?window_zoomed_flag,Z,}"
#tmux_conf_theme_window_status_current_format="#{circled_window_index} #W#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,!,}#{?window_zoomed_flag,Z,}"
# tmux_conf_theme_window_status_current_format="#I: #(despell -e #W) #[fg=$tmux_conf_theme_window_status_current_fg]#W*#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}"
tmux_conf_theme_window_status_current_format="#[fg=$color_accent,bg=default,bold]#I: #(bash /Users/jsarthak/dotfiles/tmux/tmux-window-name.sh '#W' '#{pane_current_path}')#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}"
tmux_conf_theme_window_status_current_format="#[fg=$color_accent,bg=default,bold]#I: #(bash $HOME/dotfiles/tmux/tmux-window-name.sh '#W' '#{pane_current_path}')#{?#{||:#{window_bell_flag},#{window_zoomed_flag}}, ,}#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}"
tmux_conf_theme_window_status_current_fg="$window_status_current_fg"
tmux_conf_theme_window_status_current_bg="$window_status_current_bg"
@@ -263,7 +263,7 @@ tmux_conf_theme_status_left_fg="default"
tmux_conf_theme_status_left_bg="default"
tmux_conf_theme_status_left_attr="none"
tmux_conf_theme_status_right=" #{prefix}#{mouse}#{pairing}#{synchronized}#{?pane_in_mode,#{?selection_active,#[fg=$color_blue,bg=default,bold] VISUAL,#[fg=$color_green,bg=default,bold] NORMAL},} | #[fg=$color_fg,bg=default,none]󰔚 #{?uptime_d,#{uptime_d}d,}#{?uptime_h,#{uptime_h}h,}#{?uptime_m,#{uptime_m}m,} #[fg=$color_gray]│ #[fg=$color_cyan,bg=default,bold]󱑒 %d %b %H:%M #[fg=$color_gray]│ #[fg=$color_purple,bg=default,bold]󰊪 #{username}#{root}@#{hostname}"
tmux_conf_theme_status_right=" #{prefix}#{mouse}#{pairing}#{synchronized}#{@mode_indicator} | #[fg=$color_fg,bg=default,none]󰔚 #{?uptime_d,#{uptime_d}d,}#{?uptime_h,#{uptime_h}h,}#{?uptime_m,#{uptime_m}m,} #[fg=$color_gray]│ #[fg=$color_cyan,bg=default,bold]󱑒 %d %b %H:%M #[fg=$color_gray]│ #[fg=$color_purple,bg=default,bold]󰊪 #{username}#{root}@#{hostname}"
# status right style
tmux_conf_theme_status_right_fg="$color_red,$color_fg"
@@ -361,11 +361,34 @@ tmux_conf_urlscan_options="--compact --dedupe"
# -- user customizations -------------------------------------------------------
# Source modular configurations
source-file "/Users/jsarthak/dotfiles/tmux/config/settings.conf"
source-file "/Users/jsarthak/dotfiles/tmux/config/keybindings.conf"
source-file "$HOME/dotfiles/tmux/config/settings.conf"
source-file "$HOME/dotfiles/tmux/config/keybindings.conf"
setw -g window-status-separator " #[fg=#484848]• " #!important
# ── Auto-name sessions (emoji + codename) ─────────────────────────────────────
# Fires on every new session. Skips sessions the user explicitly named.
# Script lives in ~/dotfiles/scripts/tmux-session-name.sh
# set-hook -g session-created \
# 'run-shell "bash $HOME/dotfiles/scripts/tmux-session-name.sh \"#{session_name}\" \"#{session_id}\""'
# ── Mode indicator (always-on, Neovim-style) ──────────────────────────────────
# NORMAL = working in tmux (default, always visible)
# VISUAL = in copy-mode (prefix + Enter)
#
# #{@mode_indicator} is a window user-option set via pane-mode-changed hook.
# We use -F flag so #{pane_in_mode} is evaluated as a tmux format (1=in mode).
# This bypasses oh-my-tmux's awk pipeline which mangles inline #{?...} conditionals.
# Set NORMAL as the default on startup
set-window-option -g @mode_indicator "#[fg=#25be6a,bold] NORMAL "
# Switch between NORMAL and VISUAL whenever the pane mode changes
set-hook -g pane-mode-changed \
'if-shell -F "#{pane_in_mode}" \
"set-window-option -g @mode_indicator \"#[fg=#78a9ff,bold] VISUAL \"" \
"set-window-option -g @mode_indicator \"#[fg=#25be6a,bold] NORMAL \""'
# ── Per-machine local override (untracked) ────────────────────────────────────
# Create ~/.tmux.conf.machine.local on each machine for host-specific tweaks
# (e.g. different color scheme, right-side content, etc.)