Skip to content

Instantly share code, notes, and snippets.

@delgh1
Last active July 20, 2023 17:05
Show Gist options
  • Save delgh1/33d882ce331ff5fee997cf8295738b2d to your computer and use it in GitHub Desktop.
Save delgh1/33d882ce331ff5fee997cf8295738b2d to your computer and use it in GitHub Desktop.
Ultimate custom Bash prompt for Arch
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias diff='diff --color=auto'
alias ip='ip -color=auto'
export LESS='-R --use-color -Dd+r$Du+b'
export MANPAGER="less -R --use-color -Dd+r -Du+b"
alias dmesg='dmesg --color=always'
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
export EDITOR=nano
export PAGER=less
export VISUAL=$EDITOR
# colored GCC warnings and errors
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
PS1='\[\e[0;38;5;34m\]\u\[\e[0;38;5;34m\]@\[\e[0;38;5;34m\]\h\[\e[0m\]:\[\e[0;38;5;33m\]\w \[\e[0m\]\$ \[\e[0m\]'
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# autocomplete sudo
#complete -cf sudo
# default
# PS1='[\u@\h \W]\$ '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment