Improve bash prompt
This commit is contained in:
parent
7db2381674
commit
88581f0da9
1 changed files with 18 additions and 5 deletions
23
bashrc
23
bashrc
|
@ -32,20 +32,33 @@ rlevel() {
|
|||
if [ -n "$RANGER_LEVEL" ]
|
||||
then if [ "$RANGER_LEVEL" = 1 ]
|
||||
then
|
||||
/bin/echo -ne "\033[00;31m● "
|
||||
/bin/echo -ne "\033[00;31m$1 "
|
||||
else
|
||||
/bin/echo -ne "\033[00;31m● $RANGER_LEVEL "
|
||||
/bin/echo -ne "\033[00;31m$1 $RANGER_LEVEL "
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
PS1normal='\[\033[00;34m\]┌─╼ $(rlevel)\[\033[01;35m\]\u\[\033[00;34m\]@\[\033[01;35m\]\h \[\033[00;33m\]\$ \[\033[01;35m\]\w \[\033[01;34m\]`find -mindepth 1 -maxdepth 1 -type d | wc -l`\[\033[00;34m\]d \[\033[01;32m\]`find -maxdepth 1 -type f | wc -l`\[\033[00;32m\]f\[\033[00m\] $(gitprompt)
|
||||
export PS1normal='\[\033[00;34m\]┌─╼ $(rlevel ●)\[\033[01;35m\]\u\[\033[00;34m\]@\[\033[01;35m\]\h \[\033[00;33m\]\$ \[\033[01;35m\]\w \[\033[01;34m\]`find -mindepth 1 -maxdepth 1 -type d | wc -l`\[\033[00;34m\]d \[\033[01;32m\]`find -maxdepth 1 -type f | wc -l`\[\033[00;32m\]f\[\033[00m\] $(gitprompt)
|
||||
\[\033[00;34m\]└╼ \[\033[00m\]'
|
||||
|
||||
PS1nogit='\[\033[00;34m\]┌─╼ $(rlevel)\[\033[01;35m\]\u\[\033[00;34m\]@\[\033[01;35m\]\h \[\033[00;33m\]\$ \[\033[01;35m\]\w \[\033[01;34m\]`find -mindepth 1 -maxdepth 1 -type d | wc -l`\[\033[00;34m\]d \[\033[01;32m\]`find -maxdepth 1 -type f | wc -l`\[\033[00;32m\]f\[\033[00m\]
|
||||
export PS1tiny='$(rlevel ↳)\[\033[00;37m\]$(dirs +0) \[\033[00;34m\]‣ \[\033[00m\]'
|
||||
|
||||
export PS1nogit='\[\033[00;34m\]┌─╼ $(rlevel)\[\033[01;35m\]\u\[\033[00;34m\]@\[\033[01;35m\]\h \[\033[00;33m\]\$ \[\033[01;35m\]\w \[\033[01;34m\]`find -mindepth 1 -maxdepth 1 -type d | wc -l`\[\033[00;34m\]d \[\033[01;32m\]`find -maxdepth 1 -type f | wc -l`\[\033[00;32m\]f\[\033[00m\]
|
||||
\[\033[00;34m\]└╼ \[\033[00m\]'
|
||||
|
||||
PS1=$PS1normal
|
||||
export PS1tinygit='$(rlevel ↳)\[\033[00;37m\]$(gitprompt || dirs +0) \[\033[00;34m\]‣ \[\033[00m\]'
|
||||
|
||||
prompt() {
|
||||
name=PS1$1
|
||||
if [ -z $1 ] || [ -z "${!name}" ]; then
|
||||
name=PS1normal
|
||||
fi
|
||||
export PS1set=$1
|
||||
PS1=${!name}
|
||||
}
|
||||
|
||||
prompt $PS1set
|
||||
|
||||
cd() {
|
||||
if [ -f .bashcdout ]
|
||||
|
|
Loading…
Reference in a new issue