Cleanup and restructure

This commit is contained in:
Eriks Karls 2022-11-09 11:50:51 +02:00
parent c353a0b9bb
commit 15af55e802
2 changed files with 14 additions and 19 deletions

View File

@ -2,4 +2,4 @@
# ~/.bash_profile # ~/.bash_profile
# #
[[ -f ~/.bashrc ]] && . ~/.bashrc [[ -r ~/.bashrc ]] && . ~/.bashrc

31
.bashrc
View File

@ -4,7 +4,6 @@
[[ $- != *i* ]] && return [[ $- != *i* ]] && return
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
# Bash won't get SIGWINCH if another process is in the foreground. # Bash won't get SIGWINCH if another process is in the foreground.
# Enable checkwinsize so that bash will check the terminal size when # Enable checkwinsize so that bash will check the terminal size when
# it regains control. #65623 # it regains control. #65623
@ -12,8 +11,6 @@
shopt -s checkwinsize shopt -s checkwinsize
shopt -s expand_aliases shopt -s expand_aliases
# export QT_SELECT=4
# Enable history appending instead of overwriting. #139609 # Enable history appending instead of overwriting. #139609
shopt -s histappend shopt -s histappend
HISTCONTROL=ignoreboth HISTCONTROL=ignoreboth
@ -32,6 +29,15 @@ esac
use_color=true use_color=true
# Enable colors for ls, etc. Prefer ~/.dir_colors #64489
if type -P dircolors >/dev/null ; then
if [[ -f ~/.dir_colors ]] ; then
eval $(dircolors -b ~/.dir_colors)
elif [[ -f /etc/DIR_COLORS ]] ; then
eval $(dircolors -b /etc/DIR_COLORS)
fi
fi
# Set colorful PS1 only on colorful terminals. # Set colorful PS1 only on colorful terminals.
# dircolors --print-database uses its own built-in database # dircolors --print-database uses its own built-in database
# instead of using /etc/DIR_COLORS. Try to use the external file # instead of using /etc/DIR_COLORS. Try to use the external file
@ -96,14 +102,6 @@ if ${use_color} ; then
Reset='\[\033[0m\]' Reset='\[\033[0m\]'
Bold='\[\033[1m\]' Bold='\[\033[1m\]'
Invert='\[\033[7m\]' Invert='\[\033[7m\]'
# Enable colors for ls, etc. Prefer ~/.dir_colors #64489
if type -P dircolors >/dev/null ; then
if [[ -f ~/.dir_colors ]] ; then
eval $(dircolors -b ~/.dir_colors)
elif [[ -f /etc/DIR_COLORS ]] ; then
eval $(dircolors -b /etc/DIR_COLORS)
fi
fi
TimeColour=$LghtYlw TimeColour=$LghtYlw
HostColour="\[$(get_hostname_colour)\]" HostColour="\[$(get_hostname_colour)\]"
if [[ ${EUID} == 0 ]]; then if [[ ${EUID} == 0 ]]; then
@ -114,19 +112,16 @@ if ${use_color} ; then
CDirColour=$DarkGrn CDirColour=$DarkGrn
PS1="$TimeColour[\t] $Bold$UserColour\u${HostColour}@\h $Reset$CDirColour\$PWD$Reset $Bold\n$UserColour\\$ ${Reset}" PS1="$TimeColour[\t] $Bold$UserColour\u${HostColour}@\h $Reset$CDirColour\$PWD$Reset $Bold\n$UserColour\\$ ${Reset}"
else else
if [[ ${EUID} == 0 ]] ; then PS1='\u@\h \W \$ '
# show root@ when we don't have colors
PS1='\u@\h \W \$ '
else
PS1='\u@\h \w \$ '
fi
fi fi
unset use_color safe_term match_lhs sh unset use_color safe_term match_lhs sh
xhost +local:root > /dev/null 2>&1 xhost +local:root > /dev/null 2>&1
# export QT_SELECT=4
export PATH=$PATH:~/.local/bin:~/bin export PATH=$PATH:~/.local/bin:~/bin
export EDITOR=vim export EDITOR=vim
[[ -f ~/.bash_aliases ]] && . ~/.bash_aliases [[ -r ~/.bash_aliases ]] && . ~/.bash_aliases
[[ -r /usr/share/bash-completion/bash_completion ]] && . /usr/share/bash-completion/bash_completion