Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

[Enhancement]: add p9k::reset_prompt function #1198

Open
wants to merge 2 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions functions/defaults.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
P9K_BACKGROUND_JOBS_EXPANDED=false
P9K_BACKGROUND_JOBS_VERBOSE=true
P9K_BACKGROUND_JOBS_VERBOSE_ALWAYS=false
P9K_CONTEXT_ALWAYS_SHOW=false
P9K_CONTEXT_ALWAYS_SHOW_USER=false
P9K_CONTEXT_TEMPLATE=%n@%m
P9K_DIR_HOME_FOLDER_ABBREVIATION='~'
P9K_DIR_PACKAGE_FILES=( package.json composer.json )
P9K_DIR_PATH_ABSOLUTE=false
P9K_DIR_PATH_HIGHLIGHT_BOLD=false
P9K_DIR_PATH_SEPARATOR=/
P9K_DIR_SHORTEN_DELIMITER='\u2026'
P9K_DIR_SHORTEN_FOLDER_MARKER=.shorten_folder_marker
P9K_IGNORE_TERM_COLORS=false
P9K_IGNORE_TERM_LANG=false
P9K_LEFT_PROMPT_ELEMENTS=( context dir vcs )
P9K_MIDDLE_WHITESPACE_OF_LEFT_SEGMENTS=' '
P9K_MIDDLE_WHITESPACE_OF_RIGHT_SEGMENTS=' '
P9K_PROMPT_ADD_NEWLINE=false
P9K_PROMPT_ELEMENTS=( '' )
P9K_RIGHT_PROMPT_ELEMENTS=( status root_indicator background_jobs history time )
P9K_STATUS_CROSS=false
P9K_STATUS_HIDE_SIGNAME=false
P9K_STATUS_OK=true
P9K_STATUS_OK_IN_NON_VERBOSE=false
P9K_STATUS_SHOW_PIPESTATUS=true
P9K_STATUS_VERBOSE=true
P9K_VCS_ACTIONFORMAT_FOREGROUND=red
P9K_VCS_DIR_SHORTEN_DELIMITER=…
P9K_VCS_GIT_ALWAYS_SHOW_REMOTE_BRANCH=false
P9K_VCS_GIT_HOOKS=( vcs-detect-changes git-untracked git-aheadbehind git-stash git-remotebranch git-gitdir git-tagname )
P9K_VCS_HG_HOOKS=( vcs-detect-changes )
P9K_VCS_HIDE_TAGS=false
P9K_VCS_INTERNAL_HASH_LENGTH=8
P9K_VCS_SHOW_SUBMODULE_DIRTY=true
P9K_VCS_SVN_HOOKS=( vcs-detect-changes svn-detect-changes )
P9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS=' '
P9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS=' '

16 changes: 16 additions & 0 deletions functions/utilities.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -449,3 +449,19 @@ function p9k::parseIp() {

return 1
}
###############################################################
# @description
# Unsets every P9K Variable and restores installation defaults
# @noargs
##
function p9k::reset_prompt() {
while read p9kVariablePair; do
local p9kVariable=(${(@s/=/)p9kVariablePair})
local p9kVariableName=${p9kVariable[1]}
if [[ "${p9kVariableName}" != "P9K_VERSION" ]]; then
unset $p9kVariableName;
fi
done < <(setopt ; set | egrep --color=never -i "^p9k_")

source "${__P9K_DIRECTORY}/functions/defaults.zsh"
}