1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-22 12:20:07 +00:00

Merge branch 'master' into next

This commit is contained in:
Ben Hilburn 2017-08-12 13:46:08 -04:00
commit 02332d5962
4 changed files with 32 additions and 12 deletions

View file

@ -35,7 +35,7 @@ case $POWERLEVEL9K_MODE in
TODO_ICON $'\u2611' # ☑
BATTERY_ICON $'\uE894' # 
DISK_ICON $'\uE1AE ' # 
OK_ICON $'\u2713' # ✓
OK_ICON $'\u2714' # ✔
FAIL_ICON $'\u2718' # ✘
SYMFONY_ICON 'SF'
NODE_ICON $'\u2B22' # ⬢
@ -78,7 +78,7 @@ case $POWERLEVEL9K_MODE in
VCS_HG_ICON $'\uE1C3 ' # 
VCS_SVN_ICON '(svn) '
RUST_ICON ''
PYTHON_ICON $'\U1F40D' # 🐍
PYTHON_ICON $'\ue63c' # 
SWIFT_ICON ''
GO_ICON ''
PUBLIC_IP_ICON ''
@ -110,7 +110,7 @@ case $POWERLEVEL9K_MODE in
TODO_ICON $'\u2611' # ☑
BATTERY_ICON $'\U1F50B' # 🔋
DISK_ICON $'\uF0A0 ' # 
OK_ICON $'\u2713' # ✓
OK_ICON $'\u2714' # ✔
FAIL_ICON $'\u2718' # ✘
SYMFONY_ICON 'SF'
NODE_ICON $'\u2B22' # ⬢
@ -149,7 +149,7 @@ case $POWERLEVEL9K_MODE in
VCS_HG_ICON $'\uF0C3 ' # 
VCS_SVN_ICON '(svn) '
RUST_ICON $'\uE6A8' # 
PYTHON_ICON $'\U1F40D' # 🐍
PYTHON_ICON $'\ue63c' # 
SWIFT_ICON ''
GO_ICON ''
PUBLIC_IP_ICON ''
@ -252,7 +252,7 @@ case $POWERLEVEL9K_MODE in
TODO_ICON $'\u2611' # ☑
BATTERY_ICON $'\U1F50B' # 🔋
DISK_ICON $'hdd '
OK_ICON $'\u2713' # ✓
OK_ICON $'\u2714' # ✔
FAIL_ICON $'\u2718' # ✘
SYMFONY_ICON 'SF'
NODE_ICON $'\u2B22' # ⬢

View file

@ -216,7 +216,7 @@ function segmentShouldBeJoined() {
# Given a directory path, truncate it according to the settings for
# `truncate_from_right`
function truncatePathFromRight() {
local delim_len=${#POWERLEVEL9K_SHORTEN_DELIMITER}
local delim_len=${#POWERLEVEL9K_SHORTEN_DELIMITER:-1}
echo $1 | sed $SED_EXTENDED_REGEX_PARAMETER \
"s@(([^/]{$((POWERLEVEL9K_SHORTEN_DIR_LENGTH))})([^/]{$delim_len}))[^/]+/@\2$POWERLEVEL9K_SHORTEN_DELIMITER/@g"
}

View file

@ -1316,12 +1316,12 @@ set_default POWERLEVEL9K_VI_INSERT_MODE_STRING "INSERT"
set_default POWERLEVEL9K_VI_COMMAND_MODE_STRING "NORMAL"
prompt_vi_mode() {
case ${KEYMAP} in
main|viins)
"$1_prompt_segment" "$0_INSERT" "$2" "$DEFAULT_COLOR" "blue" "$POWERLEVEL9K_VI_INSERT_MODE_STRING"
;;
vicmd)
"$1_prompt_segment" "$0_NORMAL" "$2" "$DEFAULT_COLOR" "default" "$POWERLEVEL9K_VI_COMMAND_MODE_STRING"
;;
main|viins|*)
"$1_prompt_segment" "$0_INSERT" "$2" "$DEFAULT_COLOR" "blue" "$POWERLEVEL9K_VI_INSERT_MODE_STRING"
;;
esac
}
@ -1484,11 +1484,11 @@ prompt_powerlevel9k_setup() {
# returns. We need prompt_subst so we can safely run commands in the prompt
# without them being double expanded and we need prompt_percent to expand the
# common percent escape sequences.
prompt_opts=(subst percent cr)
prompt_opts=(cr percent sp subst)
# Borrowed from promptinit, sets the prompt options in case the theme was
# not initialized via promptinit.
setopt noprompt{bang,cr,percent,subst} "prompt${^prompt_opts[@]}"
setopt noprompt{bang,cr,percent,sp,subst} "prompt${^prompt_opts[@]}"
# Display a warning if the terminal does not support 256 colors
local term_colors

View file

@ -72,6 +72,26 @@ function testTruncationFromRightWorks() {
unset POWERLEVEL9K_SHORTEN_STRATEGY
}
function testTruncationFromRightWithEmptyDelimiter() {
POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
POWERLEVEL9K_SHORTEN_DELIMITER=""
POWERLEVEL9K_SHORTEN_STRATEGY='truncate_from_right'
FOLDER=/tmp/powerlevel9k-test/1/12/123/1234/12345/123456/1234567/12345678/123456789
mkdir -p $FOLDER
cd $FOLDER
assertEquals "%K{blue} %F{black}/tmp/po/1/12/123/12/12/12/12/12/123456789 %k%F{blue}%f " "$(build_left_prompt)"
cd -
rm -fr /tmp/powerlevel9k-test
unset FOLDER
unset POWERLEVEL9K_SHORTEN_DIR_LENGTH
unset POWERLEVEL9K_SHORTEN_DELIMITER
unset POWERLEVEL9K_SHORTEN_STRATEGY
}
function testTruncateWithFolderMarkerWorks() {
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir)
POWERLEVEL9K_SHORTEN_STRATEGY="truncate_with_folder_marker"