Skip to content

Instantly share code, notes, and snippets.

@qexat
Created September 13, 2023 13:14
Show Gist options
  • Select an option

  • Save qexat/cf63bf9e95126b702dc41f859094db2f to your computer and use it in GitHub Desktop.

Select an option

Save qexat/cf63bf9e95126b702dc41f859094db2f to your computer and use it in GitHub Desktop.
My .bashrc when I'm not using `fish`
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
[[ -f ~/.welcome_screen ]] && . ~/.welcome_screen
_set_liveuser_PS1() {
_line1_right="$(date +"%T")"
PS1='\n ╭─ \e[97m\u\e[39m@\h \e[2m·\e[22m \e[32m\w\e[39m$(printf "%*.*s\n" $(($(tput cols) - $(expr length " ╭─ ${USERNAME}@(hostname -s) · $(sed "s/\/home\/clarisse/\~/" <<< "$PWD")") + ${#_line1_right})) $(($(tput cols) - $(expr length " ╭─ ${USERNAME}@(hostname -s) · $(sed "s/\/home\/clarisse/\~/" <<< "$PWD")") + ${#_line1_right})) "\e[96m$(date +"%T")\e[39m")\n │\n ╰─ \e[3$((2 - $(("$?" != 0))))m$\e[39m '
if [ "$(whoami)" = "liveuser" ] ; then
local iso_version="$(grep ^VERSION= /usr/lib/endeavouros-release 2>/dev/null | cut -d '=' -f 2)"
if [ -n "$iso_version" ] ; then
local prefix="eos-"
local iso_info="$prefix$iso_version"
PS1="[\u@$iso_info \W]\$ "
fi
fi
}
_set_liveuser_PS1
unset -f _set_liveuser_PS1
ShowInstallerIsoInfo() {
local file=/usr/lib/endeavouros-release
if [ -r $file ] ; then
cat $file
else
echo "Sorry, installer ISO info is not available." >&2
fi
}
alias ls='ls --color=auto'
alias ll='ls -lav --ignore=..' # show long listing of all except ".."
alias l='ls -lav --ignore=.?*' # show long listing but no hidden dotfiles except "."
[[ "$(whoami)" = "root" ]] && return
[[ -z "$FUNCNEST" ]] && export FUNCNEST=100 # limits recursive functions, see 'man bash'
## Use the up and down arrow keys for finding a command in history
## (you can write some initial letters of the command first).
bind '"\e[A":history-search-backward'
bind '"\e[B":history-search-forward'
################################################################################
## Some generally useful functions.
## Consider uncommenting aliases below to start using these functions.
##
## October 2021: removed many obsolete functions. If you still need them, please look at
## https://github.com/EndeavourOS-archive/EndeavourOS-archiso/raw/master/airootfs/etc/skel/.bashrc
_open_files_for_editing() {
# Open any given document file(s) for editing (or just viewing).
# Note1:
# - Do not use for executable files!
# Note2:
# - Uses 'mime' bindings, so you may need to use
# e.g. a file manager to make proper file bindings.
if [ -x /usr/bin/exo-open ] ; then
echo "exo-open $@" >&2
setsid exo-open "$@" >& /dev/null
return
fi
if [ -x /usr/bin/xdg-open ] ; then
for file in "$@" ; do
echo "xdg-open $file" >&2
setsid xdg-open "$file" >& /dev/null
done
return
fi
echo "$FUNCNAME: package 'xdg-utils' or 'exo' is required." >&2
}
#------------------------------------------------------------
## Aliases for the functions above.
## Uncomment an alias if you want to use it.
##
# alias ef='_open_files_for_editing' # 'ef' opens given file(s) for editing
# alias pacdiff=eos-pacdiff
################################################################################
if [ -f "$HOME/.local/share/shellutils/path.sh" ]; then
. "/home/clarisse/.local/share/shellutils/path.sh"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment