fish/config.fish
2024-05-25 15:13:29 +02:00

176 lines
10 KiB
Fish

if status is-interactive
# ─< Commands to run in interactive sessions can go here >──────────────
end
# ╭───────────────────────────────────────────────────╮
# │ FISH CONFIG BY PIKA │
# │ │
# │ If you have any questions, check the git page at: │
# │ https://git.k4li.de/pika/fish.git │
# ╰───────────────────────────────────────────────────╯
# ────────────────────────────────────────< sources >──────────────────────────────────────
# source $HOME/.config/fish/functions/tmux.fish
source $HOME/.config/fish/functions/c_fisher.fish
source $HOME/.config/fish/functions/dep_fisher.fish
# ─────────────────────────────────< Environment-Variables >───────────────────────────────
set -p EDITOR (which nvim)
upin && set_alias
# ─< colorized ls >─────────────────────────────────────────────────────────────────────────
# ─< lsd >──────────────────────────────────────────────────────────────────────────────────
if command -v lsd >/dev/null 2>&1
alias ls="lsd -l"
alias ll="lsd -lA"
alias tree="lsd --tree"
else
# ─< exa >──────────────────────────────────────────────────────────────────────────────────
if command -v exa >/dev/null 2>&1
alias ls="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 -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 ll="ls --color=always -lAph"
end
end
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"
# ─< 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"
alias gda="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"
alias gda="bat --diff *"
end
# ─< t stands for tmux >────────────────────────────────────────────────────────────────────
if command -v tmux >/dev/null 2>&1
alias ts="tmux source $HOME/.tmux.conf"
alias ta="tmux a"
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 gf="git fetch"
alias gf="git fetch && git merge"
alias gc="git clone --recurse-submodule"
alias ga="git add"
alias gp="git pull --recurse-submodule"
alias gsu="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"
end
# ─< fastfetch >────────────────────────────────────────────────────────────────────────────
if command -v fastfetch >/dev/null 2>&1
alias ff="fastfetch"
alias clearff="command clear & fastfetch"
# ─< check for fastfetch module-existance >─────────────────────────────────────────────────
command fastfetch --config os >/dev/null 2>&1
# ─< check the status >─────────────────────────────────────────────────────────────────────
switch $status
case 0
alias f="fastfetch --config os"
# ─< unsuccessfull, cloning repo >──────────────────────────────────────────────────────────
case '*'
git clone https://git.k4li.de/mirror/fastfetch $HOME/.local/share/fastfetch >/dev/null 2>&1
# ─< execute fish to reinitialize aliasses >────────────────────────────────────────────────
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
# ────────────────────────────────────────< functions >─────────────────────────────────────
# ─< z stands for Zoxide >──────────────────────────────────────────────────────────────────
if command -v zoxide >/dev/null 2>&1
zoxide init fish | source
end
# ─< starship >─────────────────────────────────────────────────────────────────────────────
if command -v starship >/dev/null 2>&1
function starship_transient_prompt_func
starship module character
end
starship init fish | source
enable_transience
else
curl -sS https://starship.rs/install.sh | sh && exec fish
end
set colorscheme for bobthefish
if test -d $HOME/.config/fish/functions/
set -g theme_nerd_fonts yes
set -g defaults_user (echo $USER)
# available options: dark, light, solarized(-dark/-light), base16(-dark/-light), zenburn, gruvbox(-light), dracula, nord, catppuccin-(latte/frappe/macchiato/mocha)
set -g theme_color_scheme catppuccin-mocha
end
set -a TOOLBOX "$warnings

$toolbox

$ALIASSES

"