# ────────────────────────────────────────
# Fish Shell Configuration
# Author: Kris Yotam <krisyotam@gmail.com>
# ────────────────────────────────────────
# ─── Terminal Size Fix ─────────────────
# Force fish to detect actual terminal dimensions on startup
# Fixes prompt width issues with st + starship
if status is-interactive
set -g fish_handle_reflow 1
# Use Ctrl+K as interrupt (kill) since st uses Ctrl+C for copy
stty intr \ck
end
# ─── PATH ───────────────────────────────
# Add ~/.local/bin and subdirectories to PATH
for dir in ~/.local/bin/**/
set -gx PATH $PATH $dir
end
set -gx PATH $PATH ~/.local/bin $HOME/bin
# Doom Emacs binary path
fish_add_path $HOME/.config/emacs/bin
# Plan 9 from User Space (appended so plan9 tools don't override GNU coreutils)
set -gx PLAN9 /usr/lib/plan9
# Remove plan9 from anywhere in PATH, then re-add at the end
while set -l idx (contains -i -- $PLAN9/bin $PATH)
set -e PATH[$idx]
end
set -gx PATH $PATH $PLAN9/bin
# ─── Default Programs ───────────────────
set -gx EDITOR nvim
set -gx VISUAL nvim
set -gx TERMINAL st
set -gx TERMINAL_PROG st
set -gx BROWSER librewolf
# ─── XDG Base Directories ───────────────
set -gx XDG_CONFIG_HOME $HOME/.config
set -gx XDG_DATA_HOME $HOME/.local/share
set -gx XDG_CACHE_HOME $HOME/.cache
# ─── XDG Cleanup ────────────────────────
set -gx XINITRC $XDG_CONFIG_HOME/x11/xinitrc
set -gx NOTMUCH_CONFIG $XDG_CONFIG_HOME/notmuch-config
set -gx GTK2_RC_FILES $XDG_CONFIG_HOME/gtk-2.0/gtkrc-2.0
set -gx WGETRC $XDG_CONFIG_HOME/wget/wgetrc
set -gx WINEPREFIX $XDG_DATA_HOME/wineprefixes/default
set -gx KODI_DATA $XDG_DATA_HOME/kodi
set -gx PASSWORD_STORE_DIR $XDG_DATA_HOME/password-store
set -gx ANDROID_SDK_HOME $XDG_CONFIG_HOME/android
set -gx CARGO_HOME $XDG_DATA_HOME/cargo
set -gx GOPATH $XDG_DATA_HOME/go
set -gx GOMODCACHE $XDG_CACHE_HOME/go/mod
set -gx ANSIBLE_CONFIG $XDG_CONFIG_HOME/ansible/ansible.cfg
set -gx UNISON $XDG_DATA_HOME/unison
set -gx MBSYNCRC $XDG_CONFIG_HOME/mbsync/config
set -gx ELECTRUMDIR $XDG_DATA_HOME/electrum
set -gx PYTHONSTARTUP $XDG_CONFIG_HOME/python/pythonrc
set -gx SQLITE_HISTORY $XDG_DATA_HOME/sqlite_history
# ─── nnn File Manager ──────────────────
set -gx NNN_OPTS "adeHQ" # a=auto FIFO, d=detail, e=text in $EDITOR, H=show hidden, Q=quit on cd
set -gx NNN_PLUG "p:preview-tui;f:fzcd;o:fzopen;i:imgview;z:autojump"
set -gx NNN_FIFO "/tmp/nnn.fifo"
set -gx NNN_OPENER "$HOME/.config/nnn/plugins/nuke"
set -gx NNN_BMS "d:~/Documents;D:~/Downloads;c:~/.config;p:~/dev;h:~;w:~/content"
set -gx NNN_TRASH 1 # use trash-cli
set -gx NNN_PREVIEWIMGPROG "ueberzug" # image previews via ueberzugpp
# ─── Program Settings ───────────────────
set -gx DICS /usr/share/stardict/dic/
set -gx SUDO_ASKPASS $HOME/.local/bin/dmenupass
set -gx FZF_DEFAULT_OPTS "--layout=reverse --height 40%"
set -gx LESS R
set -gx LESSOPEN "| /usr/bin/highlight -O ansi %s 2>/dev/null"
set -gx QT_QPA_PLATFORMTHEME gtk2
set -gx MOZ_USE_XINPUT2 1
set -gx AWT_TOOLKIT "MToolkit wmname LG3D"
set -gx _JAVA_AWT_WM_NONREPARENTING 1
# ─── Less Colors ────────────────────────
set -gx LESS_TERMCAP_mb (printf '\e[1;31m')
set -gx LESS_TERMCAP_md (printf '\e[1;36m')
set -gx LESS_TERMCAP_me (printf '\e[0m')
set -gx LESS_TERMCAP_so (printf '\e[01;44;33m')
set -gx LESS_TERMCAP_se (printf '\e[0m')
set -gx LESS_TERMCAP_us (printf '\e[1;32m')
set -gx LESS_TERMCAP_ue (printf '\e[0m')
# ─── Disable Greeting ─────────────────
set -g fish_greeting
# ─── Vi Mode ────────────────────────────
fish_vi_key_bindings
# ─── Keybindings ────────────────────────
bind \co 'nnncd; commandline -f repaint'
bind \cf 'cd (dirname (fzf)); commandline -f repaint'
bind \ce edit_command_buffer
# Also bind for insert mode
bind -M insert \co 'nnncd; commandline -f repaint'
bind -M insert \cf 'cd (dirname (fzf)); commandline -f repaint'
bind -M insert \ce edit_command_buffer
# ─── Abbreviations (Aliases) ────────────
# Core utilities
abbr -a vim nvim
abbr -a cp "cp -iv"
abbr -a mv "mv -iv"
abbr -a rm "rm -vI"
abbr -a mkd "mkdir -pv"
abbr -a grep "grep --color=auto"
abbr -a diff "diff --color=auto"
# Modern CLI replacements
abbr -a ls "eza --icons --group-directories-first"
abbr -a ll "eza -la --icons --group-directories-first"
abbr -a la "eza -a --icons --group-directories-first"
abbr -a lt "eza --tree --icons --group-directories-first"
abbr -a cat "bat --paging=never"
# Shortcuts
abbr -a ka killall
abbr -a g git
abbr -a e $EDITOR
abbr -a v $EDITOR
abbr -a p pacman
abbr -a z zathura
abbr -a lf nnncd
abbr -a bin "nnn ~/.local/bin"
# System commands
abbr -a logout "pkill -KILL -u krisyotam"
abbr -a lock slock
abbr -a shutdown "sudo shutdown now"
abbr -a restart "sudo systemctl reboot"
# Audio devices
abbr -a hs65 "pactl set-default-sink alsa_output.usb-Corsair_Corsair_HS65_SURROUND-00.analog-stereo"
abbr -a airpods "pactl set-default-sink bluez_output.20_15_82_D9_F9_CC.1"
# Applications
# irc is now a script wrapping catgirl — see ~/.local/bin/irc
abbr -a browser "$BROWSER &"
abbr -a rss "sfeed_curses ~/.sfeed/feeds/*"
abbr -a hn "hakuneko-desktop &"
abbr -a torrent rtorrent
# Flatpak Applications (long commands need aliases)
abbr -a discord "flatpak run com.discordapp.Discord &"
abbr -a notesnook "flatpak run com.notesnook.Notesnook &"
abbr -a novelwriter "flatpak run io.novelwriter.novelWriter &"
abbr -a symbol-editor "flatpak run org.kde.SymbolEditor &"
abbr -a steam "flatpak run com.valvesoftware.Steam"
abbr -a vscode "flatpak run com.visualstudio.code &"
abbr -a anki "flatpak run net.ankiweb.Anki &"
abbr -a tropy "flatpak run org.tropy.Tropy &"
# AppImage Applications
abbr -a hayase "$HOME/.local/bin/appimages/hayase &"
# Terminal UI tools
abbr -a mutt neomutt
abbr -a lg lazygit
abbr -a ld lazydocker
abbr -a ytdl yt-dlp
abbr -a top btop
abbr -a ff fastfetch
abbr -a htop btop
# Claude Code
abbr -a claude "claude --dangerously-skip-permissions"
# Sophia virtual assistant
alias sophia='cd ~/dev/sophia && ./sophia'
# Application aliases
function zed; command zeditor $argv &; disown; end
function warp; command warp-terminal $argv &; disown; end
function mouse; command mouseless $argv &; disown; end
# Git abbreviations
abbr -a ga "git add"
abbr -a gc "git commit"
abbr -a gp "git push"
abbr -a gl "git pull"
abbr -a gs "git status"
abbr -a gd "git diff"
abbr -a gco "git checkout"
abbr -a gb "git branch"
abbr -a glog "git log --oneline --graph"
# Sudo shortcuts
abbr -a sv "sudo nvim"
abbr -a sp "sudo pacman"
# Edit configuration files
abbr -a fishrc "$EDITOR ~/.config/fish/config.fish"
abbr -a nvimrc "$EDITOR ~/.config/nvim/init.lua"
abbr -a snippets "$EDITOR ~/.local/share/karbs/snippets"
# ─── Maritime Monitoring (Monarch Suite) ────
abbr -a sst sea-surface-temperature-anomaly
abbr -a seismic subsea-seismic-monitor
abbr -a ohc ocean-heat-content-index
abbr -a maritime maritime-charts
abbr -a kpi kaiju-probability-index
# ─── Zoxide (smarter cd) ───────────────
if type -q zoxide
zoxide init fish | source
end
# ─── Direnv (per-directory env vars) ────
if type -q direnv
direnv hook fish | source
end
# ─── Prompt ────────────────────────────
# Prompt is defined in ~/.config/fish/functions/fish_prompt.fish
# If you want starship instead, uncomment the line below:
# starship init fish | source
# ─── Start X on tty1 ────────────────────
if test (tty) = /dev/tty1; and not pgrep -x Xorg > /dev/null
exec startx $XINITRC
end