fish/config.fish
2024-05-25 11:21:14 +02:00

263 lines
14 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/git.fish
# source $HOME/.config/fish/functions/tmux.fish
# source $HOME/.config/fish/functions/c_fisher.fish
# ─────────────────────────────────< Environment-Variables >───────────────────────────────
set -p EDITOR (which nvim)
# ─< check for sudo/root >──────────────────────────────────────────────────────────────────
if [ $USER = "root" ]
set sudo ""
else
if command -v sudo >/dev/null 2>&1
set sudo "sudo"
end
end
# ─────────────────────────< START | distro/packagemanger detection >─────────────────────────
# ─< DNF - Fedora >─────────────────────────────────────────────────────
if command -v dnf
set install '$sudo dnf install'
set update '$sudo dnf update && sudo dnf upgrade'
set search '$sudo dnf search'
set remove '$sudo dnf remove'
set -a ALIASSES "-- You're using DNF aliases!! --"
end
# ─< APT/NALA - Debian >────────────────────────────────────────────────
if command -v nala >/dev/null 2>&1
set install '$sudo nala update && sudo nala install'
set update '$sudo nala update && sudo nala upgrade'
set search '$sudo nala search'
set remove '$sudo nala remove'
set ALIASSES "-- You're using NALA aliases!! --"
else
if command -v apt >/dev/null 2>&1
set install '$sudo apt update && sudo apt install'
set update '$sudo apt update && sudo apt upgrade'
set search '$sudo apt search'
set remove '$sudo apt remove'
set ALIASSES "-- You're using APT aliases!! --"
end
end
# ─< Pacman - Arch >────────────────────────────────────────────────────
if command -v yay >/dev/null 2>&1
set install 'yay -S'
set update 'yay -Syu'
set search 'yay -Ss'
set remove 'yay -R'
set ALIASSES "-- You're using Arch!! - installed helper: yay --"
else
if command -v paru >/dev/null 2>&1
set install 'paru -S'
set update 'paru -Syu'
set search 'paru -Ss'
set remove 'paru -R'
set ALIASSES "-- You're using Arch!! - installed helper: paru --"
else
if command -v pacman >/dev/null 2>&1
set install '$sudo pacman -S'
set update '$sudo pacman -Syu'
set search '$sudo pacman -Ss'
set remove '$sudo pacman -R'
set ALIASSES "-- by the PACMAN - You're using Arch!! --"
end
end
end
# ─< Zypper - OpenSuse >────────────────────────────────────────────────────────────────────
if command -v zypper >/dev/null 2>&1
set install '$sudo zypper in'
set update '$sudo zypper dup'
set search '$sudo zypper se'
set remove '$sudo zypper rm'
alias lock='$sudo zypper al'
set ALIASSES "-- I see.. you're using OpenSUSE. i like <3 --
-- ZYPPER -- "
end
# ─< APK - Alpine >─────────────────────────────────────────────────────────────────────────
if command -v apk >/dev/null 2>&1
set install '$sudo apk add'
set update '$sudo apk update'
set search '$sudo apk search'
set ALIASSES "-- Alpine.. right, this fast os is evolving.. --"
end
# ─< set variables to aliasses >────────────────────────────────────────────────────────────
set vars "install" "update" "search" "remove"
for c_alias in $vars
if not test -z "$c_alias"
alias "$c_alias"="$$c_alias"
end
end
set FISH_INSTALL "$install"
# if [[ ! -f $HOME/.config/fish/functions/fisher.fish ]]
check_fisher
# else
# plugins_fisher
# end
# ──────────────────────────< END | distro/packagemanger detection >──────────────────────────
# ─< 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"
alias grep="grep --color=always"
# ─< 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='bat --paging always --color=always'
end
# ─< batcat alias >─────────────────────────────────────────────────────────────────────────
if command -v bat >/dev/null 2>&1
alias cat='bat --color=always -p'
alias less='bat --paging always --color=always'
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

"