diff --git a/.bash_aliases b/.bash_aliases index ae6caa0..fb0ff4f 100644 --- a/.bash_aliases +++ b/.bash_aliases @@ -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 please="sudo" @@ -87,7 +112,13 @@ if command_exists nvim; then alias cnvim="command nvim" alias nvim="$(choose_nvim)" 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 @@ -378,6 +409,8 @@ __git__() { } # ──────────────────────────────────────< functions >──────────────────────────────────── + # use git clone directly with / + # ex: gcl pik4li/ReDeploy.git --> https://github.com/pik4li/ReDeploy.git gcl() { if [ -z "$2" ]; then git clone --depth=1 "https://github.com/$1" @@ -386,6 +419,7 @@ __git__() { fi } + # the same with my own github server gck() { if [ -z "$2" ]; then git clone --recurse-submodules --depth=1 "https://git.k4li.de/$1" @@ -394,6 +428,7 @@ __git__() { fi } + # and to clone with ssh gcs() { if [ -z "$2" ]; then git clone --recurse-submodules --depth=1 "git@git.k4li.de:$1" @@ -402,6 +437,8 @@ __git__() { 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() { echo "${CYAN}Updating submodules recursively with -> ${YELLOW}${BOLD}git submodule update --init --recursive${NC}" git submodule update --init --recursive && @@ -451,6 +488,10 @@ __git__() { 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() { # Fetch the latest changes from the remote git fetch @@ -492,11 +533,11 @@ if command_exists tmux; then ta() { if tmux list-sessions >/dev/null 2>&1; then echo "-- tmux session active! | Connecting to active session --" - sleep 0.3 + sleep 0.1 tmux attach else echo "-- No tmux session found! | Creating one --" - sleep 0.3 + sleep 0.1 tmux fi } diff --git a/.bashrc b/.bashrc index 195f92c..052e845 100644 --- a/.bashrc +++ b/.bashrc @@ -194,6 +194,9 @@ _env() { yazi curl tmux + fzf + cowsay + btop ) for pkg in "${essentials[@]}"; do