Skip to content

Wizard doesn't provide the option to trim down the prompt unless this is the first command after changing directory (POWERLEVEL9K_TRANSIENT_PROMPT=same-dir) #2880

@patenteng

Description

@patenteng

The p10k wizard only allows you to choose always or none for the transient prompt. Here is a patch to add the option.

It give you the option (d) Yes, unless this is the first command after changing directory. right after the yes option. It also uses transient_prompt=always or transient_prompt=same-dir instead of just transient_prompt in the wizard options comment at the top of the .p10k.zsh file.

Image

diff --git a/internal/wizard.zsh b/internal/wizard.zsh
index 5ae58002..89b512a9 100644
--- a/internal/wizard.zsh
+++ b/internal/wizard.zsh
@@ -1570,6 +1570,9 @@ function ask_transient_prompt() {
   add_prompt_n buffer="%2Fgit%f checkout x$cursor"
   add_widget 0 print
   add_widget 2
+  add_widget 0 print -P "%B(d)  Yes, unless this is the first command after changing directory.%b"
+  add_widget 0 print
+  add_widget 2
   add_widget 0 print -P "%B(n)  No.%b"
   add_widget 0 print
   add_widget 1
@@ -1582,10 +1585,11 @@ function ask_transient_prompt() {
   add_widget 0 print
   add_widget 2
   add_widget 0 print -P "(r)  Restart from the beginning."
-  ask ynr
+  ask ydnr
   case $choice in
     r) return 1;;
-    y) transient_prompt=1; options+=transient_prompt;;
+    y) transient_prompt=1; options+=transient_prompt=always;;
+    d) transient_prompt=2; options+=transient_prompt=same-dir;;
     n) transient_prompt=0;;
   esac
   return 0
@@ -1930,7 +1934,11 @@ function generate_config() {
   (( empty_line )) && sub PROMPT_ADD_NEWLINE true || sub PROMPT_ADD_NEWLINE false
 
   sub INSTANT_PROMPT $instant_prompt
-  (( transient_prompt )) && sub TRANSIENT_PROMPT always
+  if (( transient_prompt == 1 )); then
+    sub TRANSIENT_PROMPT always
+  elif (( transient_prompt == 2 )); then
+    sub TRANSIENT_PROMPT same-dir
+  fi
 
   local header=${(%):-"# Generated by Powerlevel10k configuration wizard on %D{%Y-%m-%d at %H:%M %Z}."}$'\n'
   header+="# Based on romkatv/powerlevel10k/config/p10k-${style//_/-}.zsh"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions