diff --git a/config.fish b/config.fish index ec12879..2d5a441 100644 --- a/config.fish +++ b/config.fish @@ -1,5 +1,5 @@ if status is-interactive - # ─< Commands to run in interactive sessions can go here >────────────── +# ─< Commands to run in interactive sessions can go here >────────────── end # ╭───────────────────────────────────────────────────╮ @@ -10,13 +10,13 @@ end # ╰───────────────────────────────────────────────────╯ # ────────────────────────────────────────< sources >────────────────────────────────────── -source ./functions/setup.fish +source $HOME/.config/fish/functions/setup.fish # ─────────────────────────────────< Environment-Variables >─────────────────────────────── set -p EDITOR (which nvim) +# ────────────────────────────────────< setup some stuff >──────────────────────────────────── upin -# set_alias dep_fisher check_fisher plugs_fisher @@ -29,23 +29,23 @@ if command -v lsd >/dev/null 2>&1 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 +# ─< 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 >─────────────────────────────────────────────────────────────────── @@ -120,28 +120,28 @@ end if command -v fastfetch >/dev/null 2>&1 alias ff="fastfetch" alias clearff="command clear & fastfetch" - # ─< check for fastfetch module-existance >───────────────────────────────────────────────── +# ─< check for fastfetch module-existance >───────────────────────────────────────────────── command fastfetch --config os >/dev/null 2>&1 - # ─< check the status >───────────────────────────────────────────────────────────────────── - switch $status +# ─< check the status >───────────────────────────────────────────────────────────────────── + switch $status case 0 alias f="fastfetch --config os" - # ─< unsuccessfull, cloning repo >────────────────────────────────────────────────────────── +# ─< 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 >──────────────────────────────────────────────── +# ─< execute fish to reinitialize aliasses >──────────────────────────────────────────────── exec fish - end + 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" + alias scanvuln="sudo nmap --script vuln -vvv" + alias sv="scanvuln" + alias portscan="sudo nmap -sT" + alias ps="portscan" end # ────────────────────────────────────────< functions >───────────────────────────────────── @@ -152,9 +152,9 @@ end # ─< starship >───────────────────────────────────────────────────────────────────────────── if command -v starship >/dev/null 2>&1 - function starship_transient_prompt_func - starship module character - end +function starship_transient_prompt_func + starship module character +end starship init fish | source enable_transience else @@ -163,10 +163,10 @@ 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 + 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 @@ -176,4 +176,3 @@ $toolbox $ALIASSES  " - diff --git a/functions/setup.fish b/functions/setup.fish index ff79ea5..01348f7 100644 --- a/functions/setup.fish +++ b/functions/setup.fish @@ -5,17 +5,17 @@ function upin # ─< check for sudo/root >────────────────────────────────────────────────────────────────── if [ $USER = "root" ] - set sudo "" + set su "" else if command -v sudo >/dev/null 2>&1 - set sudo "sudo" + set su "sudo" end end # ─────────────────────────< START | distro/packagemanger detection >───────────────────────── # ─< DNF - Fedora >───────────────────────────────────────────────────── if command -v dnf - set pkg "$sudo dnf" + set pkg "$su dnf" set install "$pkg install" set update "$pkg update && $pkg upgrade" set search "$pkg search" @@ -25,15 +25,15 @@ function upin # ─< APT/NALA - Debian >──────────────────────────────────────────────── if command -v nala >/dev/null 2>&1 - set pkg "$sudo nala" + set pkg "$su nala" set install "$pkg update && $pkg install" set update "$pkg update && $pkg upgrade" set search "$pkg search" set remove "$pkg remove" set ALIASSES "-- You're using NALA aliases!! --" else - if command -v apt-get >/dsudo ev/null 2>&1 - set pkg "$sudo apt-get" + if command -v apt-get >/dev/null 2>&1 + set pkg "$su apt-get" set install "$pkg update && $pkg install" set update "$pkg update && $pkg upgrade" set search "$pkg search" @@ -60,7 +60,7 @@ function upin set ALIASSES "-- You're using Arch!! - installed helper: yay --" else if command -v pacman >/dev/null 2>&1 - set pkg "$sudo pacman" + set pkg "$su pacman" set install "$pkg -S" set update "$pkg -Syu" set search "$pkg -Ss" @@ -72,27 +72,26 @@ function upin # ─< Zypper - OpenSuse >──────────────────────────────────────────────────────────────────── if command -v zypper >/dev/null 2>&1 - set pkg "$sudo zypper" + set pkg "$su zypper" set install "$pkg in" set update "$pkg dup" set search "$pkg se" set remove "$pkg rm" alias lock="$pkg al" set ALIASSES "-- I see.. you're using OpenSUSE. i like <3 -- - -- ZYPPER -- " + -- ZYPPER -- " end # ─< APK - Alpine >───────────────────────────────────────────────────────────────────────── if command -v apk >/dev/null 2>&1 - set pkg "$sudo apk" + set pkg "$su apk" set install "$pkg add" set update "$pkg update" set search "$pkg search" set ALIASSES "-- Alpine.. right, this fast os is evolving.. --" end if test -n "$install" - set FISH_INSTALL "$install" - + set -U FISH_INSTALL $install set vars "install" "update" "search" "remove" for env in $vars if not test -z "$env" @@ -100,24 +99,8 @@ function upin end end end - end -# ╭───────────────────────────────────────────────╮ -# │ FUNCTION: alias detection || depends on: upin │ -# ╰───────────────────────────────────────────────╯ -# function set_alias -# # ─< set variables to aliasses >──────────────────────────────────────────────────────────── -# if upin -# set vars "install" "update" "search" "remove" -# for env in $vars -# if not test -z "$env" -# alias "$env"="$$env" -# end -# end -# end -# end - # ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮ # │ FUNCTION: Define function gsa (to ask the user which submodule to clone to which path and which name │ # ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯ @@ -194,7 +177,8 @@ function dep_fisher if not command -v $dep >/dev/null 2>&1 echo "Dependency $dep is not installed. Installing..." if test -n "$FISH_INSTALL" - $FISH_INSTALL $dep + alias fish_install="$FISH_INSTALL" + fish_install $dep else echo "FISH_INSTALL is not defined: $FISH_INSTALL | Please install $dep manually." end @@ -205,14 +189,34 @@ end # ╭───────────────────────────────────────────────────────╮ # │ FUNCTION: check for fisher and install if not present │ # ╰───────────────────────────────────────────────────────╯ + +function inst_fisher + fisher install jorgebucaran/fisher +end + function check_fisher - if not test -e $HOME/.config/fish/functions/fisher.fish - curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source + switch $CHECK_FISHER + case true + fisher update + case '*' + if test ! -e $HOME/.config/fish/functions/fisher.fish + curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish >> $HOME/.config/fish/functions/fisher.fish + else + fisher update >/dev/null 2>&1 + switch $status + case 0 + set -U CHECK_FISHER "true" + case '*' + inst_fisher + end + end end end + # ╭──────────────────────────────────╮ # │ FUNCTION: install fisher plugins │ # ╰──────────────────────────────────╯ + function plugs_fisher # Define plugins to use with fisher set plugins "PatrickF1/fzf.fish" "jorgebucaran/autopair.fish"