Merge branch 'master' of https://github.com/bash-it/bash-it into ira/autosave-history-plml

* 'master' of https://github.com/bash-it/bash-it: (114 commits)
  ci: Bump go to 1.17 from 1.14
  skip go tests when go is not available
  plugins: Add ble.sh plugin
  clean up pyenv plugin
  Lint: prepare `lib/utilities` for `shellcheck` (#1933)
  plugin/base: improvements (#1930)
  plugins/percol: `bind`
  completion/git: `shfmt` && `shellcheck`
  completion/git: expand search range
  plugin/percol: `shellcheck` & `shfmt`
  plugins/percol: use `_command_exists`
  completion/pip: simplify code flow
  plugin/less-pretty-cat: remove `|| cat`
  completion/wpscan: simplify code flow (whitespace)
  plugins/less-pretty-cat: simplify code flow
  plugins/less-pretty-cat: use `_command_exists`
  lib/helpers: cite `_bash-it-find-in-ancestor()`
  gradle: adopt `_bash_it_find_in_ancestor()`
  lib/helpers: new function `_bash-it-find-in-ancestor()`
  completion/laravel: simplify code flow
  ...
This commit is contained in:
Ira Abramov
2021-10-11 08:32:15 +03:00
134 changed files with 1174 additions and 1001 deletions

View File

@@ -1,4 +1,7 @@
# shellcheck shell=bash
# shellcheck disable=SC2034 # Expected behavior for themes.
# shellcheck disable=SC2154 #TODO: fix these all.
SCM_THEME_PROMPT_DIRTY=" ${red}"
SCM_THEME_PROMPT_CLEAN=" ${bold_green}"
SCM_THEME_PROMPT_PREFIX=" |"
@@ -11,7 +14,7 @@ GIT_THEME_PROMPT_SUFFIX="${green}|"
# Nicely formatted terminal prompt
function prompt_command() {
export PS1="\n${bold_black}[${blue}\@${bold_black}]-${bold_black}[${green}\u${yellow}@${green}\h${bold_black}]-${bold_black}[${purple}\w${bold_black}]-$(scm_prompt_info)\n${reset_color}\$ "
PS1="\n${bold_black}[${blue}\@${bold_black}]-${bold_black}[${green}\u${yellow}@${green}\h${bold_black}]-${bold_black}[${purple}\w${bold_black}]-$(scm_prompt_info)\n${reset_color}\$ "
}
safe_append_prompt_command prompt_command

View File

@@ -1,4 +1,5 @@
# shellcheck shell=bash
# shellcheck disable=SC2034 # Expected behavior for themes.
# vim: ft=bash ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
@@ -220,7 +221,7 @@ prompt_virtualenv() {
# Context: user@hostname (who am I and where am I)
prompt_context() {
local user=$(whoami)
local user="${USER:-${LOGNAME:?}}"
if [[ $user != "$DEFAULT_USER" || -n $SSH_CLIENT ]]; then
prompt_segment black default "$user@\h"

View File

@@ -1,4 +1,6 @@
# shellcheck shell=bash
# shellcheck disable=SC2034 # Expected behavior for themes.
# shellcheck disable=SC2154 #TODO: fix these all.
# Atomic Bash Prompt for Bash-it
# By lfelipe base on the theme brainy of MunifTanjim

View File

@@ -1,4 +1,6 @@
# shellcheck shell=bash
# shellcheck disable=SC2034 # Expected behavior for themes.
# shellcheck disable=SC2154 #TODO: fix these all.
SCM_THEME_PROMPT_DIRTY=" ${red}"
SCM_THEME_PROMPT_CLEAN=" ${bold_green}"

View File

@@ -1,4 +1,6 @@
# shellcheck shell=bash
# shellcheck disable=SC2034 # Expected behavior for themes.
# shellcheck disable=SC2154 #TODO: fix these all.
# Theme custom glyphs
SCM_GIT_CHAR_GITLAB=${BARBUK_GITLAB_CHAR:=' '}

View File

@@ -1,4 +1,5 @@
# shellcheck shell=bash
# shellcheck disable=SC2034 # Expected behavior for themes.
CLOCK_CHAR_THEME_PROMPT_PREFIX=''
CLOCK_CHAR_THEME_PROMPT_SUFFIX=''
@@ -85,42 +86,61 @@ RBENV_THEME_PROMPT_SUFFIX='|'
RBFU_THEME_PROMPT_PREFIX=' |'
RBFU_THEME_PROMPT_SUFFIX='|'
GIT_EXE=$(which git 2> /dev/null || true)
P4_EXE=$(which p4 2> /dev/null || true)
HG_EXE=$(which hg 2> /dev/null || true)
SVN_EXE=$(which svn 2> /dev/null || true)
: "${GIT_EXE:=$SCM_GIT}"
: "${P4_EXE:=$SCM_P4}"
: "${HG_EXE:=$SCM_HG}"
: "${SVN_EXE:=$SCM_SVN}"
# Check for broken SVN exe that is caused by some versions of Xcode.
# See https://github.com/Bash-it/bash-it/issues/1612 for more details.
if [[ -x "$SVN_EXE" ]]; then
if ! "$SVN_EXE" --version > /dev/null 2>&1; then
# Unset the SVN exe variable so that SVN commands are avoided.
SVN_EXE=""
function _bash_it_appearance_scm_init() {
GIT_EXE="$(type -P $SCM_GIT || true)"
P4_EXE="$(type -P $SCM_P4 || true)"
HG_EXE="$(type -P $SCM_HG || true)"
SVN_EXE="$(type -P $SCM_SVN || true)"
# Check for broken SVN exe that is caused by some versions of Xcode.
# See https://github.com/Bash-it/bash-it/issues/1612 for more details.
if [[ -x "$SVN_EXE" && -x "${SVN_EXE%/*}/xcrun" ]]; then
if ! "$SVN_EXE" --version > /dev/null 2>&1; then
# Unset the SVN exe variable so that SVN commands are avoided.
SVN_EXE=""
fi
fi
fi
}
_bash_it_appearance_scm_init
function scm {
if [[ "$SCM_CHECK" = false ]]; then
SCM=$SCM_NONE
elif [[ -f .git/HEAD ]] && [[ -x "$GIT_EXE" ]]; then
SCM=$SCM_GIT
elif [[ -x "$GIT_EXE" ]] && [[ -n "$(git rev-parse --is-inside-work-tree 2> /dev/null)" ]]; then
SCM=$SCM_GIT
elif [[ -x "$P4_EXE" ]] && [[ -n "$(p4 set P4CLIENT 2> /dev/null)" ]]; then
SCM=$SCM_P4
elif [[ -d .hg ]] && [[ -x "$HG_EXE" ]]; then
SCM=$SCM_HG
elif [[ -x "$HG_EXE" ]] && [[ -n "$(hg root 2> /dev/null)" ]]; then
SCM=$SCM_HG
elif [[ -d .svn ]] && [[ -x "$SVN_EXE" ]]; then
SCM=$SCM_SVN
elif [[ -x "$GIT_EXE" ]] && [[ -n "$(git rev-parse --is-inside-work-tree 2> /dev/null)" ]]; then
SCM=$SCM_GIT
elif [[ -x "$HG_EXE" ]] && [[ -n "$(hg root 2> /dev/null)" ]]; then
SCM=$SCM_HG
elif [[ -x "$SVN_EXE" ]] && [[ -n "$(svn info --show-item wc-root 2> /dev/null)" ]]; then
SCM=$SCM_SVN
elif [[ -x "$P4_EXE" ]] && [[ -n "$(p4 set P4CLIENT 2> /dev/null)" ]]; then
SCM=$SCM_P4
else
SCM=$SCM_NONE
fi
}
scm_prompt() {
local CHAR
CHAR="$(scm_char)"
local format=${SCM_PROMPT_FORMAT:-'[%s%s]'}
if [[ "${CHAR}" != "$SCM_NONE_CHAR" ]]; then
# shellcheck disable=2059
printf "$format\n" "$CHAR" "$(scm_prompt_info)"
fi
}
function scm_prompt_char {
if [[ -z $SCM ]]; then scm; fi
if [[ $SCM == "$SCM_GIT" ]]; then
@@ -332,15 +352,15 @@ function svn_prompt_vars {
# - .hg is located in ~/Projects/Foo/.hg
# - get_hg_root starts at ~/Projects/Foo/Bar and sees that there is no .hg directory, so then it goes into ~/Projects/Foo
function get_hg_root {
local CURRENT_DIR=$(pwd)
local CURRENT_DIR="${PWD}"
while [ "$CURRENT_DIR" != "/" ]; do
if [ -d "$CURRENT_DIR/.hg" ]; then
while [[ "${CURRENT_DIR:-/}" != "/" ]]; do
if [[ -d "$CURRENT_DIR/.hg" ]]; then
echo "$CURRENT_DIR/.hg"
return
fi
CURRENT_DIR=$(dirname "$CURRENT_DIR")
CURRENT_DIR="${CURRENT_DIR%/*}"
done
}
@@ -376,7 +396,7 @@ function hg_prompt_vars {
function nvm_version_prompt {
local node
if declare -f -F nvm &> /dev/null; then
if _is_function nvm; then
node=$(nvm current 2> /dev/null)
[[ "${node}" == "system" ]] && return
echo -e "${NVM_THEME_PROMPT_PREFIX}${node}${NVM_THEME_PROMPT_SUFFIX}"
@@ -413,8 +433,8 @@ function rbfu_version_prompt {
}
function chruby_version_prompt {
if declare -f -F chruby &> /dev/null; then
if declare -f -F chruby_auto &> /dev/null; then
if _is_function chruby; then
if _is_function chruby_auto; then
chruby_auto
fi
@@ -437,6 +457,10 @@ function k8s_context_prompt {
echo -e "$(kubectl config current-context 2> /dev/null)"
}
function k8s_namespace_prompt {
echo -e "$(kubectl config view --minify --output 'jsonpath={..namespace}' 2> /dev/null)"
}
function virtualenv_prompt {
if [[ -n "$VIRTUAL_ENV" ]]; then
virtualenv=$(basename "$VIRTUAL_ENV")
@@ -528,7 +552,7 @@ function prompt_char {
function battery_char {
if [[ "${THEME_BATTERY_PERCENTAGE_CHECK}" = true ]]; then
echo -e "${bold_red}$(battery_percentage)%"
echo -e "${bold_red:-}$(battery_percentage)%"
fi
}
@@ -570,7 +594,7 @@ function __check_precmd_conflict() {
function safe_append_prompt_command {
local prompt_re
if [ "${__bp_imported}" == "defined" ]; then
if [ "${__bp_imported:-missing}" == "defined" ]; then
# We are using bash-preexec
if ! __check_precmd_conflict "${1}"; then
precmd_functions+=("${1}")
@@ -585,7 +609,7 @@ function safe_append_prompt_command {
prompt_re="\<${1}\>"
fi
if [[ ${PROMPT_COMMAND} =~ ${prompt_re} ]]; then
if [[ ${PROMPT_COMMAND[*]:-} =~ ${prompt_re} ]]; then
return
elif [[ -z ${PROMPT_COMMAND} ]]; then
PROMPT_COMMAND="${1}"

View File

@@ -1,4 +1,6 @@
# shellcheck shell=bash
# shellcheck disable=SC2034 # Expected behavior for themes.
# shellcheck disable=SC2154 #TODO: fix these all.
# Detect whether a reboot is required
function show_reboot_required() {
@@ -31,15 +33,6 @@ function set_user_color() {
esac
}
scm_prompt() {
CHAR=$(scm_char)
if [ "$CHAR" = "$SCM_NONE_CHAR" ]; then
return
else
echo "[$(scm_char)$(scm_prompt_info)]"
fi
}
# Define custom colors we need
# non-printable bytes in PS1 need to be contained within \[ \].
# Otherwise, bash will count them in the length of the prompt

View File

@@ -1,4 +1,6 @@
# shellcheck shell=bash
# shellcheck disable=SC2034 # Expected behavior for themes.
# shellcheck disable=SC2154 #TODO: fix these all.
SCM_THEME_PROMPT_PREFIX=" ${yellow}"
SCM_THEME_PROMPT_SUFFIX="${reset_color}"

View File

@@ -1,4 +1,6 @@
# shellcheck shell=bash
# shellcheck disable=SC2034 # Expected behavior for themes.
# shellcheck disable=SC2154 #TODO: fix these all.
SCM_THEME_PROMPT_DIRTY=" ${red}"
SCM_THEME_PROMPT_CLEAN=" ${bold_green}"

View File

@@ -1,4 +1,6 @@
# shellcheck shell=bash
# shellcheck disable=SC2034 # Expected behavior for themes.
# shellcheck disable=SC2154 #TODO: fix these all.
SCM_THEME_PROMPT_DIRTY=" ${red}"
SCM_THEME_PROMPT_CLEAN=" ${bold_green}"

View File

@@ -1,4 +1,6 @@
# shellcheck shell=bash
# shellcheck disable=SC2034 # Expected behavior for themes.
# shellcheck disable=SC2154 #TODO: fix these all.
# Brainy Bash Prompt for Bash-it
# by MunifTanjim

View File

@@ -1,4 +1,6 @@
# shellcheck shell=bash
# shellcheck disable=SC2034 # Expected behavior for themes.
# shellcheck disable=SC2154 #TODO: fix these all.
SCM_THEME_PROMPT_PREFIX=""
SCM_THEME_PROMPT_SUFFIX=""
@@ -15,16 +17,8 @@ is_vim_shell() {
fi
}
scm_prompt() {
CHAR=$(scm_char)
if [ "$CHAR" = "$SCM_NONE_CHAR" ]; then
return
else
echo " $(scm_char) (${white}$(scm_prompt_info)${normal})"
fi
}
prompt() {
SCM_PROMPT_FORMAT=' %s (%s)'
PS1="${white}${background_blue} \u${normal}${background_blue}@${red}${background_blue}\h $(clock_prompt) ${reset_color}${normal} $(battery_charge)\n${bold_black}${background_white} \w ${normal}$(scm_prompt)$(is_vim_shell)\n${white}>${normal} "
}

View File

@@ -1,4 +1,6 @@
# shellcheck shell=bash
# shellcheck disable=SC2034 # Expected behavior for themes.
# shellcheck disable=SC2154 #TODO: fix these all.
function prompt_command() {
PS1="${green}\u@\h $(clock_prompt) ${reset_color}${white}\w${reset_color}$(scm_prompt_info)${blue}${bold_blue} ${reset_color} ${normal}"

View File

@@ -1,18 +1,10 @@
# shellcheck shell=bash
SCM_THEME_PROMPT_PREFIX=${SCM_THEME_PROMPT_SUFFIX}
SCM_THEME_PROMPT_DIRTY="${bold_red}${normal}"
SCM_THEME_PROMPT_CLEAN="${bold_green}${normal}"
SCM_GIT_CHAR="${green}±${normal}"
scm_prompt() {
CHAR=$(scm_char)
if [ $CHAR = $SCM_NONE_CHAR ]
then
return
else
echo " [$(scm_char)$(scm_prompt_info)]"
fi
}
mark_prompt() {
echo "${green}\$${normal}"
}
@@ -25,14 +17,9 @@ user_host_path_prompt() {
}
prompt() {
SCM_PROMPT_FORMAT=' [%s%s]'
PS1="$(user_host_path_prompt)$(virtualenv_prompt)$(scm_prompt) $(mark_prompt) "
}
share_history() {
history -a
history -c
history -r
}
safe_append_prompt_command share_history
safe_append_prompt_command '_save-and-reload-history 1'
safe_append_prompt_command prompt

View File

@@ -1,4 +1,6 @@
#!/usr/bin/env bash
# shellcheck shell=bash
# shellcheck disable=SC2005
# shellcheck disable=SC2034
function __ {
echo "$@"

View File

@@ -98,7 +98,7 @@ prompt() {
local MOVE_CURSOR_RIGHTMOST='\033[500C'
local MOVE_CURSOR_5_LEFT='\033[5D'
if [ $(uname) = "Linux" ];
if [[ "$OSTYPE" = 'linux'* ]]
then
PS1="${TITLEBAR}${SAVE_CURSOR}${MOVE_CURSOR_RIGHTMOST}${MOVE_CURSOR_5_LEFT}
$(safe_battery_charge)${RESTORE_CURSOR}\

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env bash
# shellcheck shell=bash
SCM_THEME_PROMPT_DIRTY=''
SCM_THEME_PROMPT_CLEAN=''
@@ -28,45 +28,14 @@ else
THEME_PROMPT_HOST_COLOR="$blue"
fi
doubletime_scm_prompt() {
CHAR=$(scm_char)
if [ $CHAR = $SCM_NONE_CHAR ]; then
return
elif [ $CHAR = $SCM_GIT_CHAR ]; then
echo "$(git_prompt_status)"
else
echo "[$(scm_prompt_info)]"
fi
}
function prompt_setter() {
# Save history
history -a
history -c
history -r
_save-and-reload-history 1
PS1="
$(clock_prompt) $(scm_char) [${THEME_PROMPT_HOST_COLOR}\u@${THEME_PROMPT_HOST}$reset_color] $(virtualenv_prompt)$(ruby_version_prompt)\w
$(doubletime_scm_prompt)$reset_color $ "
$(scm_prompt)$reset_color $ "
PS2='> '
PS4='+ '
}
safe_append_prompt_command prompt_setter
git_prompt_status() {
local git_status_output
git_status_output=$(git status 2> /dev/null )
if [ -n "$(echo $git_status_output | grep 'Changes not staged')" ]; then
git_status="${bold_red}$(scm_prompt_info)"
elif [ -n "$(echo $git_status_output | grep 'Changes to be committed')" ]; then
git_status="${bold_yellow}$(scm_prompt_info) ^"
elif [ -n "$(echo $git_status_output | grep 'Untracked files')" ]; then
git_status="${bold_cyan}$(scm_prompt_info) +"
elif [ -n "$(echo $git_status_output | grep 'nothing to commit')" ]; then
git_status="${bold_green}$(scm_prompt_info) ${green}"
else
git_status="$(scm_prompt_info)"
fi
echo "[$git_status${normal}]"
}

View File

@@ -1,12 +1,10 @@
#!/usr/bin/env bash
# shellcheck shell=bash
source "$BASH_IT/themes/doubletime/doubletime.theme.bash"
function prompt_setter() {
# Save history
history -a
history -c
history -r
_save-and-reload-history 1
PS1="
$(clock_prompt) $(scm_char) [$THEME_PROMPT_HOST_COLOR\u@${THEME_PROMPT_HOST}$reset_color] $(virtualenv_prompt)$(ruby_version_prompt)
\w

View File

@@ -1,12 +1,10 @@
#!/usr/bin/env bash
# shellcheck shell=bash
source "$BASH_IT/themes/doubletime/doubletime.theme.bash"
function prompt_setter() {
# Save history
history -a
history -c
history -r
_save-and-reload-history 1
PS1="
$(clock_prompt) $(scm_char) [$THEME_PROMPT_HOST_COLOR\u@${THEME_PROMPT_HOST}$reset_color] $(virtualenv_prompt)
\w

2
themes/dulcie/dulcie.theme.bash Normal file → Executable file
View File

@@ -77,7 +77,7 @@ dulcie_prompt() {
printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/\~}"
# Open the new terminal in the same directory
declare -f __vte_osc7 > /dev/null && __vte_osc7
_is_function __vte_osc7 && __vte_osc7
PS1="${reset_color}[${DULCIE_USER}@${DULCIE_HOST}$(scm_prompt_info)${reset_color} ${DULCIE_WORKINGDIR}]"
if [[ "${DULCIE_MULTILINE}" -eq "1" ]]; then

View File

@@ -1,4 +1,6 @@
# shellcheck shell=bash
# shellcheck disable=SC2034 # Expected behavior for themes.
# shellcheck disable=SC2154 #TODO: fix these all.
SCM_THEME_PROMPT_PREFIX="${bold_green}[ ${normal}"
SCM_THEME_PROMPT_SUFFIX="${bold_green} ] "

View File

@@ -4,26 +4,18 @@ SCM_THEME_PROMPT_SUFFIX=")${normal}"
SCM_THEME_PROMPT_DIRTY="*"
SCM_THEME_PROMPT_CLEAN=""
SCM_GIT_CHAR="g"
SCM_SVN_CHAR="s"
SCM_HG_CHAR="h"
SCM_GIT_CHAR="${green}±${normal}"
SCM_SVN_CHAR="${bold_cyan}${normal}"
SCM_HG_CHAR="${bold_red}${normal}"
### TODO: openSUSE has already colors enabled, check if those differs from stock
# LS colors, made with http://geoff.greer.fm/lscolors/
# export LSCOLORS="Gxfxcxdxbxegedabagacad"
# export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:'
scm_prompt() {
CHAR=$(scm_char)
if [ $CHAR = $SCM_NONE_CHAR ]
then
return
else
echo "$(scm_prompt_info) "
fi
}
gallifrey_prompt() {
SCM_PROMPT_FORMAT='%s%s'
pure_prompt() {
ps_host="${green}\h${normal}";
ps_user_mark="${bold}\$${normal}";
ps_root_mark="${normal}§"
@@ -38,4 +30,4 @@ pure_prompt() {
esac
}
safe_append_prompt_command pure_prompt
safe_append_prompt_command gallifrey_prompt

0
themes/liquidprompt/liquidprompt.theme.bash Executable file → Normal file
View File

View File

@@ -69,16 +69,6 @@ is_vim_shell() {
fi
}
modern_scm_prompt() {
CHAR=$(scm_char)
if [ $CHAR = $SCM_NONE_CHAR ]
then
return
else
echo "[$(scm_char)][$GREEN$(scm_prompt_info)]"
fi
}
# show chroot if exist
chroot(){
if [ -n "$debian_chroot" ]
@@ -99,7 +89,7 @@ my_ve(){
}
prompt() {
SCM_PROMPT_FORMAT="[%s$GREEN%s]"
my_ps_host="$BOLD$ORANGE\h${normal}";
# yes, these are the the same for now ...
my_ps_host_root="$ORANGE\h${normal}";
@@ -114,10 +104,10 @@ prompt() {
# nice prompt
case "`id -u`" in
0) PS1="\n${TITLEBAR}${BRACKET_COLOR}┌─${normal}$(my_ve)$(chroot)[$my_ps_root][$my_ps_host_root]$(modern_scm_prompt)$(__my_rvm_ruby_version)[${green}\w${normal}]$(is_vim_shell)${BRACKET_COLOR}
0) PS1="\n${TITLEBAR}${BRACKET_COLOR}┌─${normal}$(my_ve)$(chroot)[$my_ps_root][$my_ps_host_root]$(scm_prompt)$(__my_rvm_ruby_version)[${green}\w${normal}]$(is_vim_shell)${BRACKET_COLOR}
└─▪ ${prompt_symbol} ${normal}"
;;
*) PS1="\n${TITLEBAR}${BRACKET_COLOR}┌─${normal}$(my_ve)$(chroot)[$my_ps_user][$my_ps_host]$(modern_scm_prompt)${normal}$(__my_rvm_ruby_version)[${green}\w${normal}]$(is_vim_shell)${BRACKET_COLOR}
*) PS1="\n${TITLEBAR}${BRACKET_COLOR}┌─${normal}$(my_ve)$(chroot)[$my_ps_user][$my_ps_host]$(scm_prompt)${normal}$(__my_rvm_ruby_version)[${green}\w${normal}]$(is_vim_shell)${BRACKET_COLOR}
└─▪ ${prompt_symbol} ${normal}"
;;
esac

View File

@@ -32,26 +32,17 @@ is_vim_shell() {
fi
}
modern_scm_prompt() {
CHAR=$(scm_char)
if [ $CHAR = $SCM_NONE_CHAR ]
then
return
else
echo "[$(scm_char)][$(scm_prompt_info)]"
fi
}
prompt() {
SCM_PROMPT_FORMAT='[%s][%s]'
if [ $? -ne 0 ]
then
# Yes, the indenting on these is weird, but it has to be like
# this otherwise it won't display properly.
PS1="${TITLEBAR}${bold_red}┌─[${cyan}$(t | wc -l | sed -e's/ *//')${reset_color}]${reset_color}$(modern_scm_prompt)[${cyan}\W${normal}]$(is_vim_shell)
PS1="${TITLEBAR}${bold_red}┌─[${cyan}$(t | wc -l | sed -e's/ *//')${reset_color}]${reset_color}$(scm_prompt)[${cyan}\W${normal}]$(is_vim_shell)
${bold_red}└─▪${normal} "
else
PS1="${TITLEBAR}┌─[${cyan}$(t | wc -l | sed -e's/ *//')${reset_color}]$(modern_scm_prompt)[${cyan}\W${normal}]$(is_vim_shell)
PS1="${TITLEBAR}┌─[${cyan}$(t | wc -l | sed -e's/ *//')${reset_color}]$(scm_prompt)[${cyan}\W${normal}]$(is_vim_shell)
└─▪ "
fi
}

View File

@@ -28,30 +28,21 @@ is_vim_shell() {
fi
}
modern_scm_prompt() {
CHAR=$(scm_char)
if [ $CHAR = $SCM_NONE_CHAR ]
then
return
else
echo "[$(scm_char)][$(scm_prompt_info)]"
fi
}
modern_current_time_prompt() {
echo "[$(date '+%l:%M%p')]"
}
prompt() {
SCM_PROMPT_FORMAT='[%s][%s]'
if [ $? -ne 0 ]
then
# Yes, the indenting on these is weird, but it has to be like
# this otherwise it won't display properly.
PS1="${TITLEBAR}${bold_red}┌─${reset_color}$(modern_scm_prompt)$(modern_current_time_prompt)[${cyan}\W${normal}]$(is_vim_shell)
PS1="${TITLEBAR}${bold_red}┌─${reset_color}$(scm_prompt)$(modern_current_time_prompt)[${cyan}\W${normal}]$(is_vim_shell)
${bold_red}└─▪${normal} "
else
PS1="${TITLEBAR}┌─$(modern_scm_prompt)$(modern_current_time_prompt)[${cyan}\W${normal}]$(is_vim_shell)
PS1="${TITLEBAR}┌─$(scm_prompt)$(modern_current_time_prompt)[${cyan}\W${normal}]$(is_vim_shell)
└─▪ "
fi
}

View File

@@ -1,4 +1,6 @@
# shellcheck shell=bash
# shellcheck disable=SC2034 # Expected behavior for themes.
# shellcheck disable=SC2154 #TODO: fix these all.
SCM_THEME_PROMPT_PREFIX=""
SCM_THEME_PROMPT_SUFFIX=""
@@ -26,15 +28,6 @@ is_vim_shell() {
fi
}
modern_scm_prompt() {
CHAR=$(scm_char)
if [ "$CHAR" = "$SCM_NONE_CHAR" ]; then
return
else
echo "[$(scm_char)][$(scm_prompt_info)]"
fi
}
detect_venv() {
python_venv=""
# Detect python venv
@@ -46,11 +39,12 @@ detect_venv() {
}
prompt() {
SCM_PROMPT_FORMAT='[%s][%s]'
retval=$?
if [[ retval -ne 0 ]]; then
PS1="${TITLEBAR}${bold_red}┌─${reset_color}$(modern_scm_prompt)[${cyan}\u${normal}][${cyan}\w${normal}]$(is_vim_shell)\n${bold_red}└─▪${normal} "
PS1="${TITLEBAR}${bold_red}┌─${reset_color}$(scm_prompt)[${cyan}\u${normal}][${cyan}\w${normal}]$(is_vim_shell)\n${bold_red}└─▪${normal} "
else
PS1="${TITLEBAR}┌─$(modern_scm_prompt)[${cyan}\u${normal}][${cyan}\w${normal}]$(is_vim_shell)\n└─▪ "
PS1="${TITLEBAR}┌─$(scm_prompt)[${cyan}\u${normal}][${cyan}\w${normal}]$(is_vim_shell)\n└─▪ "
fi
detect_venv
PS1+="${python_venv}${dir_color}"

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env bash
# shellcheck shell=bash
# Two line prompt showing the following information:
# (time) SCM [username@hostname] pwd (SCM branch SCM status)
@@ -29,9 +29,7 @@ prompt_setter() {
else PROMPT_END=$PROMPT_END_DIRTY
fi
# Save history
history -a
history -c
history -r
_save-and-reload-history 1
PS1="($(clock_prompt)) $(scm_char) [${blue}\u${reset_color}@${green}\H${reset_color}] ${yellow}\w${reset_color}$(scm_prompt_info) ${reset_color}\n$(prompt_end) "
PS2='> '
PS4='+ '

View File

@@ -1,4 +1,4 @@
#!/bin/bash
# shellcheck shell=bash
# Two line prompt showing the following information:
# (time) SCM [username@hostname] pwd (SCM branch SCM status)
@@ -96,9 +96,7 @@ prompt_setter() {
else PROMPT_END=$PROMPT_END_DIRTY
fi
# Save history
history -a
history -c
history -r
_save-and-reload-history 1
PS1="($(clock_prompt)${reset_color}) $(scm_char) [${USERNAME_COLOR}\u${reset_color}@${HOSTNAME_COLOR}\H${reset_color}] ${PATH_COLOR}\w${reset_color}$(scm_prompt_info) ${reset_color}\n$(prompt_end) "
PS2='> '
PS4='+ '

View File

@@ -1,10 +1,8 @@
#!/usr/bin/env bash
# shellcheck shell=bash
prompt_setter() {
# Save history
history -a
history -c
history -r
_save-and-reload-history 1
PS1="($(clock_prompt)) $(scm_char) [$blue\u$reset_color@$green\H$reset_color] $yellow\w${reset_color}$(scm_prompt_info)$(ruby_version_prompt) $reset_color "
PS2='> '
PS4='+ '

View File

@@ -55,6 +55,9 @@ TERRAFORM_CHAR=${POWERLINE_TERRAFORM_CHAR:="t "}
KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "}
KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_CONTEXT_COLOR:=26}
KUBERNETES_NAMESPACE_THEME_CHAR=${POWERLINE_KUBERNETES_NAMESPACE_CHAR:="⎈ "}
KUBERNETES_NAMESPACE_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_NAMESPACE_COLOR:=64}
AWS_PROFILE_CHAR=${POWERLINE_AWS_PROFILE_CHAR:="aws "}
AWS_PROFILE_PROMPT_COLOR=${POWERLINE_AWS_PROFILE_COLOR:=208}
@@ -94,6 +97,8 @@ COMMAND_NUMBER_THEME_PROMPT_CHAR=${POWERLINE_COMMAND_NUMBER_CHAR:="#"}
GCLOUD_THEME_PROMPT_COLOR=${POWERLINE_GCLOUD_COLOR:=161}
GCLOUD_CHAR=${POWERLINE_GCLOUD_CHAR:="G "}
COMMAND_DURATION_PROMPT_COLOR=${POWERLINE_COMMAND_DURATION_COLOR:=129}
POWERLINE_LEFT_PROMPT=${POWERLINE_LEFT_PROMPT:="scm python_venv ruby node cwd"}
POWERLINE_RIGHT_PROMPT=${POWERLINE_RIGHT_PROMPT:="in_vim clock battery user_info"}

View File

@@ -50,6 +50,9 @@ TERRAFORM_CHAR=${POWERLINE_TERRAFORM_CHAR:="t "}
KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "}
KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_CONTEXT_COLOR:=26}
KUBERNETES_NAMESPACE_THEME_CHAR=${POWERLINE_KUBERNETES_NAMESPACE_CHAR:="⎈ "}
KUBERNETES_NAMESPACE_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_NAMESPACE_COLOR:=64}
AWS_PROFILE_CHAR=${POWERLINE_AWS_PROFILE_CHAR:="aws "}
AWS_PROFILE_PROMPT_COLOR=${POWERLINE_AWS_PROFILE_COLOR:=208}

View File

@@ -47,6 +47,9 @@ TERRAFORM_CHAR=${POWERLINE_TERRAFORM_CHAR:="t "}
KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "}
KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_CONTEXT_COLOR:=26}
KUBERNETES_NAMESPACE_THEME_CHAR=${POWERLINE_KUBERNETES_NAMESPACE_CHAR:="⎈ "}
KUBERNETES_NAMESPACE_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_NAMESPACE_COLOR:=60}
AWS_PROFILE_CHAR=${POWERLINE_AWS_PROFILE_CHAR:="aws "}
AWS_PROFILE_PROMPT_COLOR=${POWERLINE_AWS_PROFILE_COLOR:=208}

View File

@@ -1,4 +1,7 @@
# shellcheck shell=bash
# shellcheck disable=SC2034 # Expected behavior for themes.
# shellcheck disable=SC2154 #TODO: fix these all.
# Define this here so it can be used by all of the Powerline themes
THEME_CHECK_SUDO=${THEME_CHECK_SUDO:=true}
@@ -85,6 +88,16 @@ function __powerline_k8s_context_prompt() {
[[ -n "${kubernetes_context}" ]] && echo "${KUBERNETES_CONTEXT_THEME_CHAR}${kubernetes_context}|${KUBERNETES_CONTEXT_THEME_PROMPT_COLOR}"
}
function __powerline_k8s_namespace_prompt() {
local kubernetes_namespace=""
if _command_exists kubectl; then
kubernetes_namespace="$(k8s_namespace_prompt)"
fi
[[ -n "${kubernetes_namespace}" ]] && echo "${KUBERNETES_NAMESPACE_THEME_CHAR}${kubernetes_namespace}|${KUBERNETES_NAMESPACE_THEME_PROMPT_COLOR}"
}
function __powerline_python_venv_prompt() {
set +u
local python_venv=""
@@ -129,7 +142,7 @@ function __powerline_scm_prompt() {
}
function __powerline_cwd_prompt() {
local cwd=$(pwd | sed "s|^${HOME}|~|")
local cwd="${PWD/$HOME/\~}"
echo "${cwd}|${CWD_THEME_PROMPT_COLOR}"
}
@@ -147,10 +160,10 @@ function __powerline_clock_prompt() {
}
function __powerline_battery_prompt() {
local color=""
local battery_status="$(battery_percentage 2> /dev/null)"
local color="" battery_status
battery_status="$(battery_percentage 2> /dev/null)"
if [[ -z "${battery_status}" ]] || [[ "${battery_status}" = "-1" ]] || [[ "${battery_status}" = "no" ]]; then
if [[ -z "${battery_status}" || "${battery_status}" == "-1" || "${battery_status}" == "no" ]]; then
true
else
if [[ "$((10#${battery_status}))" -le 5 ]]; then
@@ -166,7 +179,7 @@ function __powerline_battery_prompt() {
}
function __powerline_in_vim_prompt() {
if [ -n "$VIMRUNTIME" ]; then
if [[ -n "$VIMRUNTIME" ]]; then
echo "${IN_VIM_THEME_PROMPT_TEXT}|${IN_VIM_THEME_PROMPT_COLOR}"
fi
}
@@ -210,6 +223,12 @@ function __powerline_command_number_prompt() {
echo "${COMMAND_NUMBER_THEME_PROMPT_CHAR}\#|${COMMAND_NUMBER_THEME_PROMPT_COLOR}"
}
function __powerline_duration_prompt() {
local duration
duration=$(_command_duration)
[[ -n "$duration" ]] && echo "${duration}|${COMMAND_DURATION_PROMPT_COLOR}"
}
function __powerline_left_segment() {
local params
IFS="|" read -ra params <<< "${1}"
@@ -250,7 +269,7 @@ function __powerline_last_status_prompt() {
function __powerline_prompt_command() {
local last_status="$?" ## always the first
local separator_char="${POWERLINE_PROMPT_CHAR}"
local separator_char="${POWERLINE_PROMPT_CHAR}" info prompt_color
LEFT_PROMPT=""
SEGMENTS_AT_LEFT=0
@@ -264,7 +283,7 @@ function __powerline_prompt_command() {
## left prompt ##
for segment in $POWERLINE_PROMPT; do
local info="$(__powerline_"${segment}"_prompt)"
info="$(__powerline_"${segment}"_prompt)"
[[ -n "${info}" ]] && __powerline_left_segment "${info}"
done
@@ -276,7 +295,7 @@ function __powerline_prompt_command() {
# By default we try to match the prompt to the adjacent segment's background color,
# but when part of the prompt exists within that segment, we instead match the foreground color.
local prompt_color="$(set_color "${LAST_SEGMENT_COLOR}" -)"
prompt_color="$(set_color "${LAST_SEGMENT_COLOR}" -)"
if [[ -n "${LEFT_PROMPT}" ]] && [[ -n "${POWERLINE_LEFT_LAST_SEGMENT_PROMPT_CHAR}" ]]; then
LEFT_PROMPT+="$(set_color - "${LAST_SEGMENT_COLOR}")${POWERLINE_LEFT_LAST_SEGMENT_PROMPT_CHAR}"
prompt_color="${normal}"

View File

@@ -1,4 +1,5 @@
# shellcheck shell=bash
# shellcheck disable=SC2034 # Expected behavior for themes.
# shellcheck source=../../themes/powerline/powerline.base.bash
. "$BASH_IT/themes/powerline/powerline.base.bash"
@@ -52,6 +53,9 @@ TERRAFORM_CHAR=${POWERLINE_TERRAFORM_CHAR:="t "}
KUBERNETES_CONTEXT_THEME_CHAR=${POWERLINE_KUBERNETES_CONTEXT_CHAR:="⎈ "}
KUBERNETES_CONTEXT_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_CONTEXT_COLOR:=26}
KUBERNETES_NAMESPACE_THEME_CHAR=${POWERLINE_KUBERNETES_NAMESPACE_CHAR:="⎈ "}
KUBERNETES_NAMESPACE_THEME_PROMPT_COLOR=${POWERLINE_KUBERNETES_NAMESPACE_COLOR:=64}
AWS_PROFILE_CHAR=${POWERLINE_AWS_PROFILE_CHAR:="aws "}
AWS_PROFILE_PROMPT_COLOR=${POWERLINE_AWS_PROFILE_COLOR:=208}
@@ -91,6 +95,8 @@ COMMAND_NUMBER_THEME_PROMPT_CHAR=${POWERLINE_COMMAND_NUMBER_CHAR:="#"}
GCLOUD_THEME_PROMPT_COLOR=${POWERLINE_GCLOUD_COLOR:=161}
GCLOUD_CHAR=${POWERLINE_GCLOUD_CHAR:="G "}
COMMAND_DURATION_PROMPT_COLOR=${POWERLINE_COMMAND_DURATION_COLOR:=129}
POWERLINE_PROMPT=${POWERLINE_PROMPT:="user_info scm python_venv ruby node cwd"}
safe_append_prompt_command __powerline_prompt_command

View File

@@ -43,7 +43,7 @@ _swd(){
begin="" # The unshortened beginning of the path.
shortbegin="" # The shortened beginning of the path.
current="" # The section of the path we're currently working on.
end="${2:-$(pwd)}/" # The unmodified rest of the path.
end="${2:-${PWD}}/" # The unmodified rest of the path.
if [[ "$end" =~ "$HOME" ]]; then
INHOME=1

View File

@@ -1,3 +1,7 @@
# shellcheck shell=bash
# shellcheck disable=SC2034 # Expected behavior for themes.
# shellcheck disable=SC2154 #TODO: fix these all.
# scm theming
SCM_THEME_PROMPT_PREFIX="|"
SCM_THEME_PROMPT_SUFFIX=""
@@ -16,31 +20,22 @@ VIRTUALENV_THEME_PROMPT_SUFFIX=")"
# export LSCOLORS="Gxfxcxdxbxegedabagacad"
# export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:'
scm_prompt() {
CHAR=$(scm_char)
if [ $CHAR = $SCM_NONE_CHAR ]
then
return
else
echo "[$(scm_char)$(scm_prompt_info)]"
fi
}
pure_prompt() {
ps_host="${bold_blue}\h${normal}";
ps_user="${green}\u${normal}";
ps_user_mark="${green} $ ${normal}";
ps_root="${red}\u${red}";
ps_root_mark="${red} # ${normal}"
ps_path="${yellow}\w${normal}";
# make it work
case $(id -u) in
0) PS1="$(virtualenv_prompt)$ps_root@$ps_host$(scm_prompt):$ps_path$ps_root_mark"
;;
*) PS1="$(virtualenv_prompt)$ps_user@$ps_host$(scm_prompt):$ps_path$ps_user_mark"
;;
esac
ps_host="${bold_blue}\h${normal}"
ps_user="${green}\u${normal}"
ps_user_mark="${green} $ ${normal}"
ps_root="${red}\u${red}"
ps_root_mark="${red} # ${normal}"
ps_path="${yellow}\w${normal}"
# make it work
case $(id -u) in
0)
PS1="$(virtualenv_prompt)$ps_root@$ps_host$(scm_prompt):$ps_path$ps_root_mark"
;;
*)
PS1="$(virtualenv_prompt)$ps_user@$ps_host$(scm_prompt):$ps_path$ps_user_mark"
;;
esac
}
safe_append_prompt_command pure_prompt

View File

@@ -1,4 +1,6 @@
# shellcheck shell=bash
# shellcheck disable=SC2034 # Expected behavior for themes.
# shellcheck disable=SC2154 #TODO: fix these all.
SCM_THEME_PROMPT_DIRTY=" ${bold_red}${normal}"
SCM_THEME_PROMPT_CLEAN=" ${bold_green}${normal}"
@@ -26,8 +28,8 @@ venv_prompt() {
}
function prompt_command() {
retval=$?
local ret_status="$([ $retval -eq 0 ] && echo -e "$STATUS_THEME_PROMPT_OK" || echo -e "$STATUS_THEME_PROMPT_BAD")"
local retval=$? ret_status
ret_status="$([ $retval -eq 0 ] && echo -e "$STATUS_THEME_PROMPT_OK" || echo -e "$STATUS_THEME_PROMPT_BAD")"
PS1="\n${PURITY_THEME_PROMPT_COLOR}\w $(scm_prompt_info)\n${ret_status}$(venv_prompt)"
}

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env bash
# shellcheck shell=bash
# based off of n0qorg
# looks like, if you're in a git repo:
@@ -7,9 +7,7 @@
prompt_setter() {
# Save history
history -a
history -c
history -r
_save-and-reload-history 1
# displays user@server in purple
# PS1="$red$(scm_char) $purple\u@\h$reset_color:$blue\w$yellow$(scm_prompt_info)$(ruby_version_prompt) $black\$$reset_color "
# no user@server

View File

@@ -36,16 +36,6 @@ is_vim_shell() {
fi
}
modern_scm_prompt() {
CHAR=$(scm_char)
if [ $CHAR = $SCM_NONE_CHAR ]
then
return
else
echo "[$(scm_char)][$(scm_prompt_info)]"
fi
}
# show chroot if exist
chroot(){
if [ -n "$debian_chroot" ]
@@ -71,7 +61,7 @@ my_ve(){
}
prompt() {
SCM_PROMPT_FORMAT='[%s][%s]'
my_ps_host="${green}\h${normal}";
# yes, these are the the same for now ...
my_ps_host_root="${green}\h${normal}";
@@ -86,10 +76,10 @@ prompt() {
# nice prompt
case "`id -u`" in
0) PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_root][$my_ps_host_root]$(modern_scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]
0) PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_root][$my_ps_host_root]$(scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]
"
;;
*) PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_user][$my_ps_host]$(modern_scm_prompt)$(__my_rvm_ruby_version)
*) PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_user][$my_ps_host]$(scm_prompt)$(__my_rvm_ruby_version)
|─[${bold_purple}\w${normal}]
"
;;

View File

@@ -181,7 +181,7 @@ prompt() {
local MOVE_CURSOR_RIGHTMOST='\033[500C'
local MOVE_CURSOR_5_LEFT='\033[5D'
if [ $(uname) = "Linux" ];
if [[ "$OSTYPE" == 'linux'* ]];
then
PS1="${TITLEBAR}
${SAVE_CURSOR}${MOVE_CURSOR_RIGHTMOST}${MOVE_CURSOR_5_LEFT}\

View File

@@ -57,16 +57,6 @@ todo_txt_count() {
fi
}
modern_scm_prompt() {
CHAR=$(scm_char)
if [ $CHAR = $SCM_NONE_CHAR ]
then
return
else
echo "${BRACKET_COLOR}[${CHAR}${BRACKET_COLOR}][${STRING_COLOR}$(scm_prompt_info)${BRACKET_COLOR}]$normal"
fi
}
my_prompt_char() {
if [[ $OSTYPE =~ "darwin" ]]; then
echo "${BRACKET_COLOR}${normal}"
@@ -76,6 +66,7 @@ my_prompt_char() {
}
prompt() {
SCM_PROMPT_FORMAT="${BRACKET_COLOR}[%s${BRACKET_COLOR}][${STRING_COLOR}%s${BRACKET_COLOR}]"
my_ps_host="${STRING_COLOR}\h${normal}";
my_ps_user="${STRING_COLOR}\u${normal}";
@@ -84,10 +75,10 @@ prompt() {
# nice prompt
case "`id -u`" in
0) PS1="${TITLEBAR}${BRACKET_COLOR}┌─[$my_ps_root${BRACKET_COLOR}][$my_ps_host${BRACKET_COLOR}]$(modern_scm_prompt)$(__my_rvm_ruby_version)${BRACKET_COLOR}[${STRING_COLOR}\w${BRACKET_COLOR}]$(is_vim_shell)
0) PS1="${TITLEBAR}${BRACKET_COLOR}┌─[$my_ps_root${BRACKET_COLOR}][$my_ps_host${BRACKET_COLOR}]$(scm_prompt)$(__my_rvm_ruby_version)${BRACKET_COLOR}[${STRING_COLOR}\w${BRACKET_COLOR}]$(is_vim_shell)
${BRACKET_COLOR}└─$(my_prompt_char)${normal}"
;;
*) PS1="${TITLEBAR}${BRACKET_COLOR}┌─[$my_ps_user${BRACKET_COLOR}][$my_ps_host${BRACKET_COLOR}]$(modern_scm_prompt)$(__my_rvm_ruby_version)${BRACKET_COLOR}[${STRING_COLOR}\w${BRACKET_COLOR}]$(is_vim_shell)
*) PS1="${TITLEBAR}${BRACKET_COLOR}┌─[$my_ps_user${BRACKET_COLOR}][$my_ps_host${BRACKET_COLOR}]$(scm_prompt)$(__my_rvm_ruby_version)${BRACKET_COLOR}[${STRING_COLOR}\w${BRACKET_COLOR}]$(is_vim_shell)
${BRACKET_COLOR}└─$(todo_txt_count)$(my_prompt_char)"
;;
esac

View File

@@ -43,18 +43,8 @@ is_vim_shell() {
fi
}
modern_scm_prompt() {
CHAR=$(scm_char)
if [ $CHAR = $SCM_NONE_CHAR ]
then
return
else
echo "[$(scm_char)][$(scm_prompt_info)]"
fi
}
prompt() {
SCM_PROMPT_FORMAT='[%s][%s]'
case $HOSTNAME in
"clappy"* ) my_ps_host="${green}\h${normal}";
;;
@@ -70,10 +60,10 @@ prompt() {
# nice prompt
case "`id -u`" in
0) PS1="${TITLEBAR}[$my_ps_root][$my_ps_host]$(modern_scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]$(is_vim_shell)
0) PS1="${TITLEBAR}[$my_ps_root][$my_ps_host]$(scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]$(is_vim_shell)
$ "
;;
*) PS1="${TITLEBAR}[$my_ps_user][$my_ps_host]$(modern_scm_prompt)$(__my_rvm_ruby_version)$(__my_venv_prompt)[${cyan}\w${normal}]$(is_vim_shell)
*) PS1="${TITLEBAR}[$my_ps_user][$my_ps_host]$(scm_prompt)$(__my_rvm_ruby_version)$(__my_venv_prompt)[${cyan}\w${normal}]$(is_vim_shell)
$ "
;;
esac

View File

@@ -36,16 +36,6 @@ is_vim_shell() {
fi
}
modern_scm_prompt() {
CHAR=$(scm_char)
if [ $CHAR = $SCM_NONE_CHAR ]
then
return
else
echo "[$(scm_char)][$(scm_prompt_info)]"
fi
}
# show chroot if exist
chroot(){
if [ -n "$debian_chroot" ]
@@ -71,7 +61,7 @@ my_ve(){
}
prompt() {
SCM_PROMPT_FORMAT='[%s][%s]'
my_ps_host="${green}\h${normal}";
# yes, these are the the same for now ...
my_ps_host_root="${green}\h${normal}";
@@ -86,10 +76,10 @@ prompt() {
# nice prompt
case "`id -u`" in
0) PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_root][$my_ps_host_root]$(modern_scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]$(is_vim_shell)
0) PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_root][$my_ps_host_root]$(scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]$(is_vim_shell)
└─▪ "
;;
*) PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_user][$my_ps_host]$(modern_scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]$(is_vim_shell)
*) PS1="${TITLEBAR}┌─$(my_ve)$(chroot)[$my_ps_user][$my_ps_host]$(scm_prompt)$(__my_rvm_ruby_version)[${cyan}\w${normal}]$(is_vim_shell)
└─▪ "
;;
esac