diff options
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-x | powerlevel9k.zsh-theme | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 8eb13bde..3e587717 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -744,6 +744,11 @@ prompt_dir() { set_default POWERLEVEL9K_SHORTEN_DELIMITER $'\U2026' case "$POWERLEVEL9K_SHORTEN_STRATEGY" in + truncate_absolute_chars) + if [ ${#current_path} -gt $(( $POWERLEVEL9K_SHORTEN_DIR_LENGTH + ${#POWERLEVEL9K_SHORTEN_DELIMITER} )) ]; then + current_path=$POWERLEVEL9K_SHORTEN_DELIMITER${current_path:(-POWERLEVEL9K_SHORTEN_DIR_LENGTH)} + fi + ;; truncate_middle) current_path=$(echo "$current_path" | sed $SED_EXTENDED_REGEX_PARAMETER "s/([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})[^/]+([^/]{$POWERLEVEL9K_SHORTEN_DIR_LENGTH})\//\1$POWERLEVEL9K_SHORTEN_DELIMITER\2\//g") ;; @@ -1039,9 +1044,9 @@ prompt_load() { # Replace comma load_avg=${load_avg//,/.} - if [[ "$load_avg" -gt $(bc -l <<< "${cores} * 0.7") ]]; then + if [[ "$load_avg" -gt $((${cores} * 0.7)) ]]; then current_state="critical" - elif [[ "$load_avg" -gt $(bc -l <<< "${cores} * 0.5") ]]; then + elif [[ "$load_avg" -gt $((${cores} * 0.5)) ]]; then current_state="warning" else current_state="normal" @@ -1453,6 +1458,7 @@ prompt_vi_mode() { "$1_prompt_segment" "$0_NORMAL" "$2" "$DEFAULT_COLOR" "default" "$POWERLEVEL9K_VI_COMMAND_MODE_STRING" ;; main|viins|*) + if [[ -z $POWERLEVEL9K_VI_INSERT_MODE_STRING ]]; then return; fi "$1_prompt_segment" "$0_INSERT" "$2" "$DEFAULT_COLOR" "blue" "$POWERLEVEL9K_VI_INSERT_MODE_STRING" ;; esac @@ -1639,10 +1645,20 @@ $(print_icon 'MULTILINE_LAST_PROMPT_PREFIX')' NEWLINE=' ' [[ $POWERLEVEL9K_PROMPT_ADD_NEWLINE == true ]] && PROMPT="$NEWLINE$PROMPT" + + # Allow iTerm integration to work + [[ $ITERM_SHELL_INTEGRATION_INSTALLED == "Yes" ]] && PROMPT="%{$(iterm2_prompt_mark)%}$PROMPT" +} + + +zle-keymap-select () { + zle reset-prompt + zle -R } set_default POWERLEVEL9K_IGNORE_TERM_COLORS false set_default POWERLEVEL9K_IGNORE_TERM_LANG false + prompt_powerlevel9k_setup() { # The value below was set to better support 32-bit CPUs. # It's the maximum _signed_ integer value on 32-bit CPUs. @@ -1706,6 +1722,8 @@ prompt_powerlevel9k_setup() { # prepare prompts add-zsh-hook precmd powerlevel9k_prepare_prompts add-zsh-hook preexec powerlevel9k_preexec + + zle -N zle-keymap-select } prompt_powerlevel9k_teardown() { |