This commit is contained in:
pika 2025-05-25 20:48:47 +02:00
parent 74357e75d7
commit 41c9126080
2 changed files with 47 additions and 3 deletions

View file

@ -1,3 +1,28 @@
# Define color variables
RED='\033[0;31m'
YELLOW='\033[0;33m'
CYAN='\033[0;36m'
GREEN='\033[1;32m'
NC='\033[0m' # No Color
BOLD='\033[1m'
# Functions to store messages
echo_error() {
_MESSAGES[error]+="${RED}$@${NC}\n"
}
echo_missing() {
_MESSAGES[missing]+="${YELLOW} 󱥸 $@${NC}\n"
}
echo_warning() {
_MESSAGES[warn]+="${YELLOW}⚠️ $@${NC}\n"
}
echo_info() {
_MESSAGES[info]+="${CYAN} $@${NC}\n"
}
alias sudo="sudo -E" alias sudo="sudo -E"
alias please="sudo" alias please="sudo"
@ -87,7 +112,13 @@ if command_exists nvim; then
alias cnvim="command nvim" alias cnvim="command nvim"
alias nvim="$(choose_nvim)" alias nvim="$(choose_nvim)"
nv() { nv() {
NVIM_APPNAME="$1" command nvim "${@:-2}" appname="$1"
shift
if [ "$#" -eq 0 ]; then
NVIM_APPNAME="$appname" command nvim
else
NVIM_APPNAME="$appname" command nvim "$@"
fi
} }
if [ -d "$HOME/.config/nvdev" ]; then if [ -d "$HOME/.config/nvdev" ]; then
@ -378,6 +409,8 @@ __git__() {
} }
# ──────────────────────────────────────< functions >──────────────────────────────────── # ──────────────────────────────────────< functions >────────────────────────────────────
# use git clone directly with <username>/<repo>
# ex: gcl pik4li/ReDeploy.git --> https://github.com/pik4li/ReDeploy.git
gcl() { gcl() {
if [ -z "$2" ]; then if [ -z "$2" ]; then
git clone --depth=1 "https://github.com/$1" git clone --depth=1 "https://github.com/$1"
@ -386,6 +419,7 @@ __git__() {
fi fi
} }
# the same with my own github server
gck() { gck() {
if [ -z "$2" ]; then if [ -z "$2" ]; then
git clone --recurse-submodules --depth=1 "https://git.k4li.de/$1" git clone --recurse-submodules --depth=1 "https://git.k4li.de/$1"
@ -394,6 +428,7 @@ __git__() {
fi fi
} }
# and to clone with ssh
gcs() { gcs() {
if [ -z "$2" ]; then if [ -z "$2" ]; then
git clone --recurse-submodules --depth=1 "git@git.k4li.de:$1" git clone --recurse-submodules --depth=1 "git@git.k4li.de:$1"
@ -402,6 +437,8 @@ __git__() {
fi fi
} }
# submodule update, goes in every submodule, put't it to main, and pulls down the changes
# It then pulls down every change and commits it
gsu() { gsu() {
echo "${CYAN}Updating submodules recursively with -> ${YELLOW}${BOLD}git submodule update --init --recursive${NC}" echo "${CYAN}Updating submodules recursively with -> ${YELLOW}${BOLD}git submodule update --init --recursive${NC}"
git submodule update --init --recursive && git submodule update --init --recursive &&
@ -451,6 +488,10 @@ __git__() {
fi fi
} }
# gwip command, to quickly add files and commit and push them directly in one command
# ex: gwip . -> will git add . && git commit -m "gwip" && git push
# ex: gwip "Files changed" -> "Files changed" is now the description, instead of gwip.
# ex: gwip install.sh -> will only add and commit/push the file 'install.sh' and commit with wip
gwip() { gwip() {
# Fetch the latest changes from the remote # Fetch the latest changes from the remote
git fetch git fetch
@ -492,11 +533,11 @@ if command_exists tmux; then
ta() { ta() {
if tmux list-sessions >/dev/null 2>&1; then if tmux list-sessions >/dev/null 2>&1; then
echo "-- tmux session active! | Connecting to active session --" echo "-- tmux session active! | Connecting to active session --"
sleep 0.3 sleep 0.1
tmux attach tmux attach
else else
echo "-- No tmux session found! | Creating one --" echo "-- No tmux session found! | Creating one --"
sleep 0.3 sleep 0.1
tmux tmux
fi fi
} }

View file

@ -194,6 +194,9 @@ _env() {
yazi yazi
curl curl
tmux tmux
fzf
cowsay
btop
) )
for pkg in "${essentials[@]}"; do for pkg in "${essentials[@]}"; do