39 lines
750 B
Bash
39 lines
750 B
Bash
#!/bin/bash
|
|
|
|
# if not interactive, don't do anything
|
|
[ -z "$PS1" ] && return
|
|
|
|
# some housekeeping
|
|
alias ls="ls --color=auto --group-directories-first"
|
|
|
|
function cd() {
|
|
builtin cd "$@" && ls --color=auto --group-directories-first
|
|
}
|
|
|
|
# history
|
|
HISTCONTROL=ignorespace:ignoredups:erasedups
|
|
HISTFILESIZE=9999999999
|
|
HISTSIZE=9999999999
|
|
|
|
# bash specific settings
|
|
set -o vi # vim mode
|
|
shopt -s autocd
|
|
shopt -s cmdhist
|
|
shopt -s histreedit
|
|
shopt -s histappend
|
|
shopt -s histverify
|
|
|
|
PS1="\w\$ "
|
|
|
|
if [ -n "$IN_NIX_SHELL" ]; then
|
|
NIX_SHELL_PS1="nix:"
|
|
fi
|
|
|
|
if [ "$USER" = "root" ]; then
|
|
USER_PREFIX="\[\033[41m\]root:\[\033[0;0m\]"
|
|
elif [ "$USER" != "usr" ]; then
|
|
USER_PREFIX="$USER:"
|
|
fi
|
|
|
|
PS1="$USER_PREFIX\[\033[36;1m\]${NIX_SHELL_PS1}arist:$PS1\[\033[0;0m\]"
|