Browse Source

bash: fix long commands

Maxim Likhachev 4 years ago
parent
commit
5baf413bf4
  1. 14
      etc/shell/bash/bashrc

14
etc/shell/bash/bashrc

@ -1,6 +1,6 @@
#!/bin/bash #################################################################### #!/bin/bash ####################################################################
# #
# Изменён: Пт 30 окт 2020 22:04:30 # Изменён: Ср 14 апр 2021 14:24:39
# #
################################################################################ ################################################################################
@ -225,22 +225,22 @@ __prompt_command() {
# ┌─(0)─[hostname]─[VIFM: ~/path:git-branch] # ┌─(0)─[hostname]─[VIFM: ~/path:git-branch]
# └─(I)─[17:50:40]$ # └─(I)─[17:50:40]$
local PS1_JOBS="${PROMPT_COLOR}┌─(${yellow}\j${PROMPT_COLOR})" local PS1_JOBS="\[${PROMPT_COLOR}\]┌─(\[${yellow}\]\j\[${PROMPT_COLOR}\])"
local PS1_HOST="─[${yellow}\h${PROMPT_COLOR}]${PROMPT_SSH}" local PS1_HOST="─[\[${yellow}\]\h\[${PROMPT_COLOR}\]]\[${PROMPT_SSH}\]"
# Сокращение текущей директории. В отличие от PROMPT_DIRTRIM выводит две директории в начале пути # Сокращение текущей директории. В отличие от PROMPT_DIRTRIM выводит две директории в начале пути
local PS1_PWD=$(pwd | sed 's@'$HOME'@~@; s@^\(\([~/][^/]*\)\{2\}/\).*\(\(/[^/]*\)\{2\}\)$@\1...\3@') 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_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}]" 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]" PS1="${PS1_JOBS}${PS1_HOST}${PS1_PATH}\n\[${PROMPT_COLOR}\]─[\[${PROMPT_COLOR}\]\t]"
if [ $EXIT != 0 ]; then if [ $EXIT != 0 ]; then
PS1+="${red}\\$ ${rstc}" PS1+="\[${red}\]\\$ \[${rstc}\]"
else else
PS1+="${green}\\$ ${rstc}" PS1+="\[${green}\]\\$ \[${rstc}\]"
fi fi
} }

Loading…
Cancel
Save