Skip to content

Commit

Permalink
promptinit compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
agkozak committed Aug 14, 2021
1 parent 5840650 commit 60f080b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ This prompt has been tested on numerous Linux and BSD distributions, as well as
<details>
<summary>Here are the latest features and updates.</summary>

- v3.10.0
+ The prompt is now fully compatible with ZSH's `promptinit` function.
- v3.9.0
- The characters used to signify path abbreviation with `AGKOZAK_PROMPT_DIRTRIM` (`...` by default) can now be overridden with `AGKOZAK_PROMPT_DIRTRIM_STRING`.
- v3.8.1 (November 23, 2020)
Expand Down Expand Up @@ -125,6 +127,15 @@ And add the following to your `.zshrc` file:

source /path/to/agkozak-zsh-prompt.plugin.zsh

### For [`promptinit`](https://zsh.sourceforge.io/Doc/Release/User-Contributions.html#Prompt-Themes) users

ZSH comes with a built-in way of handling prompts, the `promptinit` function. You can load the agkozak ZSH prompt by running

fpath+=( /path/to/agkozak-zsh-prompt ) # The directory where the prompt's
# files are kept
autoload promptinit; promptinit
prompt agkozak-zsh-prompt

### For [antigen](https://github.com/zsh-users/antigen) users

Add the line
Expand Down Expand Up @@ -163,6 +174,14 @@ The prompt now supports `zinit`'s `unload` feature; you may restore the shell to

zinit unload agkozak/agkozak-zsh-prompt

### For [Znap](https://github.com/marlonrichert/zsh-snap) users

Simply put

znap prompt agkozak/agkozak-zsh-prompt

in your `.zshrc` somewhere after you source `znap.zsh`.

### For [zplug](https://github.com/zplug/zplug) users

Add the line
Expand Down
10 changes: 3 additions & 7 deletions agkozak-zsh-prompt.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -980,14 +980,11 @@ _agkozak_prompt_strings() {
# AGKOZAK_PROMPT_DIRTRIM
############################################################
prompt_agkozak-zsh-prompt_setup() {
# promptinit compatibility
# TODO: rewrite function carefully now that emulate -L zsh has been removed
# `emulate -L zsh' has been removed for promptinit
# compatibility
prompt_opts=( percent subst )
setopt NO_PROMPT_{BANG,CR,PERCENT,SUBST} "PROMPT_${^prompt_opts[@]}"

# emulate -L zsh
# (( AGKOZAK_PROMPT_DEBUG )) && setopt LOCAL_OPTIONS WARN_CREATE_GLOBAL

_agkozak_async_init

case ${AGKOZAK[ASYNC_METHOD]} in
Expand Down Expand Up @@ -1049,8 +1046,7 @@ prompt_agkozak-zsh-prompt_setup
############################################################

prompt_agkozak-zsh-prompt_preview() {
# TODO: Write a real preview function if possible
print "No preview available. Try \`prompt agkozak-zsh-prompt\'."
print "No preview available. Try \`prompt agkozak-zsh-prompt'."
}

############################################################
Expand Down

0 comments on commit 60f080b

Please sign in to comment.