aboutsummaryrefslogtreecommitdiff
path: root/.config/shell/.bashrc
diff options
context:
space:
mode:
authorBlista Kanjo2023-08-03 09:32:44 -0400
committerBlista Kanjo2023-08-03 09:32:44 -0400
commita651f0b3bb7a92e1bdf62a2b118c428391a53abe (patch)
tree2991d88685dbf43ea30694312833960e5b461bce /.config/shell/.bashrc
parent36efe6279283441115dc75aed81265b0df03994e (diff)
refactor: added simple `.bashrc`
Diffstat (limited to '.config/shell/.bashrc')
-rw-r--r--.config/shell/.bashrc72
1 files changed, 72 insertions, 0 deletions
diff --git a/.config/shell/.bashrc b/.config/shell/.bashrc
new file mode 100644
index 0000000..39deaf1
--- /dev/null
+++ b/.config/shell/.bashrc
@@ -0,0 +1,72 @@
+# note: this file needs to be sourced in /etc/bash.bashrc
+
+. ~/.config/shell/git-prompt.sh
+export GIT_PS1_SHOWDIRTYSTATE=1
+
+if [[ $- != *i* ]] ; then
+ return
+fi
+
+shopt -s checkwinsize
+shopt -s no_empty_cmd_completion
+shopt -s histappend
+
+case ${TERM} in
+ [aEkx]term*|rxvt*|gnome*|konsole*|interix)
+ PS1='\[\033]0;\u@\h:\w\007\]'
+ ;;
+ screen*)
+ PS1='\[\033k\u@\h:\w\033\\\]'
+ ;;
+ *)
+ unset PS1
+ ;;
+esac
+
+use_color=false
+if type -P dircolors >/dev/null ; then
+ LS_COLORS=
+ if [[ -f ~/.dir_colors ]] ; then
+ used_default_dircolors="no"
+ eval "$(dircolors -b ~/.dir_colors)"
+ elif [[ -f /etc/DIR_COLORS ]] ; then
+ used_default_dircolors="maybe"
+ eval "$(dircolors -b /etc/DIR_COLORS)"
+ else
+ used_default_dircolors="yes"
+ eval "$(dircolors -b)"
+ fi
+ if [[ -n ${LS_COLORS:+set} ]] ; then
+ use_color=true
+ fi
+ unset used_default_dircolors
+else
+ case ${TERM} in
+ [aEkx]term*|rxvt*|gnome*|konsole*|screen|cons25|*color) use_color=true;;
+ esac
+fi
+
+if ${use_color} ; then
+ if [[ ${EUID} == 0 ]] ; then
+ PS1+='\[\033[01;31m\]\h\[\033[01;34m\] \w \$_\[\033[00m\]$(__git_ps1) '
+ else
+ PS1+='\[\033[01;34m\]\w \$_\[\033[00m\]$(__git_ps1) '
+ fi
+
+ alias ls='ls --color=auto'
+ alias grep='grep --colour=auto'
+ alias egrep='egrep --colour=auto'
+ alias fgrep='fgrep --colour=auto'
+else
+ if [[ ${EUID} == 0 ]] ; then
+ PS1+='\u@\h \W \$ '
+ else
+ PS1+='\u@\h \w \$ '
+ fi
+fi
+
+for sh in /etc/bash/bashrc.d/* ; do
+ [[ -r ${sh} ]] && source "${sh}"
+done
+
+unset use_color sh