mirror of
				https://github.com/dcarrillo/prezto.git
				synced 2025-11-04 14:29:08 +00:00 
			
		
		
		
	[prompt] Rename helper function promptpwd to prompt-pwd for consistency
				
					
				
			Changes:
* In prezto, function names are hyphenated ('-') by convention,
  rename `promptpwd` to `prompt-pwd` accordingly.
* Unset local variable `current_pwd` proactively.
* Tweak additional documentation for `prompt-pwd`.
			
			
This commit is contained in:
		
				
					committed by
					
						
						Indrajit Raychaudhuri
					
				
			
			
				
	
			
			
			
						parent
						
							ac628c9059
						
					
				
				
					commit
					17a59bada7
				
			@@ -26,6 +26,14 @@ in *zpreztorc*.
 | 
				
			|||||||
zstyle ':prezto:module:prompt' pwd-length 'short'
 | 
					zstyle ':prezto:module:prompt' pwd-length 'short'
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Prompt Display Length
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					To change working directory prompt display length from 'short', set the
 | 
				
			||||||
 | 
					following to 'long' (without '~' expansion) or 'full' (with '~' expansion)
 | 
				
			||||||
 | 
					in *zpreztorc*.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    zstyle ':prezto:module:prompt' pwd-length 'short'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Theming
 | 
					Theming
 | 
				
			||||||
-------
 | 
					-------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,11 @@
 | 
				
			|||||||
# prompt setup function common to many prompts
 | 
					#
 | 
				
			||||||
# moved to external function to reduce code redundancy
 | 
					# Prompt setup function commonly used by prompt themes.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Authors:
 | 
				
			||||||
 | 
					#   Sorin Ionescu <sorin.ionescu@gmail.com>
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# function promptpwd {
 | 
					# function prompt-pwd {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
setopt localoptions extendedglob
 | 
					setopt localoptions extendedglob
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -19,6 +23,8 @@ else
 | 
				
			|||||||
  ret_directory="${${${${(@j:/:M)${(@s:/:)current_pwd}##.#?}:h}%/}//\%/%%}/${${current_pwd:t}//\%/%%}"
 | 
					  ret_directory="${${${${(@j:/:M)${(@s:/:)current_pwd}##.#?}:h}%/}//\%/%%}/${${current_pwd:t}//\%/%%}"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					unset current_pwd
 | 
				
			||||||
 | 
					
 | 
				
			||||||
print "$ret_directory"
 | 
					print "$ret_directory"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# }
 | 
					# }
 | 
				
			||||||
@@ -16,7 +16,7 @@ prompt_damoekri_precmd() {
 | 
				
			|||||||
  unsetopt XTRACE KSH_ARRAYS
 | 
					  unsetopt XTRACE KSH_ARRAYS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Format PWD.
 | 
					  # Format PWD.
 | 
				
			||||||
  _prompt_damoekri_pwd=$(promptpwd)
 | 
					  _prompt_damoekri_pwd=$(prompt-pwd)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Get Git repository information.
 | 
					  # Get Git repository information.
 | 
				
			||||||
  if (( $+functions[git-info] )); then
 | 
					  if (( $+functions[git-info] )); then
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -84,7 +84,7 @@ function prompt_paradox_precmd {
 | 
				
			|||||||
  unsetopt XTRACE KSH_ARRAYS
 | 
					  unsetopt XTRACE KSH_ARRAYS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Format PWD.
 | 
					  # Format PWD.
 | 
				
			||||||
  _prompt_paradox_pwd=$(promptpwd)
 | 
					  _prompt_paradox_pwd=$(prompt-pwd)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Get Git repository information.
 | 
					  # Get Git repository information.
 | 
				
			||||||
  if (( $+functions[git-info] )); then
 | 
					  if (( $+functions[git-info] )); then
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -82,7 +82,7 @@ function prompt_sorin_precmd {
 | 
				
			|||||||
  unsetopt XTRACE KSH_ARRAYS
 | 
					  unsetopt XTRACE KSH_ARRAYS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Format PWD.
 | 
					  # Format PWD.
 | 
				
			||||||
  _prompt_sorin_pwd=$(promptpwd)
 | 
					  _prompt_sorin_pwd=$(prompt-pwd)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Define prompts.
 | 
					  # Define prompts.
 | 
				
			||||||
  RPROMPT='${editor_info[overwrite]}%(?:: %F{1}⏎%f)${VIM:+" %B%F{6}V%f%b"}'
 | 
					  RPROMPT='${editor_info[overwrite]}%(?:: %F{1}⏎%f)${VIM:+" %B%F{6}V%f%b"}'
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -97,7 +97,9 @@ zstyle ':prezto:module:editor' key-bindings 'emacs'
 | 
				
			|||||||
# Auto set to 'off' on dumb terminals.
 | 
					# Auto set to 'off' on dumb terminals.
 | 
				
			||||||
zstyle ':prezto:module:prompt' theme 'sorin'
 | 
					zstyle ':prezto:module:prompt' theme 'sorin'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Set how themes that use promptpwd function display the pwd, can be 'short', 'long', or 'full'
 | 
					# Set the working directory prompt display length.
 | 
				
			||||||
 | 
					# By default, it is set to 'short'. Set it to 'long' (without '~' expansion)
 | 
				
			||||||
 | 
					# for longer or 'full' (with '~' expansion) for even longer prompt display.
 | 
				
			||||||
# zstyle ':prezto:module:prompt' pwd-length 'short'
 | 
					# zstyle ':prezto:module:prompt' pwd-length 'short'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user