Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
* upstream/master:
  utility: fix safe-ops commands
  tmux: ignore tmux autostart in vscode terminal (sorin-ionescu#1718)
  node, python, ruby: update docs about new envars
  python: improve PYENV_ROOT detection
  node: support environment variables NVM_DIR and NODENV_ROOT
  ruby: support environment variable RBENV_ROOT
  directory: update docs to clarify it doesn't really set AUTO_NAME_DIRS (sorin-ionescu#1740)
  history: Permit use of previously set HISTFILE
  prompt: update powerlevel10k submodule to the latest commit (sorin-ionescu#1738)
  prompt: update zsh-async to fix an infinite loop (sorin-ionescu#1734)
  syntax-highlighting: update external dependency
  prompt: update powerlevel10k submodule to the latest commit
  prompt: update powerlevel10k submodule to the latest commit
  prompt: update powerlevel10k submodule to the latest commit
  Resolves 1641 - Checks whether the prompt is set to be managed or not. (sorin-ionescu#1723)
  prompt: update powerlevel10k submodule to the latest commit (sorin-ionescu#1727)
  prompt: update powerlevel10k submodule to the latest commit (sorin-ionescu#1726)
  prompt: update powerlevel10k submodule to the latest commit (sorin-ionescu#1717)
  prompt: update powerlevel10k submodule (sorin-ionescu#1715)
  • Loading branch information
ezintz committed Sep 22, 2019
2 parents d7116d5 + 2873885 commit f0af665
Show file tree
Hide file tree
Showing 25 changed files with 116 additions and 41 deletions.
1 change: 0 additions & 1 deletion modules/directory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Options
- `PUSHD_SILENT` does not print the directory stack after `pushd` or `popd`.
- `PUSHD_TO_HOME` pushes to the home directory when no argument is given.
- `CDABLE_VARS` changes directory to a path stored in a variable.
- `AUTO_NAME_DIRS` auto adds variable-stored paths to `~` list.
- `MULTIOS` writes to multiple descriptors.
- `EXTENDED_GLOB` uses extended globbing syntax.
- `CLOBBER` does not overwrite existing files with `>` and `>>`. Use `>!` and
Expand Down
42 changes: 23 additions & 19 deletions modules/editor/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -91,28 +91,32 @@ function bindkey-all {
# Exposes information about the Zsh Line Editor via the $editor_info associative
# array.
function editor-info {
# Clean up previous $editor_info.
unset editor_info
typeset -gA editor_info

if [[ "$KEYMAP" == 'vicmd' ]]; then
zstyle -s ':prezto:module:editor:info:keymap:alternate' format 'REPLY'
editor_info[keymap]="$REPLY"
else
zstyle -s ':prezto:module:editor:info:keymap:primary' format 'REPLY'
editor_info[keymap]="$REPLY"

if [[ "$ZLE_STATE" == *overwrite* ]]; then
zstyle -s ':prezto:module:editor:info:keymap:primary:overwrite' format 'REPLY'
editor_info[overwrite]="$REPLY"
# Ensure that we're going to set the editor-info for prompts that
# are prezto managed and/or compatible.
if zstyle -t ':prezto:module:prompt' managed; then
# Clean up previous $editor_info.
unset editor_info
typeset -gA editor_info

if [[ "$KEYMAP" == 'vicmd' ]]; then
zstyle -s ':prezto:module:editor:info:keymap:alternate' format 'REPLY'
editor_info[keymap]="$REPLY"
else
zstyle -s ':prezto:module:editor:info:keymap:primary:insert' format 'REPLY'
editor_info[overwrite]="$REPLY"
zstyle -s ':prezto:module:editor:info:keymap:primary' format 'REPLY'
editor_info[keymap]="$REPLY"

if [[ "$ZLE_STATE" == *overwrite* ]]; then
zstyle -s ':prezto:module:editor:info:keymap:primary:overwrite' format 'REPLY'
editor_info[overwrite]="$REPLY"
else
zstyle -s ':prezto:module:editor:info:keymap:primary:insert' format 'REPLY'
editor_info[overwrite]="$REPLY"
fi
fi
fi

unset REPLY
zle zle-reset-prompt
unset REPLY
zle zle-reset-prompt
fi
}
zle -N editor-info

Expand Down
2 changes: 1 addition & 1 deletion modules/history/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ setopt HIST_BEEP # Beep when accessing non-existent history.
# Variables
#

HISTFILE="${ZDOTDIR:-$HOME}/.zhistory" # The path to the history file.
HISTFILE="${HISTFILE:-${ZDOTDIR:-$HOME}/.zhistory}" # The path to the history file.
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.

Expand Down
6 changes: 6 additions & 0 deletions modules/node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,19 @@ nvm
[nvm][5] allows for managing multiple, isolated Node.js installations in the
home directory.

This will be loaded automatically if nvm is installed in `$NVM_DIR`,
`~/.nvm`, or nvm is installed with homebrew.

nodenv
------

[nodenv][6] does one thing well. nodenv is concerned solely with switching
Node versions. It's simple and predictable, Just Works, and is rock solid in
production. nodenv is forked from the popular [rbenv][7].

This will be loaded automatically if nodenv is installed in `$NODENV_ROOT`,
`~/.nodenv`, or `nodenv` is on the path.

Functions
---------

Expand Down
8 changes: 4 additions & 4 deletions modules/node/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#

# Load manually installed NVM into the shell session.
if [[ -s "$HOME/.nvm/nvm.sh" ]]; then
source "$HOME/.nvm/nvm.sh"
if [[ -s "${NVM_DIR:=$HOME/.nvm}/nvm.sh" ]]; then
source "${NVM_DIR}/nvm.sh"

# Load package manager installed NVM into the shell session.
elif (( $+commands[brew] )) && \
Expand All @@ -17,8 +17,8 @@ elif (( $+commands[brew] )) && \
unset nvm_prefix

# Load manually installed nodenv into the shell session.
elif [[ -s "$HOME/.nodenv/bin/nodenv" ]]; then
path=("$HOME/.nodenv/bin" $path)
elif [[ -s "${NODENV_ROOT:=$HOME/.nodenv}/bin/nodenv" ]]; then
path=("${NODENV_ROOT}/bin" $path)
eval "$(nodenv init - --no-rehash zsh)"

# Load package manager installed nodenv into the shell session.
Expand Down
16 changes: 16 additions & 0 deletions modules/prompt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,22 @@ A prompt theme is an autoloadable function file with a special name,
project, themes **should** be placed in the *modules/prompt/functions*
directory.

### Required Variables

To ensure that your function works with the editor-info module you'll need to
set the following variable:

```
# Tell prezto we can manage this prompt
zstyle ':prezto:module:prompt' managed 'yes'
```

This is to ensure compatibility with outside prompts, while allowing prezto
and prezto-compatible prompts to take full advantage of the editor module.
This should be set in the `prompt_name_setup` function after you've added
any additional hooks with `add-zsh-hook precmd prompt_name_precmd`. See below
for additional information about functions and hooks.

### Theme Functions

There are three theme functions, a setup function, a help function, and
Expand Down
1 change: 1 addition & 0 deletions modules/prompt/functions/prompt-pwd
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ unset current_pwd
print "$ret_directory"

# }
# vim: ft=zsh
4 changes: 4 additions & 0 deletions modules/prompt/functions/prompt_cloud_setup
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ function prompt_cloud_setup {
# Add hook for calling git-info before each command.
add-zsh-hook precmd prompt_cloud_precmd

# Tell prezto we can manage this prompt
zstyle ':prezto:module:prompt' managed 'yes'

# Set git-info parameters.
zstyle ':prezto:module:git:info' verbose 'yes'
zstyle ':prezto:module:git:info:dirty' format "%%B%F{$secondary_color}]%f%%b %F{yellow}⚡%f"
Expand All @@ -119,3 +122,4 @@ function prompt_cloud_setup {
}

prompt_cloud_setup "$@"
# vim: ft=zsh
4 changes: 4 additions & 0 deletions modules/prompt/functions/prompt_damoekri_setup
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ function prompt_damoekri_setup {
# Add hook for calling git-info and ruby-info before each command.
add-zsh-hook precmd prompt_damoekri_precmd

# Tell prezto we can manage this prompt
zstyle ':prezto:module:prompt' managed 'yes'

# Set editor-info parameters.
zstyle ':prezto:module:editor:info:keymap:primary' format ' %F{green}»%f'

Expand All @@ -63,3 +66,4 @@ function prompt_damoekri_setup {
}

prompt_damoekri_setup "$@"
# vim: ft=zsh
4 changes: 4 additions & 0 deletions modules/prompt/functions/prompt_giddie_setup
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ function prompt_giddie_setup {
# Add hook to set up prompt parameters before each command.
add-zsh-hook precmd prompt_giddie_precmd

# Tell prezto we can manage this prompt
zstyle ':prezto:module:prompt' managed 'yes'

# Set editor-info parameters.
zstyle ':prezto:module:editor:info:completing' format '%F{green}...%f'
zstyle ':prezto:module:editor:info:keymap:alternate' format '%F{yellow}--- COMMAND ---%f'
Expand Down Expand Up @@ -74,3 +77,4 @@ function prompt_giddie_setup {
}

prompt_giddie_setup "$@"
# vim: ft=zsh
4 changes: 4 additions & 0 deletions modules/prompt/functions/prompt_kylewest_setup
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ function prompt_kylewest_setup {
# Add hook for calling git-info before each command.
add-zsh-hook precmd prompt_kylewest_precmd

# Tell prezto we can manage this prompt
zstyle ':prezto:module:prompt' managed 'yes'

# Set editor-info parameters.
zstyle ':prezto:module:editor:info:completing' format '%B%F{red}...%f%b'
zstyle ':prezto:module:editor:info:keymap:primary' format "%B%F{green}❯%f%b"
Expand All @@ -63,3 +66,4 @@ function prompt_kylewest_setup {
}

prompt_kylewest_setup "$@"
# vim: ft=zsh
4 changes: 4 additions & 0 deletions modules/prompt/functions/prompt_minimal_setup
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ function prompt_minimal_setup {
# Add hook for calling vcs_info before each command.
add-zsh-hook precmd prompt_minimal_precmd

# Tell prezto we can manage this prompt
zstyle ':prezto:module:prompt' managed 'yes'

# Set vcs_info parameters.
zstyle ':vcs_info:*' enable bzr git hg svn
zstyle ':vcs_info:*' check-for-changes true
Expand All @@ -57,3 +60,4 @@ function prompt_minimal_preview {
}

prompt_minimal_setup "$@"
# vim: ft=zsh
4 changes: 4 additions & 0 deletions modules/prompt/functions/prompt_nicoulaj_setup
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ function prompt_nicoulaj_setup {
# Add hook for calling vcs_info before each command.
add-zsh-hook precmd prompt_nicoulaj_precmd

# Tell prezto we can manage this prompt
zstyle ':prezto:module:prompt' managed 'yes'

# Customizable parameters.
local max_path_chars=30
local user_char=''
Expand All @@ -58,3 +61,4 @@ function prompt_nicoulaj_setup {
}

prompt_nicoulaj_setup "$@"
# vim: ft=zsh
4 changes: 4 additions & 0 deletions modules/prompt/functions/prompt_paradox_setup
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ function prompt_paradox_setup {
add-zsh-hook preexec prompt_paradox_preexec
add-zsh-hook precmd prompt_paradox_precmd

# Tell prezto we can manage this prompt
zstyle ':prezto:module:prompt' managed 'yes'

# Set editor-info parameters.
zstyle ':prezto:module:editor:info:completing' format '%B%F{red}...%f%b'
zstyle ':prezto:module:editor:info:keymap:primary' format '%B%F{blue}❯%f%b'
Expand Down Expand Up @@ -154,3 +157,4 @@ ${(e)$(prompt_paradox_build_prompt)}
}

prompt_paradox_setup "$@"
# vim: ft=zsh
4 changes: 4 additions & 0 deletions modules/prompt/functions/prompt_peepcode_setup
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ function prompt_peepcode_setup {
# Add a hook for calling info functions before each command.
add-zsh-hook precmd prompt_peepcode_precmd

# Tell prezto we can manage this prompt
zstyle ':prezto:module:prompt' managed 'yes'

# Set git-info parameters.
zstyle ':prezto:module:git:info' verbose 'no'
zstyle ':prezto:module:git:info:action' format ' +%s'
Expand Down Expand Up @@ -83,3 +86,4 @@ function prompt_peepcode_preview {
}

prompt_peepcode_setup "$@"
# vim: ft=zsh
4 changes: 4 additions & 0 deletions modules/prompt/functions/prompt_skwp_setup
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ function prompt_skwp_setup {
# Add hook to set up prompt parameters before each command.
add-zsh-hook precmd prompt_skwp_precmd

# Tell prezto we can manage this prompt
zstyle ':prezto:module:prompt' managed 'yes'

# Use extended color pallete if available.
if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then
_prompt_skwp_colors=(
Expand Down Expand Up @@ -73,3 +76,4 @@ function prompt_skwp_setup {
}

prompt_skwp_setup "$@"
# vim: ft=zsh
4 changes: 4 additions & 0 deletions modules/prompt/functions/prompt_smiley_setup
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ function prompt_smiley_setup {
# Add hook for calling git-info before each command.
add-zsh-hook precmd prompt_smiley_precmd

# Tell prezto we can manage this prompt
zstyle ':prezto:module:prompt' managed 'yes'

# Set editor-info parameters.
zstyle ':prezto:module:editor:info:completing' format '%B%F{red}...%f%b'

Expand All @@ -63,3 +66,4 @@ function prompt_smiley_setup {
}

prompt_smiley_setup "$@"
# vim: ft=zsh
4 changes: 4 additions & 0 deletions modules/prompt/functions/prompt_sorin_setup
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ function prompt_sorin_setup {
# Add hook for calling git-info before each command.
add-zsh-hook precmd prompt_sorin_precmd

# Tell prezto we can manage this prompt
zstyle ':prezto:module:prompt' managed 'yes'

# Set editor-info parameters.
zstyle ':prezto:module:editor:info:completing' format '%B%F{7}...%f%b'
zstyle ':prezto:module:editor:info:keymap:primary' format ' %B%F{1}❯%F{3}❯%F{2}❯%f%b'
Expand Down Expand Up @@ -176,3 +179,4 @@ function prompt_sorin_preview {
}

prompt_sorin_setup "$@"
# vim: ft=zsh
4 changes: 4 additions & 0 deletions modules/prompt/functions/prompt_steeef_setup
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ function prompt_steeef_setup {
# Add hook for calling vcs_info before each command.
add-zsh-hook precmd prompt_steeef_precmd

# Tell prezto we can manage this prompt
zstyle ':prezto:module:prompt' managed 'yes'

# Use extended color pallete if available.
if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then
_prompt_steeef_colors=(
Expand Down Expand Up @@ -104,3 +107,4 @@ function prompt_steeef_preview {
}

prompt_steeef_setup "$@"
# vim: ft=zsh
3 changes: 3 additions & 0 deletions modules/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ execution of `pyenv`.

Install Python versions with `pyenv install` into `~/.pyenv/versions`.

This will be loaded automatically if pyenv is installed to `$PYENV_ROOT`,
`~/.pyenv`, or if the `pyenv` command is on the path.

Local Package Installation
--------------------------

Expand Down
13 changes: 4 additions & 9 deletions modules/python/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,12 @@
#

# Load manually installed pyenv into the path
if [[ -n "$PYENV_ROOT" && -s "$PYENV_ROOT/bin/pyenv" ]]; then
path=("$PYENV_ROOT/bin" $path)
elif [[ -s "$HOME/.pyenv/bin/pyenv" ]]; then
path=("$HOME/.pyenv/bin" $path)
fi
if [[ -s "${PYENV_ROOT:=$HOME/.pyenv}/bin/pyenv" ]]; then
path=("${PYENV_ROOT}/bin" $path)
eval "$(pyenv init - --no-rehash zsh)"

# Load pyenv into the current python session
if (( $+commands[pyenv] )); then
if [[ -z "$PYENV_ROOT" ]]; then
export PYENV_ROOT=$(pyenv root)
fi
elif (( $+commands[pyenv] )); then
eval "$(pyenv init - --no-rehash zsh)"

# Prepend PEP 370 per user site packages directory, which defaults to
Expand Down
3 changes: 3 additions & 0 deletions modules/ruby/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ multiple, isolated Ruby installations in the home directory.
While it is not as feature rich as RVM, it is not loaded into the shell and is
not known to cause conflicts with shell scripts.

This will be loaded automatically if rbenv is installed to `$RBENV_ROOT`,
`~/.rbenv`, or if the `rbenv` command is on the path.

chruby
------

Expand Down
4 changes: 2 additions & 2 deletions modules/ruby/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ if [[ -s "$HOME/.rvm/scripts/rvm" ]]; then
source "$HOME/.rvm/scripts/rvm"

# Load manually installed rbenv into the shell session.
elif [[ -s "$HOME/.rbenv/bin/rbenv" ]]; then
path=("$HOME/.rbenv/bin" $path)
elif [[ -s "${RBENV_ROOT:=$HOME/.rbenv}/bin/rbenv" ]]; then
path=("${RBENV_ROOT}/bin" $path)
eval "$(rbenv init - --no-rehash zsh)"

# Load package manager installed rbenv into the shell session.
Expand Down
2 changes: 1 addition & 1 deletion modules/tmux/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if ([[ "$TERM_PROGRAM" = 'iTerm.app' ]] && \
_tmux_iterm_integration='-CC'
fi

if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" && -z "$INSIDE_EMACS" && -z "$VSCODE_PID" ]] && ( \
if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" && -z "$INSIDE_EMACS" && "$TERM_PROGRAM" != "vscode" ]] && ( \
( [[ -n "$SSH_TTY" ]] && zstyle -t ':prezto:module:tmux:auto-start' remote ) ||
( [[ -z "$SSH_TTY" ]] && zstyle -t ':prezto:module:tmux:auto-start' local ) \
); then
Expand Down
8 changes: 4 additions & 4 deletions modules/utility/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ alias mvi="${aliases[mv]:-mv} -i"
alias cpi="${aliases[cp]:-cp} -i"
alias lni="${aliases[ln]:-ln} -i"
if zstyle -T ':prezto:module:utility' safe-ops; then
alias rm='rmi'
alias mv='mvi'
alias cp='cpi'
alias ln='lni'
alias rm="${aliases[rm]:-rm} -i"
alias mv="${aliases[mv]:-mv} -i"
alias cp="${aliases[cp]:-cp} -i"
alias ln="${aliases[ln]:-ln} -i"
fi

# ls
Expand Down

0 comments on commit f0af665

Please sign in to comment.