Files
dots/.config/fish/conf.d/aliases.fish
2026-06-23 19:13:34 +00:00

64 lines
2.3 KiB
Fish

# =============================================================================
# conf.d/aliases.fish — User aliases and abbreviations
# =============================================================================
#
# Files in ~/.config/fish/conf.d/ are auto-sourced by Fish in alphabetical
# order on every shell start. This is the recommended way to add modular
# configuration snippets — add a new .fish file for each concern:
#
# conf.d/
# ├── aliases.fish # Shortcuts
# ├── env.fish # Environment variables
# ├── prompt.fish # Custom prompt overrides
# └── ... # Anything else
#
# ──────────────────────────────────────────────────────────────────────────────
# --- Abbreviations (expand after space/enter) --------------------------------
# Fish abbreviations are like aliases but they expand inline as you type,
# giving you a chance to edit before running the command.
abbr -a -- g git
abbr -a -- ga 'git add'
abbr -a -- gc 'git commit'
abbr -a -- gp 'git push'
abbr -a -- gl 'git log --oneline --graph --all'
abbr -a -- gs 'git status -sb'
abbr -a -- gd 'git diff'
abbr -a -- gdc 'git diff --cached'
abbr -a -- gco 'git checkout'
abbr -a -- gcb 'git checkout -b'
abbr -a -- gm 'git merge'
abbr -a -- gr 'git rebase'
abbr -a -- gcl 'git clone'
alias ls 'ls -F --color=auto'
alias ll 'ls -l --color=auto'
alias la 'ls -la --color=auto'
alias tree 'tree -C'
abbr -a -- .. 'cd ..'
abbr -a -- ... 'cd ../..'
alias rmf 'rm -rf'
# --- Functions ----------------------------------------------------------------
# For anything beyond a simple abbreviation, define a function.
function mkcd -d "Create a directory and cd into it"
mkdir -p $argv && cd $argv
end
function dotenv -d "Load a .env file into the environment"
if test -f ".env"
for line in (cat .env | string trim)
set -l key (echo $line | cut -d= -f1)
set -l val (echo $line | cut -d= -f2-)
set -gx "$key" "$val"
end
echo "Loaded .env ($(wc -l < .env) variables)"
else
echo "No .env file found"
end
end