shell: update ps1
This commit is contained in:
@@ -12,11 +12,7 @@ esac
|
||||
git_branch() {
|
||||
if $(git rev-parse --git-dir > /dev/null 2>&1); then
|
||||
local branch_name=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
|
||||
if [[ $(uname) == "OpenBSD" ]]; then
|
||||
echo "(${branch_name}) "
|
||||
else
|
||||
echo "(${branch_name} ) "
|
||||
fi
|
||||
echo "${branch_name} "
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -34,26 +30,21 @@ NEWLINE=$'\n'
|
||||
PROMPT_COMMAND=__prompt_command
|
||||
__prompt_command() {
|
||||
local EXIT="$?"
|
||||
|
||||
# Shorten $PWD, if it's too long
|
||||
if [ $COLUMNS -lt 80 ]; then
|
||||
export PROMPT_DIRTRIM=1
|
||||
else
|
||||
export PROMPT_DIRTRIM=0
|
||||
fi
|
||||
export PS1="${HOST} ${DIR} ${GIT_NIX}${NEWLINE}"
|
||||
|
||||
if [[ $(uname) == "OpenBSD" ]]; then
|
||||
local red_lambda='\[\033[0;31m\]>\[\033[00m\] '
|
||||
local green_lambda='\[\033[0;32m\]>\[\033[00m\] '
|
||||
else
|
||||
local red_lambda='\[\033[0;31m\]\[\033[00m\] '
|
||||
local green_lambda='\[\033[0;32m\]\[\033[00m\] '
|
||||
fi
|
||||
export PS1="${HOST} ${DIR} ${GIT_NIX}${NEWLINE}"
|
||||
|
||||
if [ $EXIT != 0 ]
|
||||
then
|
||||
PS1+=$red_lambda
|
||||
PS1+='\[\033[0;31m\]$\[\033[00m\] '
|
||||
else
|
||||
PS1+=$green_lambda
|
||||
PS1+='\[\033[0;32m\]$\[\033[00m\] '
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ alias dh1='du . -h -d1'
|
||||
alias dhs='du . -hs'
|
||||
alias diff_dir='diff -qr'
|
||||
alias g='git'
|
||||
alias l='eza --icons --hyperlink'
|
||||
alias l='ls --color --hyperlink'
|
||||
alias nd="nix develop ."
|
||||
alias nssh='SSH_AUTH_SOCK= ssh'
|
||||
alias s='kitten ssh'
|
||||
@@ -57,7 +57,7 @@ ocr() {
|
||||
return
|
||||
fi
|
||||
name=${file%%.*}
|
||||
ocrmypdf -l ger+eng --output-type pdf $file ${name}.ocr.pdf
|
||||
ocrmypdf -l deu+eng --output-type pdf $file ${name}.ocr.pdf
|
||||
}
|
||||
|
||||
# private laptop acpi magic
|
||||
|
||||
Reference in New Issue
Block a user