addet some functionality

This commit is contained in:
PieckA 2024-05-25 17:46:25 +02:00
parent a77e07b6e0
commit df727178f0
2 changed files with 72 additions and 69 deletions

View file

@ -1,5 +1,5 @@
if status is-interactive if status is-interactive
# ─< Commands to run in interactive sessions can go here >────────────── # ─< Commands to run in interactive sessions can go here >──────────────
end end
# ╭───────────────────────────────────────────────────╮ # ╭───────────────────────────────────────────────────╮
@ -10,13 +10,13 @@ end
# ╰───────────────────────────────────────────────────╯ # ╰───────────────────────────────────────────────────╯
# ────────────────────────────────────────< sources >────────────────────────────────────── # ────────────────────────────────────────< sources >──────────────────────────────────────
source ./functions/setup.fish source $HOME/.config/fish/functions/setup.fish
# ─────────────────────────────────< Environment-Variables >─────────────────────────────── # ─────────────────────────────────< Environment-Variables >───────────────────────────────
set -p EDITOR (which nvim) set -p EDITOR (which nvim)
# ────────────────────────────────────< setup some stuff >────────────────────────────────────
upin upin
# set_alias
dep_fisher dep_fisher
check_fisher check_fisher
plugs_fisher plugs_fisher
@ -29,23 +29,23 @@ if command -v lsd >/dev/null 2>&1
alias ll="lsd -lA" alias ll="lsd -lA"
alias tree="lsd --tree" alias tree="lsd --tree"
else else
# ─< exa >────────────────────────────────────────────────────────────────────────────────── # ─< exa >──────────────────────────────────────────────────────────────────────────────────
if command -v exa >/dev/null 2>&1 if command -v exa >/dev/null 2>&1
alias ls="exa --icons -l" alias ls="exa --icons -l"
alias ll="exa --icons -laa" alias ll="exa --icons -laa"
alias tree="exa --icons -l -tree" alias tree="exa --icons -l -tree"
else else
# ─< eza >────────────────────────────────────────────────────────────────────────────────── # ─< eza >──────────────────────────────────────────────────────────────────────────────────
if command -v eza >/dev/null 2>&1 if command -v eza >/dev/null 2>&1
alias ls="eza --icons -l" alias ls="eza --icons -l"
alias ll="eza --icons -laa" alias ll="eza --icons -laa"
alias tree="eza --icons -l -tree" alias tree="eza --icons -l -tree"
else else
# ─< if nothing works -- plain old ls >───────────────────────────────────────────────────── # ─< if nothing works -- plain old ls >─────────────────────────────────────────────────────
alias ls="ls --color=always -lph" alias ls="ls --color=always -lph"
alias ll="ls --color=always -lAph" alias ll="ls --color=always -lAph"
end end
end end
end end
# ─< colored everything >─────────────────────────────────────────────────────────────────── # ─< colored everything >───────────────────────────────────────────────────────────────────
@ -120,28 +120,28 @@ end
if command -v fastfetch >/dev/null 2>&1 if command -v fastfetch >/dev/null 2>&1
alias ff="fastfetch" alias ff="fastfetch"
alias clearff="command clear & fastfetch" alias clearff="command clear & fastfetch"
# ─< check for fastfetch module-existance >───────────────────────────────────────────────── # ─< check for fastfetch module-existance >─────────────────────────────────────────────────
command fastfetch --config os >/dev/null 2>&1 command fastfetch --config os >/dev/null 2>&1
# ─< check the status >───────────────────────────────────────────────────────────────────── # ─< check the status >─────────────────────────────────────────────────────────────────────
switch $status switch $status
case 0 case 0
alias f="fastfetch --config os" alias f="fastfetch --config os"
# ─< unsuccessfull, cloning repo >────────────────────────────────────────────────────────── # ─< unsuccessfull, cloning repo >──────────────────────────────────────────────────────────
case '*' case '*'
git clone https://git.k4li.de/mirror/fastfetch $HOME/.local/share/fastfetch >/dev/null 2>&1 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 exec fish
end end
clear & f clear & f
alias clear="clear & f" alias clear="clear & f"
end end
# ─< set nmap-alias >─────────────────────────────────────────────────────────────────────── # ─< set nmap-alias >───────────────────────────────────────────────────────────────────────
if command -v nmap >/dev/null 2>&1 if command -v nmap >/dev/null 2>&1
alias scanvuln="sudo nmap --script vuln -vvv" alias scanvuln="sudo nmap --script vuln -vvv"
alias sv="scanvuln" alias sv="scanvuln"
alias portscan="sudo nmap -sT" alias portscan="sudo nmap -sT"
alias ps="portscan" alias ps="portscan"
end end
# ────────────────────────────────────────< functions >───────────────────────────────────── # ────────────────────────────────────────< functions >─────────────────────────────────────
@ -152,9 +152,9 @@ end
# ─< starship >───────────────────────────────────────────────────────────────────────────── # ─< starship >─────────────────────────────────────────────────────────────────────────────
if command -v starship >/dev/null 2>&1 if command -v starship >/dev/null 2>&1
function starship_transient_prompt_func function starship_transient_prompt_func
starship module character starship module character
end end
starship init fish | source starship init fish | source
enable_transience enable_transience
else else
@ -163,10 +163,10 @@ end
set colorscheme for bobthefish set colorscheme for bobthefish
if test -d $HOME/.config/fish/functions/ if test -d $HOME/.config/fish/functions/
set -g theme_nerd_fonts yes set -g theme_nerd_fonts yes
set -g defaults_user (echo $USER) 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) # 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_color_scheme catppuccin-mocha
end end
set -a TOOLBOX "$warnings set -a TOOLBOX "$warnings
@ -176,4 +176,3 @@ $toolbox
$ALIASSES $ALIASSES
 
" "

View file

@ -5,17 +5,17 @@ function upin
# ─< check for sudo/root >────────────────────────────────────────────────────────────────── # ─< check for sudo/root >──────────────────────────────────────────────────────────────────
if [ $USER = "root" ] if [ $USER = "root" ]
set sudo "" set su ""
else else
if command -v sudo >/dev/null 2>&1 if command -v sudo >/dev/null 2>&1
set sudo "sudo" set su "sudo"
end end
end end
# ─────────────────────────< START | distro/packagemanger detection >───────────────────────── # ─────────────────────────< START | distro/packagemanger detection >─────────────────────────
# ─< DNF - Fedora >───────────────────────────────────────────────────── # ─< DNF - Fedora >─────────────────────────────────────────────────────
if command -v dnf if command -v dnf
set pkg "$sudo dnf" set pkg "$su dnf"
set install "$pkg install" set install "$pkg install"
set update "$pkg update && $pkg upgrade" set update "$pkg update && $pkg upgrade"
set search "$pkg search" set search "$pkg search"
@ -25,15 +25,15 @@ function upin
# ─< APT/NALA - Debian >──────────────────────────────────────────────── # ─< APT/NALA - Debian >────────────────────────────────────────────────
if command -v nala >/dev/null 2>&1 if command -v nala >/dev/null 2>&1
set pkg "$sudo nala" set pkg "$su nala"
set install "$pkg update && $pkg install" set install "$pkg update && $pkg install"
set update "$pkg update && $pkg upgrade" set update "$pkg update && $pkg upgrade"
set search "$pkg search" set search "$pkg search"
set remove "$pkg remove" set remove "$pkg remove"
set ALIASSES "-- You're using NALA aliases!! --" set ALIASSES "-- You're using NALA aliases!! --"
else else
if command -v apt-get >/dsudo ev/null 2>&1 if command -v apt-get >/dev/null 2>&1
set pkg "$sudo apt-get" set pkg "$su apt-get"
set install "$pkg update && $pkg install" set install "$pkg update && $pkg install"
set update "$pkg update && $pkg upgrade" set update "$pkg update && $pkg upgrade"
set search "$pkg search" set search "$pkg search"
@ -60,7 +60,7 @@ function upin
set ALIASSES "-- You're using Arch!! - installed helper: yay --" set ALIASSES "-- You're using Arch!! - installed helper: yay --"
else else
if command -v pacman >/dev/null 2>&1 if command -v pacman >/dev/null 2>&1
set pkg "$sudo pacman" set pkg "$su pacman"
set install "$pkg -S" set install "$pkg -S"
set update "$pkg -Syu" set update "$pkg -Syu"
set search "$pkg -Ss" set search "$pkg -Ss"
@ -72,27 +72,26 @@ function upin
# ─< Zypper - OpenSuse >──────────────────────────────────────────────────────────────────── # ─< Zypper - OpenSuse >────────────────────────────────────────────────────────────────────
if command -v zypper >/dev/null 2>&1 if command -v zypper >/dev/null 2>&1
set pkg "$sudo zypper" set pkg "$su zypper"
set install "$pkg in" set install "$pkg in"
set update "$pkg dup" set update "$pkg dup"
set search "$pkg se" set search "$pkg se"
set remove "$pkg rm" set remove "$pkg rm"
alias lock="$pkg al" alias lock="$pkg al"
set ALIASSES "-- I see.. you're using OpenSUSE. i like <3 -- set ALIASSES "-- I see.. you're using OpenSUSE. i like <3 --
-- ZYPPER -- " -- ZYPPER -- "
end end
# ─< APK - Alpine >───────────────────────────────────────────────────────────────────────── # ─< APK - Alpine >─────────────────────────────────────────────────────────────────────────
if command -v apk >/dev/null 2>&1 if command -v apk >/dev/null 2>&1
set pkg "$sudo apk" set pkg "$su apk"
set install "$pkg add" set install "$pkg add"
set update "$pkg update" set update "$pkg update"
set search "$pkg search" set search "$pkg search"
set ALIASSES "-- Alpine.. right, this fast os is evolving.. --" set ALIASSES "-- Alpine.. right, this fast os is evolving.. --"
end end
if test -n "$install" if test -n "$install"
set FISH_INSTALL "$install" set -U FISH_INSTALL $install
set vars "install" "update" "search" "remove" set vars "install" "update" "search" "remove"
for env in $vars for env in $vars
if not test -z "$env" if not test -z "$env"
@ -100,24 +99,8 @@ function upin
end end
end end
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 │ # │ 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 if not command -v $dep >/dev/null 2>&1
echo "Dependency $dep is not installed. Installing..." echo "Dependency $dep is not installed. Installing..."
if test -n "$FISH_INSTALL" if test -n "$FISH_INSTALL"
$FISH_INSTALL $dep alias fish_install="$FISH_INSTALL"
fish_install $dep
else else
echo "FISH_INSTALL is not defined: $FISH_INSTALL | Please install $dep manually." echo "FISH_INSTALL is not defined: $FISH_INSTALL | Please install $dep manually."
end end
@ -205,14 +189,34 @@ end
# ╭───────────────────────────────────────────────────────╮ # ╭───────────────────────────────────────────────────────╮
# │ FUNCTION: check for fisher and install if not present │ # │ FUNCTION: check for fisher and install if not present │
# ╰───────────────────────────────────────────────────────╯ # ╰───────────────────────────────────────────────────────╯
function inst_fisher
fisher install jorgebucaran/fisher
end
function check_fisher function check_fisher
if not test -e $HOME/.config/fish/functions/fisher.fish switch $CHECK_FISHER
curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source 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
end end
# ╭──────────────────────────────────╮ # ╭──────────────────────────────────╮
# │ FUNCTION: install fisher plugins │ # │ FUNCTION: install fisher plugins │
# ╰──────────────────────────────────╯ # ╰──────────────────────────────────╯
function plugs_fisher function plugs_fisher
# Define plugins to use with fisher # Define plugins to use with fisher
set plugins "PatrickF1/fzf.fish" "jorgebucaran/autopair.fish" set plugins "PatrickF1/fzf.fish" "jorgebucaran/autopair.fish"