fish/aliases.fish
2024-07-23 20:01:15 +02:00

169 lines
9.7 KiB
Fish

#!/bin/fish
# ─< colorized ls >─────────────────────────────────────────────────────────────────────────
# ─< lsd >──────────────────────────────────────────────────────────────────────────────────
if command -v lsd >/dev/null 2>&1
alias ls="lsd --long --git"
alias l="lsd -1 --almost-all"
alias ll="lsd -lA"
alias clearl="command clear && l"
alias tree="lsd --tree"
else
# ─< exa >──────────────────────────────────────────────────────────────────────────────────
if command -v exa >/dev/null 2>&1
alias ls="exa --icons --long --git"
alias l="exa --icons -l"
alias ll="exa --icons -laa"
alias tree="exa --icons -l -tree"
else
# ─< eza >──────────────────────────────────────────────────────────────────────────────────
if command -v eza >/dev/null 2>&1
alias ls="eza --icons --long --git"
alias l="eza --icons -l"
alias ll="eza --icons -laa"
alias tree="eza --icons -l -tree"
else
# ─< if nothing works -- plain old ls >─────────────────────────────────────────────────────
alias ls="ls --color=always -lph"
alias l="ls --color=always -lph"
alias ll="ls --color=always -lAph"
end
end
end
# ─< set alias for clearl >─────────────────────────────────────────────────────────────────
if alias l >/dev/null 2>&1
alias clearl="command clear && l"
end
# ─< colored everything >───────────────────────────────────────────────────────────────────
alias ip="ip --color=always"
# ─< check for rg >─────────────────────────────────────────────────────────────────────────
if command -v rg >/dev/null 2>&1
alias grep="rg --color=always"
else
alias grep="grep --color=always"
end
# ─< weather >──────────────────────────────────────────────────────────────────────────────
alias www="curl wttr.in/Ulm"
# ─< telnet (starwars) >────────────────────────────────────────────────────────────────────
if command -v telnet >/dev/null 2>&1
alias starwars="telnet -a telehack.com"
end
# ─< rsync >────────────────────────────────────────────────────────────────────────────────
if command -v rsync >/dev/null 2>&1
alias cp="rsync -avP"
alias scp="rsync -avP"
end
# ─< bat alias >────────────────────────────────────────────────────────────────────────────
if command -v batcat >/dev/null 2>&1
alias cat="batcat --color=always -p --paging=never"
alias less="batcat --paging always --color=always"
alias gd="batcat --diff"
end
# ─< batcat alias >─────────────────────────────────────────────────────────────────────────
if command -v bat >/dev/null 2>&1
alias cat="bat --color=always -p"
alias less="bat --paging always --color=always"
alias gd="bat --diff"
end
# ─< fastfetch >────────────────────────────────────────────────────────────────────────────
if command -v fastfetch >/dev/null 2>&1
alias ff="fastfetch"
alias clearff="command clear & fastfetch"
# ─< check for fastfetch module-existence >─────────────────────────────────────────────────
command fastfetch --config os >/dev/null 2>&1
# ─< check the status >─────────────────────────────────────────────────────────────────────
switch $status
case 0
alias f="fastfetch --config os"
# ─< unsuccessful, cloning repo >──────────────────────────────────────────────────────────
case '*'
git clone https://git.k4li.de/mirrors/fastfetch.git $HOME/.local/share/fastfetch >/dev/null 2>&1
# ─< execute fish to reinitialize aliases >────────────────────────────────────────────────
exec fish
end
clear & f
alias clear="clear & f"
end
# ─< set nmap-alias >───────────────────────────────────────────────────────────────────────
if command -v nmap >/dev/null 2>&1
alias scanvuln="sudo nmap --script vuln -vvv"
alias sv="scanvuln"
alias portscan="sudo nmap -sT"
alias ps="portscan"
end
# ─< t stands for tmux >────────────────────────────────────────────────────────────────────
if command -v tmux >/dev/null 2>&1
alias ts="tmux source $HOME/.tmux.conf"
alias t="tmux"
end
# ─< d stands for docker >──────────────────────────────────────────────────────────────────
if command -v docker >/dev/null 2>&1
alias up="docker compose up"
alias down="docker compose down"
alias pull="docker compose pull"
alias d="docker"
alias dr="docker run --rm -it"
alias ds="docker ps -a"
alias dc="docker compose"
alias appupdate="docker compose pull && docker compose up -d --force-recreate"
end
# ─< g stands for GIT >─────────────────────────────────────────────────────────────────────
if command -v git >/dev/null 2>&1
alias g="git"
alias gs="git status"
alias gm='git checkout main && git merge'
alias gc="git clone --recurse-submodule"
alias ga="git add"
alias gp="git pull --recurse-submodule"
alias gms='git maintenance start'
alias gsu="git pull --recurse-submodule && git submodule foreach git pull && git add . && git commit -m ' updated 📌submodules' && echo '-- Committed changes, pushing now..' && sleep 1 && git push"
alias gcm="git commit -m"
alias gpu="git push --recurse-submodule=on-demand"
if command -v lazygit >/dev/null 2>&1
alias lg="lazygit"
end
end
# ╭────────╮
# │ CODING │
# ╰────────╯
# ─< h stands for HUGO >──────────────────────────────────────────────────────────────────
if command -v hugo >/dev/null 2>&1
alias h='hugo'
alias hs='hugo server -D --noHTTPCache --disableFastRender'
end
# ─< c stands for bin/cake >──────────────────────────────────────────────────────────────
alias cake='bin/cake'
alias c='cake'
alias cs='c server -p 1313'
# ─< VSCodium >─────────────────────────────────────────────────────────────────────────────
if command -v codium >/dev/null 2>&1
alias code="codium"
set -e EDITOR
set -p EDITOR codium
end
# ─< neovide, the best frontend for any neovim-config >───────────────────────────────────
if test -d $HOME/.local/share/neovide/
if command -v neovide >/dev/null 2>&1
alias nvim='neovide --fork'
else
set -p neovide (bash -c 'find $HOME/ -name *neovide*.appimage' >/dev/null 2>&1) || exit 1
alias nvim="$neovide --fork"
end
end