]> Freerunner's - dotfiles.git/commitdiff
bash: integrate starship
authorAndre Ramnitz <tux.rising@gmail.com>
Sat, 14 Sep 2024 23:04:35 +0000 (01:04 +0200)
committerAndre Ramnitz <tux.rising@gmail.com>
Sat, 14 Sep 2024 23:08:26 +0000 (01:08 +0200)
home/dot-bashrc

index 61ba756fd5925a2be4e923c86a004574f8fef1fa..529bf067b0dbb37b81b32e1097f95a984c9d5fb0 100644 (file)
@@ -6,10 +6,8 @@
 # that can't tolerate any output.  So make sure this doesn't display
 # anything or bad things will happen !
 
-# export PATH="$PATH:/opt/android-sdk/platform-tools:$HOME/go/bin:$HOME/.cargo/bin:$HOME/.local/bin:$HOME/Applications"
 export PATH="$PATH:$HOME/go/bin:$HOME/.cargo/bin:$HOME/Applications"
 
-# export BROWSER='qutebrowser \--untrusted-args "%u"'
 export EDITOR='kks edit'
 export VISUAL='kks edit'
 export PAGER='less'
@@ -42,7 +40,7 @@ case $(tty) in
         alias  ll='EZA_GRID_ROWS=26 eza -w 220 --group --group-directories-first --icons -l'
         alias  ls='EZA_GRID_ROWS=13 eza -w 220 --group --group-directories-first --icons'
         alias  lt='EZA_GRID_ROWS=13 eza -w 220 --group --long --grid --group-directories-first --sort=mod -t=mod --time-style=long-iso'
-        echo tty ;;
+        ;;
     /dev/pts/[0-9]*)
         alias  l1='EZA_GRID_ROWS=26 eza -w 0 --group --group-directories-first -1'
         alias  la='EZA_GRID_ROWS=26 eza -w 55 --group --group-directories-first --icons -l -a'
@@ -50,7 +48,7 @@ case $(tty) in
         alias  ll='EZA_GRID_ROWS=26 eza -w 55 --group --group-directories-first --icons -l'
         alias  ls='EZA_GRID_ROWS=26 eza -w 55 --group --group-directories-first --icons'
         alias  lt='EZA_GRID_ROWS=26 eza -w 0 --group --long --grid --group-directories-first --sort=mod -t=mod --time-style=long-iso'
-        echo pts ;;
+        ;;
 esac
 
 alias emergelog='sudo cat /var/log/emerge.log | grep "started\|completed\|exiting"'
@@ -80,66 +78,6 @@ rm() { command rm -i "${@}"; }
 cp() { command cp -i "${@}"; }
 mv() { command mv -i "${@}"; }
 
-# get current branch in git repo
-function parse_git_branch() {
-    BRANCH=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
-    if [ ! "${BRANCH}" == "" ]
-    then
-        STAT=$(parse_git_dirty)
-        echo "─[${BRANCH}${STAT}]"
-    else
-        echo ""
-    fi
-}
-
-# get current status of git repo
-function parse_git_dirty {
-    status=$(git status 2>&1 | tee)
-    if [ "$LANG" == "de_DE.utf8" ]; then
-        dirty=$(echo -n "${status}" 2> /dev/null | grep "geändert:" &> /dev/null; echo "$?")
-        untracked=$(echo -n "${status}" 2> /dev/null | grep "Unversionierte Dateien:" &> /dev/null; echo "$?")
-        ahead=$(echo -n "${status}" 2> /dev/null | grep "Ihr Branch ist" &> /dev/null; echo "$?")
-        newfile=$(echo -n "${status}" 2> /dev/null | grep "neue Datei:" &> /dev/null; echo "$?")
-        renamed=$(echo -n "${status}" 2> /dev/null | grep "umbenannt:" &> /dev/null; echo "$?")
-        deleted=$(echo -n "${status}" 2> /dev/null | grep "gelöscht:" &> /dev/null; echo "$?")
-    else
-        dirty=$(echo -n "${status}" 2> /dev/null | grep "modified:" &> /dev/null; echo "$?")
-        untracked=$(echo -n "${status}" 2> /dev/null | grep "Untracked files" &> /dev/null; echo "$?")
-        ahead=$(echo -n "${status}" 2> /dev/null | grep "Your branch is ahead of" &> /dev/null; echo "$?")
-        newfile=$(echo -n "${status}" 2> /dev/null | grep "new file:" &> /dev/null; echo "$?")
-        renamed=$(echo -n "${status}" 2> /dev/null | grep "renamed:" &> /dev/null; echo "$?")
-        deleted=$(echo -n "${status}" 2> /dev/null | grep "deleted:" &> /dev/null; echo "$?")
-    fi
-    bits=''
-    if [ "${renamed}" == "0" ]; then
-        bits=">${bits}"
-    fi
-    if [ "${ahead}" == "0" ]; then
-        bits="*${bits}"
-    fi
-    if [ "${newfile}" == "0" ]; then
-        bits="+${bits}"
-    fi
-    if [ "${untracked}" == "0" ]; then
-        bits="?${bits}"
-    fi
-    if [ "${deleted}" == "0" ]; then
-        bits="x${bits}"
-    fi
-    if [ "${dirty}" == "0" ]; then
-        bits="!${bits}"
-    fi
-    if [ ! "${bits}" == "" ]; then
-        echo " ${bits}"
-    else
-        echo ""
-    fi
-}
-
-# export PS1="┬─[\[\e[33m\]\u\[\e[m\]@\[\e[34m\]\h\[\e[m\]:\w]─[\[\e[37m\]\t\[\e[m\]]\`parse_git_branch\`\n╰─\[\e[31m\]\\$\[\e[m\] "
-PS1="\[\033[m\]|\[\033[1;35m\]\t\[\033[m\]|\[\e[1m\]\u\[\e[1;36m\]\[\033[m\]@\[\e[1;36m\]\h\[\033[m\]:\[\e[0m\]\[\e[1;32m\][\W]$(parse_git_branch)> \[\e[0m\]"
-export PS1
-
 # enable moving between directories without cd
 shopt -s autocd
 # enable spelling correction
@@ -157,5 +95,10 @@ lfcd () {
 
 # Put your fun stuff here.
 #
-#[ -x /bin/fish ] && SHELL=/bin/fish exec fish
-fastfetch -c "$HOME/.config/fastfetch/default.jsonc"
+command fastfetch -c "$HOME/.config/fastfetch/config.jsonc"
+
+# enable a minimal default prompt and use starship l8r
+
+PS1='\u@\h \w \$ '
+command -v starship > /dev/null 2>&1 && eval "$(starship init bash)"
+