|
|
|
@ -1,6 +1,6 @@
@@ -1,6 +1,6 @@
|
|
|
|
|
#!/bin/bash #################################################################### |
|
|
|
|
# |
|
|
|
|
# Изменён: Ср 29 июл 2020 11:55:43 |
|
|
|
|
# Изменён: Чт 30 июл 2020 18:23:04 |
|
|
|
|
# |
|
|
|
|
################################################################################ |
|
|
|
|
|
|
|
|
@ -183,19 +183,6 @@ else
@@ -183,19 +183,6 @@ else
|
|
|
|
|
#export HOME=$HOME |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
__ps1_git() { |
|
|
|
|
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/:\1/' |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
PS1_JOBS="${PROMPT_COLOR}┌─(${yellow}\j${PROMPT_COLOR})" |
|
|
|
|
PS1_HOST="─[${yellow}\h${PROMPT_COLOR}]${PROMPT_SHH}" |
|
|
|
|
PS1_GIT="${blue}$(__ps1_git)${PROMPT_COLOR}" |
|
|
|
|
PS1_LINE2="\n${PROMPT_COLOR}─[${PROMPT_COLOR}\t]\$ $rstc" |
|
|
|
|
|
|
|
|
|
export PS1="${PS1_JOBS}${PS1_HOST}─[${red}${VIFM_SHELL}${yellow}\w${PROMPT_COLOR}${magenta}\$(__ps1_git)${PROMPT_COLOR}]${PS1_LINE2}" |
|
|
|
|
|
|
|
|
|
unset PS1_JOBS PS1_HOST PS1_LINE1 PS1_LINE2 |
|
|
|
|
|
|
|
|
|
# }}} ########################################################################## |
|
|
|
|
# {{{ Подключение псевдонимов |
|
|
|
|
################################################################################ |
|
|
|
@ -223,7 +210,38 @@ esac
@@ -223,7 +210,38 @@ esac
|
|
|
|
|
# {{{ Настройка приглашения |
|
|
|
|
################################################################################ |
|
|
|
|
|
|
|
|
|
[ -n "$SSH_CLIENT" ] && PROMPT_SHH="[${red}ssh${PROMPT_COLOR}]" |
|
|
|
|
[ -n "$SSH_CLIENT" ] && PROMPT_SSH="[${red}ssh${PROMPT_COLOR}]" |
|
|
|
|
|
|
|
|
|
# |
|
|
|
|
# ┌─(0)─[hostname]─[~/path] |
|
|
|
|
# └─(I)─[17:50:40]$ |
|
|
|
|
# |
|
|
|
|
PROMPT_COMMAND='__prompt_command; history -a' |
|
|
|
|
|
|
|
|
|
__prompt_command() { |
|
|
|
|
local EXIT="$?" |
|
|
|
|
|
|
|
|
|
# ┌─(0)─[hostname]─[VIFM: ~/path:git-branch] |
|
|
|
|
# └─(I)─[17:50:40]$ |
|
|
|
|
|
|
|
|
|
local PS1_JOBS="${PROMPT_COLOR}┌─(${yellow}\j${PROMPT_COLOR})" |
|
|
|
|
local PS1_HOST="─[${yellow}\h${PROMPT_COLOR}]${PROMPT_SSH}" |
|
|
|
|
|
|
|
|
|
# Сокращение текущей директории. В отличие от PROMPT_DIRTRIM выводит две директории в начале пути |
|
|
|
|
local PS1_PWD=$(pwd | sed 's@'$HOME'@~@; s@^\(\([~/][^/]*\)\{2\}/\).*\(\(/[^/]*\)\{2\}\)$@\1...\3@') |
|
|
|
|
|
|
|
|
|
local PS1_GIT=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/:\1/') |
|
|
|
|
|
|
|
|
|
local PS1_PATH="─[${red}${VIFM_SHELL}${yellow}${PS1_PWD}${PROMPT_COLOR}${magenta}${PS1_GIT}${PROMPT_COLOR}]" |
|
|
|
|
|
|
|
|
|
PS1="${PS1_JOBS}${PS1_HOST}${PS1_PATH}\n${PROMPT_COLOR}─[${PROMPT_COLOR}\t]" |
|
|
|
|
|
|
|
|
|
if [ $EXIT != 0 ]; then |
|
|
|
|
PS1+="${red}\$ ${rstc}" |
|
|
|
|
else |
|
|
|
|
PS1+="${green}\$ ${rstc}" |
|
|
|
|
fi |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export PS2="$green-> $rstc" |
|
|
|
|
export PS3="$green+> $rstc" |
|
|
|
@ -231,15 +249,6 @@ export PS3="$green+> $rstc"
@@ -231,15 +249,6 @@ export PS3="$green+> $rstc"
|
|
|
|
|
# + filename.sh:00NN: function(): command |
|
|
|
|
export PS4='$(printf "+ \033[1;32m%s:\033[0;36m%04d: \033[1;35m%s\033[00m" $(basename $BASH_SOURCE) $LINENO ${FUNCNAME[0]:+${FUNCNAME[0]}():\ })' |
|
|
|
|
|
|
|
|
|
short_pwd() { |
|
|
|
|
# echo -en ' ' |
|
|
|
|
# pwd | sed 's@'$HOME'@~@; s@^\([~/][^/]*/\).*\(\(/[^/]*\)\{3\}\)$@\1\2@' |
|
|
|
|
pwd | sed 's@'$HOME'@~@; s@^\(\([~/][^/]*\)\{2\}/\).*\(\(/[^/]*\)\{2\}\)$@\1...\3@' |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# PROMPT_COMMAND="history -a; history -n;" |
|
|
|
|
PROMPT_COMMAND='history -a;echo -en "\033]0;$(short_pwd)\007"' |
|
|
|
|
|
|
|
|
|
export CDPATH=".:~/FILES:~/FILES/Projects:~/Downloads" |
|
|
|
|
export PROMPT_DIRTRIM=3 #В приглашении показывать 3 директории |
|
|
|
|
|
|
|
|
|