Last active
August 6, 2025 10:21
-
-
Save ceroberoz/094ec27b31ceedad89971ed8b6bdf28d to your computer and use it in GitHub Desktop.
Opinionated fish shell config (+ starship.rs) for daily sysadmin and light python / shell scripting for Apple M1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # βββββββββββββββββββββββββββββββββββββ | |
| # Exit early if not interactive | |
| # βββββββββββββββββββββββββββββββββββββ | |
| if not status is-interactive | |
| return | |
| end | |
| # βββββββββββββββββββββββββββββββββββββ | |
| # Homebrew (Apple Silicon) | |
| # βββββββββββββββββββββββββββββββββββββ | |
| set -gx HOMEBREW_PREFIX /opt/homebrew | |
| set -gx HOMEBREW_NO_ANALYTICS 1 # Privacy: disable reporting | |
| # Add to PATH only if not already present | |
| for dir in $HOMEBREW_PREFIX/bin $HOMEBREW_PREFIX/sbin | |
| if not contains $dir $PATH | |
| set -gx PATH $dir $PATH | |
| end | |
| end | |
| # Optional: man pages | |
| if not contains $HOMEBREW_PREFIX/share/man $MANPATH | |
| set -gx MANPATH $HOMEBREW_PREFIX/share/man $MANPATH | |
| end | |
| # βββββββββββββββββββββββββββββββββββββ | |
| # Environment Variables | |
| # βββββββββββββββββββββββββββββββββββββ | |
| set -gx XDG_DATA_HOME ~/.local/share | |
| set -gx XDG_CONFIG_HOME ~/.config | |
| set -gx EDITOR nvim | |
| set -gx GIT_EDITOR nvim | |
| set -gx PAGER less | |
| set -gx LESS '-F -g -i -M -R -S -w -X -z-4' | |
| # Python: prefer bundled tools | |
| set -gx PYTHONUNBUFFERED 1 | |
| # Set a smart PYTHONBREAKPOINT (ipdb with pdb fallback) | |
| function _set_python_breakpoint | |
| if command -v ipdb >/dev/null | |
| set -gx PYTHONBREAKPOINT ipdb.set_trace | |
| else | |
| set -gx PYTHONBREAKPOINT pdb.set_trace | |
| end | |
| end | |
| _set_python_breakpoint | |
| functions -e _set_python_breakpoint | |
| # βββββββββββββββββββββββββββββββββββββ | |
| # Shell UX & Behavior | |
| # βββββββββββββββββββββββββββββββββββββ | |
| set -g fish_cursor_default beam # I-beam cursor | |
| set -g fish_greeting '' # No welcome spam | |
| set -g history_merge_dups yes # Merge history | |
| set -g history_duplicates delete # No duplicates | |
| set -g fish_pager_color_completion normal # Subtle completions | |
| set -g fish_pager_color_description cyan # Nice help text | |
| set -g fish_color_error red # Standout errors | |
| # Autosuggestions: show what's likely | |
| set -g fish_autosuggestion_enabled yes | |
| set -g fish_autosuggestion_strategy [commandline -C] | |
| # Highlighting: enable if plugin is installed | |
| # (install: fisher install jorgebucaran/fish-syntax-highlighting) | |
| # βββββββββββββββββββββββββββββββββββββ | |
| # Prompt: Starship π | |
| # βββββββββββββββββββββββββββββββββββββ | |
| # Opinion: Let starship handle everything β clean, fast, modular | |
| if status --is-interactive | |
| starship init fish | source | |
| end | |
| # βββββββββββββββββββββββββββββββββββββ | |
| # Abbreviations (Fish > Aliases) | |
| # βββββββββββββββββββββββββββββββββββββ | |
| # Filesystem | |
| abbr -a ll 'ls -laFh --color=auto' # Full list | |
| abbr -a la 'ls -A --color=auto' # Hidden files | |
| abbr -a l 'ls -CFh --color=auto' # Compact | |
| abbr -a md 'mkdir -p' | |
| abbr -a path 'echo $PATH | tr ":" "\n"' | |
| # Git | |
| abbr -a gs 'git status' | |
| abbr -a gd 'git diff' | |
| abbr -a ga 'git add' | |
| abbr -a gc 'git commit' | |
| abbr -a gca 'git commit -a' | |
| abbr -a gp 'git push' | |
| abbr -a gpl 'git pull' | |
| abbr -a gco 'git checkout' | |
| abbr -a gb 'git branch' | |
| abbr -a gl 'git log --oneline --graph' | |
| # Navigation | |
| abbr -a .. 'cd ..' | |
| abbr -a ... 'cd ../..' | |
| abbr -a .... 'cd ../../..' | |
| # Tools | |
| abbr -a v 'nvim' | |
| abbr -a d 'docker' | |
| abbr -a dc 'docker-compose' | |
| abbr -a k 'kubectl' | |
| abbr -a mux 'tmux' | |
| abbr -a web 'python3 -m http.server 8000' | |
| # Networking | |
| abbr -a ip 'ipconfig getifaddr en0 || ip a' | |
| abbr -a myip 'curl -s ifconfig.me' | |
| abbr -a ports 'sudo lsof -i -P -n | grep LISTEN' | |
| # Process & Sysadmin | |
| abbr -a pg 'ps aux | grep -i' | |
| abbr -a sudo 'sudo ' | |
| abbr -a update 'brew update && brew upgrade' | |
| # βββββββββββββββββββββββββββββββββββββ | |
| # Python: Auto venv Activation | |
| # βββββββββββββββββββββββββββββββββββββ | |
| # Automatically activate .venv when entering directory | |
| function _activate_venv --on-variable PWD | |
| set venv_dir (pwd)/.venv | |
| if test -d $venv_dir | |
| if not set -q VIRTUAL_ENV | |
| if source $venv_dir/bin/activate.fish 2>/dev/null | |
| echo -s "π Activated .venv" | |
| else if source $venv_dir/bin/activate 2>/dev/null | |
| echo -s "π Activated .venv (sh)" | |
| end | |
| end | |
| else if set -q VIRTUAL_ENV | |
| # Optional: auto-deactivate? Not enabled β too aggressive | |
| # Let users `deactivate` manually | |
| end | |
| end | |
| # βββββββββββββββββββββββββββββββββββββ | |
| # pyenv Support (Optional) | |
| # βββββββββββββββββββββββββββββββββββββ | |
| # Only if you use pyenv | |
| set -gx PYENV_ROOT ~/.pyenv | |
| if status is-interactive | |
| if command -v pyenv >/dev/null | |
| set -gx PATH $PYENV_ROOT/bin $PATH | |
| pyenv init - | source | |
| end | |
| end | |
| # βββββββββββββββββββββββββββββββββββββ | |
| # Private Config (secrets, keys, etc.) | |
| # βββββββββββββββββββββββββββββββββββββ | |
| # Example: ~/.config/fish/private.fish | |
| # set -gx AWS_PROFILE admin | |
| # set -gx DOCKER_HOST ... | |
| if test -f ~/.config/fish/private.fish | |
| source ~/.config/fish/private.fish | |
| end | |
| # βββββββββββββββββββββββββββββββββββββ | |
| # Optional: Welcome Message | |
| # βββββββββββββββββββββββββββββββββββββ | |
| # Uncomment if you want a daily reminder | |
| # echo "π $(date '+%A, %b %d') | π Sysadmin mode: engaged" |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Recommended Plugins (Install Once)
Run these one time to enhance your shell: