addet some aliases?

This commit is contained in:
pika 2024-07-30 19:17:00 +02:00
parent 45f4c0aa3a
commit 0f3d2cd489
3 changed files with 88 additions and 45 deletions

View file

@ -2,11 +2,11 @@
function upin
# ─< check for sudo/root >──────────────────────────────────────────────────────────────────
if [ $USER = "root" ]
if [ $USER = root ]
set su ""
else
if command -v sudo >/dev/null 2>&1
set su "sudo"
set su sudo
end
end
@ -43,7 +43,7 @@ function upin
# ─< Pacman - Arch >────────────────────────────────────────────────────
if command -v paru >/dev/null 2>&1
set pkg "paru"
set pkg paru
set install "$pkg -S"
set update "$pkg -Syu"
set search "$pkg -Ss"
@ -51,7 +51,7 @@ function upin
set unattendet "$pkg install --noconfirm"
else
if command -v yay >/dev/null 2>&1
set pkg "yay"
set pkg yay
set install "$pkg -S"
set update "$pkg -Syu"
set search "$pkg -Ss"
@ -93,7 +93,7 @@ function upin
set -U FISH_INSTALL $install
end
if test -n "$install"
set vars "install" "update" "search" "remove"
set vars install update search remove
for env in $vars
if not test -z "$env"
alias "$env"="$$env"
@ -125,7 +125,7 @@ function gsa
echo "-- enter the repository to add as a submodule --"
echo "-- (type 'quit' to quit) --"
read repo
if [ "$repo" = "quit" ]
if [ "$repo" = quit ]
exit 1
end
@ -134,7 +134,7 @@ function gsa
echo "-- enter the relative path, where the submodule will be cloned to. (!! do it like this: ./path/to/clone/to) --"
echo "-- (type 'quit' to quit) --"
read -S path
if [ "$path" = "quit" ]
if [ "$path" = quit ]
exit 1
end
@ -142,14 +142,14 @@ function gsa
echo "-- enter the branch to checkout (main/master..) --"
echo "-- (type 'quit' to quit) --"
read branch
if [ "$branch" = "quit" ]
if [ "$branch" = quit ]
exit 1
end
echo "-- enter a name for the submodule --"
echo "-- (type 'quit' to quit) --"
read -l name
if [ "$name" = "quit" ]
if [ "$name" = quit ]
exit 1
end
@ -161,22 +161,28 @@ function gsa
# ─< Switch statement to handle the user's confirmation input >─────────────────────────────
switch $comm
# ─< If the user inputs 'y' or 'Y', execute the git submodule add command >─────────────────
case 'y' 'Y'
git submodule add --branch $branch --name $name $repo $path
git submodule update --init --recursive
git add .
git commit -m "Addet $name as a submodule"
git push
case y Y
git submodule add --branch $branch --name $name $repo $path
git submodule update --init --recursive
git add .
git commit -m "Addet $name as a submodule"
git push
# ─< If the user inputs 'n' or 'N', notify them to try again >──────────────────────────────
case 'n' 'N'
echo "-- all right, just try again :) --"
# ─< If the user inputs 'n' or 'N', notify them to try again >──────────────────────────────
case n N
echo "-- all right, just try again :) --"
end
end
# ╭───────────────────────────────────────────────────╮
# │ FUNCTION: set tmux command to always work with ta │
# ╰───────────────────────────────────────────────────╯
# ╭────────────────────────────────────╮
# │ FUNCTION: ssh-agent initialisation │
# ╰────────────────────────────────────╯
set -x SSH_AUTH_SOCK $XDG_RUNTIME_DIR/ssh-agent.socket
# ╭───────────────────────────────────────────────────╮
# │ FUNCTION: set tmux command to always work with ta │
# ╰───────────────────────────────────────────────────╯
if command -v tmux >/dev/null 2>&1
set tmux_y "tmux-session active!"
@ -184,20 +190,20 @@ if command -v tmux >/dev/null 2>&1
function ta
command tmux list-sessions >/dev/null 2>&1
switch $status
case 0
if command -v notify-send >/dev/null 2>&1
notify-send "$tmux_y"
end
echo "$tmux_y"
sleep 0.5
tmux a
case '*'
if command -v notify-send >/dev/null 2>&1
notify-send "$tmux_n"
end
echo "No Tmux session found. Creating one now! --"
sleep 0.5
tmux
case 0
if command -v notify-send >/dev/null 2>&1
notify-send "$tmux_y"
end
echo "$tmux_y"
sleep 0.5
tmux a
case '*'
if command -v notify-send >/dev/null 2>&1
notify-send "$tmux_n"
end
echo "No Tmux session found. Creating one now! --"
sleep 0.5
tmux
end
end
end
@ -208,7 +214,7 @@ end
function dep_fisher
# ─< Define dependencies for the plugins used by fisher >───────────────────────────────────
set dependencies "fzf" "btop" "fastfetch" "curl" "wget" "cmatrix"
set dependencies fzf btop fastfetch curl wget cmatrix
# ─< Check and install dependencies >───────────────────────────────────────────────────────
for dep in $dependencies
if not command -v $dep >/dev/null 2>&1
@ -232,8 +238,7 @@ function check_fishr
fisher update
else
if test ! -e $HOME/.config/fish/functions/fisher.fish
echo "you did it!!"> $HOME/.config/fish/.fishr.init && curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source & fisher install jorgebucaran/fisher
echo "you did it!!" >$HOME/.config/fish/.fishr.init && curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source & fisher install jorgebucaran/fisher
end
end
end