back to bash, keep the prompt though
This commit is contained in:
parent
67b3a84c85
commit
49c9cf0cae
42
bashrc
42
bashrc
@ -1,29 +1,29 @@
|
|||||||
|
|
||||||
exec fish
|
|
||||||
|
|
||||||
# Get ourselves a nice prompt
|
# Get ourselves a nice prompt
|
||||||
keep_status() {
|
ks() { s="$?" ; $* ; return "$s" ; }
|
||||||
s="$?"
|
prompt_gbranch() { git branch | sed -n 's/^\* (*\(.* \)*\([^ )]*\))*$/\2/p' ; }
|
||||||
$*
|
prompt_gbehind() { git status --branch --porcelain=2 | sed -n 's/^# branch\.ab.*-\([^0].*\)$/⇃\1/p' ; }
|
||||||
return "$s"
|
prompt_gbefore() { git status --branch --porcelain=2 | sed -n 's/^# branch\.ab +\([^0].*\) .*$/↿\1/p' ; }
|
||||||
}
|
prompt_gstatus() { git status --porcelain | sed 's/\(..\).*/\1/' | cat <(echo OK) - | tail -1 ; }
|
||||||
git_status() {
|
prompt_git() {
|
||||||
if git status 2>/dev/null 1>&2; then
|
if git status 2>/dev/null 1>&2; then
|
||||||
echo "$(git branch | grep \*)" \
|
echo " ($(prompt_gbranch)$(prompt_gbefore)$(prompt_gbehind)|$(prompt_gstatus))"
|
||||||
"$(git status --porcelain | cat <(echo OK) - | sed 's/\(..\).*/(\1)/' | tail -1)"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
exit_status() {
|
prompt_pwd() {
|
||||||
|
pwd | sed -e "s_${HOME}_~_" -e 's_\(/*.\)[^/]*/_\1/_g'
|
||||||
|
}
|
||||||
|
prompt_status() {
|
||||||
if [ "$?" = "0" ]
|
if [ "$?" = "0" ]
|
||||||
then echo " $"
|
then echo " $"
|
||||||
else echo " %"
|
else echo " %"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
RED="$(tput setaf 1)"
|
BOLD="\[$(tput bold)\]"
|
||||||
GREEN="$(tput setaf 2)"
|
GREEN="\[$(tput setaf 2)\]"
|
||||||
RESET="$(tput sgr0)"
|
RESET="\[$(tput sgr0)\]"
|
||||||
PS1="[\T] $RED\u@\h$RESET $GREEN\w$RESET \$(keep_status git_status)\n \$(exit_status) "
|
PS1="$BOLD[\T]$RESET $GREEN\$(ks prompt_pwd)$RESET\$(ks prompt_git)\$(prompt_status) "
|
||||||
unset RED
|
unset BOLD
|
||||||
unset GREEN
|
unset GREEN
|
||||||
unset RESET
|
unset RESET
|
||||||
|
|
||||||
@ -46,13 +46,11 @@ alias nano="nvim"
|
|||||||
# Ready for ssh'ing
|
# Ready for ssh'ing
|
||||||
alias agent='eval "$(ssh-agent)" && ssh-add'
|
alias agent='eval "$(ssh-agent)" && ssh-add'
|
||||||
|
|
||||||
# Cloning my terminal
|
|
||||||
alias terminal='st'
|
|
||||||
alias copy='terminal'
|
|
||||||
|
|
||||||
# FZF
|
# FZF
|
||||||
function go() {
|
go() {
|
||||||
dir="$(lr /home /data /etc -L -t '(name ~~ "\.*" && prune || print) && type = d && !(name = ".git")' | fzf)"
|
dir="$(lr /home /data /etc -L -t '(name ~~ ".*" && prune || print) && type = d && !(name = ".git")' \
|
||||||
|
| fzf --height 10 \
|
||||||
|
)"
|
||||||
[ -n "$dir" ] && cd "$dir" || false
|
[ -n "$dir" ] && cd "$dir" || false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user