dotfiles vCurrent version: v1.0.0 1.1.0
This commit is contained in:
63
.config/fish/conf.d/aliases.fish
Normal file
63
.config/fish/conf.d/aliases.fish
Normal file
@@ -0,0 +1,63 @@
|
||||
# =============================================================================
|
||||
# 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'
|
||||
|
||||
abbr -a -- ls 'ls -F --color=auto'
|
||||
abbr -a -- ll 'ls -l --color=auto'
|
||||
abbr -a -- la 'ls -la --color=auto'
|
||||
abbr -a -- tree 'tree -C'
|
||||
|
||||
abbr -a -- .. 'cd ..'
|
||||
abbr -a -- ... 'cd ../..'
|
||||
|
||||
abbr -a -- 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
|
||||
Reference in New Issue
Block a user