mirror of
				https://github.com/dcarrillo/prezto.git
				synced 2025-11-04 12:09:08 +00:00 
			
		
		
		
	Compare commits
	
		
			1 Commits
		
	
	
		
			revision/z
			...
			pull/517-a
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					e3696d2c28 | 
							
								
								
									
										19
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								README.md
									
									
									
									
									
								
							@@ -16,28 +16,23 @@ non-standard core utilities.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        zsh
 | 
					        zsh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  2. Set the path to the Prezto installation directory:
 | 
					  2. Clone the repository:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      ZDOTDIR="${ZDOTDIR:-$HOME}"
 | 
					        git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
 | 
				
			||||||
      PREZTO="$ZDOTDIR/.zprezto"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  3. Clone the repository:
 | 
					  3. Create a new Zsh configuration by copying the Zsh configuration files
 | 
				
			||||||
 | 
					 | 
				
			||||||
        git clone --recursive https://github.com/sorin-ionescu/prezto.git "$PREZTO"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  4. Create a new Zsh configuration by copying the Zsh configuration files
 | 
					 | 
				
			||||||
     provided:
 | 
					     provided:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        setopt EXTENDED_GLOB
 | 
					        setopt EXTENDED_GLOB
 | 
				
			||||||
        for rcfile in "$PREZTO/runcoms/^README.md(.N); do
 | 
					        for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
 | 
				
			||||||
          ln -s "$rcfile" "${ZDOTDIR}/.${rcfile:t}"
 | 
					          ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
 | 
				
			||||||
        done
 | 
					        done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  5. Set Zsh as your default shell:
 | 
					  4. Set Zsh as your default shell:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        chsh -s /bin/zsh
 | 
					        chsh -s /bin/zsh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  6. Open a new Zsh terminal window or tab.
 | 
					  5. Open a new Zsh terminal window or tab.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Troubleshooting
 | 
					### Troubleshooting
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										18
									
								
								init.zsh
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								init.zsh
									
									
									
									
									
								
							@@ -31,7 +31,7 @@ function pmodload {
 | 
				
			|||||||
  pmodules=("$argv[@]")
 | 
					  pmodules=("$argv[@]")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Add functions to $fpath.
 | 
					  # Add functions to $fpath.
 | 
				
			||||||
  fpath=(${pmodules:+$PREZTO/modules/${^pmodules}/functions(/FN)} $fpath)
 | 
					  fpath=(${pmodules:+${ZDOTDIR:-$HOME}/.zprezto/modules/${^pmodules}/functions(/FN)} $fpath)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  function {
 | 
					  function {
 | 
				
			||||||
    local pfunction
 | 
					    local pfunction
 | 
				
			||||||
@@ -40,7 +40,7 @@ function pmodload {
 | 
				
			|||||||
    setopt LOCAL_OPTIONS EXTENDED_GLOB
 | 
					    setopt LOCAL_OPTIONS EXTENDED_GLOB
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Load Prezto functions.
 | 
					    # Load Prezto functions.
 | 
				
			||||||
    for pfunction in $PREZTO/modules/${^pmodules}/functions/$~pfunction_glob; do
 | 
					    for pfunction in ${ZDOTDIR:-$HOME}/.zprezto/modules/${^pmodules}/functions/$~pfunction_glob; do
 | 
				
			||||||
      autoload -Uz "$pfunction"
 | 
					      autoload -Uz "$pfunction"
 | 
				
			||||||
    done
 | 
					    done
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -49,19 +49,19 @@ function pmodload {
 | 
				
			|||||||
  for pmodule in "$pmodules[@]"; do
 | 
					  for pmodule in "$pmodules[@]"; do
 | 
				
			||||||
    if zstyle -t ":prezto:module:$pmodule" loaded 'yes' 'no'; then
 | 
					    if zstyle -t ":prezto:module:$pmodule" loaded 'yes' 'no'; then
 | 
				
			||||||
      continue
 | 
					      continue
 | 
				
			||||||
    elif [[ ! -d "$PREZTO/modules/$pmodule" ]]; then
 | 
					    elif [[ ! -d "${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule" ]]; then
 | 
				
			||||||
      print "$0: no such module: $pmodule" >&2
 | 
					      print "$0: no such module: $pmodule" >&2
 | 
				
			||||||
      continue
 | 
					      continue
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      if [[ -s "$PREZTO/modules/$pmodule/init.zsh" ]]; then
 | 
					      if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule/init.zsh" ]]; then
 | 
				
			||||||
        source "$PREZTO/modules/$pmodule/init.zsh"
 | 
					        source "${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule/init.zsh"
 | 
				
			||||||
      fi
 | 
					      fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (( $? == 0 )); then
 | 
					      if (( $? == 0 )); then
 | 
				
			||||||
        zstyle ":prezto:module:$pmodule" loaded 'yes'
 | 
					        zstyle ":prezto:module:$pmodule" loaded 'yes'
 | 
				
			||||||
      else
 | 
					      else
 | 
				
			||||||
        # Remove the $fpath entry.
 | 
					        # Remove the $fpath entry.
 | 
				
			||||||
        fpath[(r)$PREZTO/modules/${pmodule}/functions]=()
 | 
					        fpath[(r)${ZDOTDIR:-$HOME}/.zprezto/modules/${pmodule}/functions]=()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        function {
 | 
					        function {
 | 
				
			||||||
          local pfunction
 | 
					          local pfunction
 | 
				
			||||||
@@ -71,7 +71,7 @@ function pmodload {
 | 
				
			|||||||
          setopt LOCAL_OPTIONS EXTENDED_GLOB
 | 
					          setopt LOCAL_OPTIONS EXTENDED_GLOB
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          # Unload Prezto functions.
 | 
					          # Unload Prezto functions.
 | 
				
			||||||
          for pfunction in $PREZTO/modules/$pmodule/functions/$~pfunction_glob; do
 | 
					          for pfunction in ${ZDOTDIR:-$HOME}/.zprezto/modules/$pmodule/functions/$~pfunction_glob; do
 | 
				
			||||||
            unfunction "$pfunction"
 | 
					            unfunction "$pfunction"
 | 
				
			||||||
          done
 | 
					          done
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -87,8 +87,8 @@ function pmodload {
 | 
				
			|||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Source the Prezto configuration file.
 | 
					# Source the Prezto configuration file.
 | 
				
			||||||
if [[ -s "$ZDOTDIR/.zpreztorc" ]]; then
 | 
					if [[ -s "${ZDOTDIR:-$HOME}/.zpreztorc" ]]; then
 | 
				
			||||||
  source "$ZDOTDIR/.zpreztorc"
 | 
					  source "${ZDOTDIR:-$HOME}/.zpreztorc"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Disable color and theme in dumb terminals.
 | 
					# Disable color and theme in dumb terminals.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,7 +36,7 @@ unsetopt FLOW_CONTROL      # Disable start/stop characters in shell editor.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Use caching to make completion for cammands such as dpkg and apt usable.
 | 
					# Use caching to make completion for cammands such as dpkg and apt usable.
 | 
				
			||||||
zstyle ':completion::complete:*' use-cache on
 | 
					zstyle ':completion::complete:*' use-cache on
 | 
				
			||||||
zstyle ':completion::complete:*' cache-path "$ZDOTDIR/.zcompcache"
 | 
					zstyle ':completion::complete:*' cache-path "${ZDOTDIR:-$HOME}/.zcompcache"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Case-insensitive (all), partial-word, and then substring completion.
 | 
					# Case-insensitive (all), partial-word, and then substring completion.
 | 
				
			||||||
if zstyle -t ':prezto:module:completion:*' case-sensitive; then
 | 
					if zstyle -t ':prezto:module:completion:*' case-sensitive; then
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,7 +10,7 @@
 | 
				
			|||||||
# Variables
 | 
					# Variables
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
HISTFILE="$ZDOTDIR/.zhistory"    # The path to the history file.
 | 
					HISTFILE="${ZDOTDIR:-$HOME}/.zhistory"       # The path to the history file.
 | 
				
			||||||
HISTSIZE=10000                   # The maximum number of events to save in the internal history.
 | 
					HISTSIZE=10000                   # The maximum number of events to save in the internal history.
 | 
				
			||||||
SAVEHIST=10000                   # The maximum number of events to save in the history file.
 | 
					SAVEHIST=10000                   # The maximum number of events to save in the history file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -61,6 +61,29 @@ system site-packages directory.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'
 | 
					    export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Settings
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### Lazy loading
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					By default, virtualenvwrapper is loaded in lazy mode. This behaviour can be disabled adding the following line to *~/.zpreztorc*:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    zstyle ':prezto:module:python' lazy_venv 'no'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### Automatic virtualenv initialization
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					To enable autoenv, add the following line to *~/.zpreztorc*:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    zstyle ':prezto:module:python' autoenv 'yes'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If a virtualenv is active, and was not activated by autoenv, then autoenv does nothing.
 | 
				
			||||||
 | 
					Otherwise, autoenv activated or deactivates a virtual environment whenever a directory is changed; based on the following priority:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    1. Name specified in a file named *.venv* in the cwd.
 | 
				
			||||||
 | 
					    2. *.venv* file in git root. If folder is inside git repository.
 | 
				
			||||||
 | 
					    3. Name of git root folder.
 | 
				
			||||||
 | 
					    4. No virtualenv.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Aliases
 | 
					Aliases
 | 
				
			||||||
-------
 | 
					-------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,17 +31,66 @@ if (( ! $+commands[python] && ! $+commands[pyenv] )); then
 | 
				
			|||||||
  return 1
 | 
					  return 1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					local venv_script=virtualenvwrapper
 | 
				
			||||||
 | 
					if zstyle -T ':prezto:module:python' lazy_venv; then
 | 
				
			||||||
 | 
					    venv_script+=_lazy
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Load virtualenvwrapper into the shell session.
 | 
					# Load virtualenvwrapper into the shell session.
 | 
				
			||||||
if (( $+commands[virtualenvwrapper_lazy.sh] )); then
 | 
					if (( $+commands[$venv_script.sh] )); then
 | 
				
			||||||
  # Set the directory where virtual environments are stored.
 | 
					  # Set the directory where virtual environments are stored.
 | 
				
			||||||
  export WORKON_HOME="$HOME/.virtualenvs"
 | 
					  export WORKON_HOME="$HOME/.virtualenvs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Disable the virtualenv prompt.
 | 
					  # Disable the virtualenv prompt.
 | 
				
			||||||
  VIRTUAL_ENV_DISABLE_PROMPT=1
 | 
					  VIRTUAL_ENV_DISABLE_PROMPT=1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  source "$commands[virtualenvwrapper_lazy.sh]"
 | 
					  source "$commands[$venv_script.sh]"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function autoenv {
 | 
				
			||||||
 | 
					  #Don't run in shell scripts etc.
 | 
				
			||||||
 | 
					  if [[ $ZSH_SUBSHELL -ne 0 ]]; then
 | 
				
			||||||
 | 
					    return
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  #Don't run if currently in virtual env not set by autoenv
 | 
				
			||||||
 | 
					  if (( ($+VIRTUAL_ENV)  && !($+AUTOENV) )); then
 | 
				
			||||||
 | 
					    return
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  local name=""
 | 
				
			||||||
 | 
					  if [[ -f .venv ]]; then
 | 
				
			||||||
 | 
					    #.venv file in current dir gets highest priority
 | 
				
			||||||
 | 
					    name=$(<.venv)
 | 
				
			||||||
 | 
					  elif is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then
 | 
				
			||||||
 | 
					    local gitroot="$(git rev-parse --show-toplevel 2> /dev/null)"
 | 
				
			||||||
 | 
					    if [ -f "$gitroot/.venv" ]; then
 | 
				
			||||||
 | 
					      #If there is a .venv file in gitroot
 | 
				
			||||||
 | 
					      name=$(<$gitroot/.venv)
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      #Else use the name of the folder as venv name
 | 
				
			||||||
 | 
					      name=$gitroot:t
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  local venv_name="$VIRTUAL_ENV:t"
 | 
				
			||||||
 | 
					  if [[ $name != $venv_name ]]; then
 | 
				
			||||||
 | 
					    if [[ -z $name ]]; then
 | 
				
			||||||
 | 
					      deactivate && unset AUTOENV
 | 
				
			||||||
 | 
					      return
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if [[ -d "$WORKON_HOME/$name" ]]; then
 | 
				
			||||||
 | 
					      workon $name && export AUTOENV=1
 | 
				
			||||||
 | 
					      return
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if zstyle -T ':prezto:module:python' autoenv; then
 | 
				
			||||||
 | 
					    add-zsh-hook chpwd autoenv
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Aliases
 | 
					# Aliases
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,7 @@
 | 
				
			|||||||
# Execute code that does not affect the current session in the background.
 | 
					# Execute code that does not affect the current session in the background.
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  # Compile the completion dump to increase startup speed.
 | 
					  # Compile the completion dump to increase startup speed.
 | 
				
			||||||
  zcompdump="$ZDOTDIR/.zcompdump"
 | 
					  zcompdump="${ZDOTDIR:-$HOME}/.zcompdump"
 | 
				
			||||||
  if [[ -s "$zcompdump" && (! -s "${zcompdump}.zwc" || "$zcompdump" -nt "${zcompdump}.zwc") ]]; then
 | 
					  if [[ -s "$zcompdump" && (! -s "${zcompdump}.zwc" || "$zcompdump" -nt "${zcompdump}.zwc") ]]; then
 | 
				
			||||||
    zcompile "$zcompdump"
 | 
					    zcompile "$zcompdump"
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,10 +10,3 @@ if [[ "$SHLVL" -eq 1 && ! -o LOGIN ]]; then
 | 
				
			|||||||
  source "${ZDOTDIR:-$HOME}/.zprofile"
 | 
					  source "${ZDOTDIR:-$HOME}/.zprofile"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# Zsh
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
ZDOTDIR="${ZDOTDIR:-$HOME}"
 | 
					 | 
				
			||||||
PREZTO="$ZDOTDIR/.zprezto"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,8 +6,8 @@
 | 
				
			|||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Source Prezto.
 | 
					# Source Prezto.
 | 
				
			||||||
if [[ -s "$PREZTO/init.zsh" ]]; then
 | 
					if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
 | 
				
			||||||
  source "$PREZTO/init.zsh"
 | 
					  source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Customize to your needs...
 | 
					# Customize to your needs...
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user