Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
* upstream/master: (41 commits)
  environment: apply `stty -ixon` only to tty (sorin-ionescu#1771)
  Allow mapping Ctrl+S and Ctrl+Q shortcuts (sorin-ionescu#1750)
  prompt: update powerlevel10k submodule to the latest commit (sorin-ionescu#1768)
  prompt: update powerlevel10k submodule to the latest commit (sorin-ionescu#1761)
  prompt: update powerlevel10k submodule to the latest commit (sorin-ionescu#1757)
  homebrew: add alias `brewL`
  Remove documentation for obsolete `brewC` alias
  Init submodules when using zprezto-update (sorin-ionescu#1713)
  Remove alias for invalid `brew cleanup --force`
  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
  ...
  • Loading branch information
Gee-Bee committed Jan 9, 2020
2 parents e63f93c + 98c2e6e commit e0b403b
Show file tree
Hide file tree
Showing 44 changed files with 196 additions and 76 deletions.
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
[submodule "modules/prompt/external/powerlevel9k"]
path = modules/prompt/external/powerlevel9k
url = https://github.com/bhilburn/powerlevel9k.git
[submodule "modules/autosuggestions/external"]
path = modules/autosuggestions/external
url = https://github.com/tarruda/zsh-autosuggestions
[submodule "modules/prompt/external/powerlevel10k"]
path = modules/prompt/external/powerlevel10k
url = https://github.com/romkatv/powerlevel10k.git
[submodule "modules/base16/base16-shell"]
path = modules/base16/base16-shell
url = https://github.com/chriskempson/base16-shell.git
2 changes: 1 addition & 1 deletion init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function zprezto-update {
printf "There is an update available. Trying to pull.\n\n"
if git pull --ff-only; then
printf "Syncing submodules\n"
git submodule update --recursive
git submodule update --init --recursive
return $?
else
cannot-fast-forward
Expand Down
14 changes: 11 additions & 3 deletions modules/archive/functions/archive
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

# function archive {

local archive_name path_to_archive _gzip_bin _bzip2_bin
local archive_name path_to_archive _gzip_bin _bzip2_bin _xz_bin

if (( $# < 2 )); then
cat >&2 <<EOF
Expand Down Expand Up @@ -40,7 +40,15 @@ else
_gzip_bin='gzip'
fi

if (( $+commands[pbzip2] )); then
if (( $+commands[pixz] )); then
_xz_bin='pixz'
else
_xz_bin='xz'
fi

if (( $+commands[lbzip2] )); then
_bzip2_bin='lbzip2'
elif (( $+commands[pbzip2] )); then
_bzip2_bin='pbzip2'
else
_bzip2_bin='bzip2'
Expand All @@ -49,7 +57,7 @@ fi
case "${archive_name}" in
(*.tar.gz|*.tgz) tar -cvf "${archive_name}" --use-compress-program="${_gzip_bin}" "${=path_to_archive}" ;;
(*.tar.bz2|*.tbz|*.tbz2) tar -cvf "${archive_name}" --use-compress-program="${_bzip2_bin}" "${=path_to_archive}" ;;
(*.tar.xz|*.txz) tar -cvJf "${archive_name}" "${=path_to_archive}" ;;
(*.tar.xz|*.txz) tar -cvf "${archive_name}" --use-compress-program="${_xz_bin}" "${=path_to_archive}" ;;
(*.tar.lzma|*.tlz) tar -cvf "${archive_name}" --lzma "${=path_to_archive}" ;;
(*.tar) tar -cvf "${archive_name}" "${=path_to_archive}" ;;
(*.zip|*.jar) zip -r "${archive_name}" "${=path_to_archive}" ;;
Expand Down
36 changes: 29 additions & 7 deletions modules/archive/functions/unarchive
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ local success
local file_name
local file_path
local extract_dir
local _gzip_bin _bzip2_bin _xz_bin

if (( $# == 0 )); then
cat >&2 <<EOF
Expand All @@ -30,6 +31,29 @@ if [[ "$1" == "-r" || "$1" == "--remove" ]]; then
shift
fi

# here, we check for dropin/multi-threaded replacements
# this should eventually be moved to modules/archive/init.zsh
# as a global alias
if (( $+commands[pigz] )); then
_gzip_bin='pigz'
else
_gzip_bin='gzip'
fi

if (( $+commands[pixz] )); then
_xz_bin='pixz'
else
_xz_bin='xz'
fi

if (( $+commands[lbzip2] )); then
_bzip2_bin='lbzip2'
elif (( $+commands[pbzip2] )); then
_bzip2_bin='pbzip2'
else
_bzip2_bin='bzip2'
fi

while (( $# > 0 )); do
if [[ ! -s "$1" ]]; then
print "$0: file not valid: $1" >&2
Expand All @@ -42,15 +66,13 @@ while (( $# > 0 )); do
file_path="${1:A}"
extract_dir="${file_name:r}"
case "$1:l" in
(*.tar.gz|*.tgz) tar xvzf "$1" ;;
(*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;;
(*.tar.xz|*.txz) tar --xz --help &> /dev/null \
&& tar --xz -xvf "$1" \
|| xzcat "$1" | tar xvf - ;;
(*.tar.gz|*.tgz) tar -xvf "$1" --use-compress-program="${_gzip_bin}" ;;
(*.tar.bz2|*.tbz|*.tbz2) tar -xvf "$1" --use-compress-program="${_bzip2_bin}" ;;
(*.tar.xz|*.txz) tar -xvf "$1" --use-compress-program="${_xz_bin}" ;;
(*.tar.zma|*.tlz) tar --lzma --help &> /dev/null \
&& tar --lzma -xvf "$1" \
|| lzcat "$1" | tar xvf - ;;
(*.tar) tar xvf "$1" ;;
|| lzcat "$1" | tar -xvf - ;;
(*.tar) tar -xvf "$1" ;;
(*.gz) gunzip "$1" ;;
(*.bz2) bunzip2 "$1" ;;
(*.xz) unxz "$1" ;;
Expand Down
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
48 changes: 27 additions & 21 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 Expand Up @@ -269,9 +273,11 @@ bindkey -d
# Emacs Key Bindings
#

for key in "$key_info[Escape]"{B,b} "${(s: :)key_info[ControlLeft]}"
for key in "$key_info[Escape]"{B,b} "${(s: :)key_info[ControlLeft]}" \
"${key_info[Escape]}${key_info[Left]}"
bindkey -M emacs "$key" emacs-backward-word
for key in "$key_info[Escape]"{F,f} "${(s: :)key_info[ControlRight]}"
for key in "$key_info[Escape]"{F,f} "${(s: :)key_info[ControlRight]}" \
"${key_info[Escape]}${key_info[Right]}"
bindkey -M emacs "$key" emacs-forward-word

# Kill to the beginning of the line.
Expand Down
3 changes: 3 additions & 0 deletions modules/environment/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ setopt INTERACTIVE_COMMENTS # Enable comments in interactive shell.
setopt RC_QUOTES # Allow 'Henry''s Garage' instead of 'Henry'\''s Garage'.
unsetopt MAIL_WARNING # Don't print a warning message if a mail file has been accessed.

# Allow mapping Ctrl+S and Ctrl+Q shortcuts
[[ -n ${TTY:-} && $+commands[stty] == 1 ]] && stty -ixon <$TTY >$TTY

#
# Jobs
#
Expand Down
2 changes: 1 addition & 1 deletion modules/fasd/external
Submodule external updated 4 files
+8 −26 README.md
+3 −15 fasd
+61 −73 fasd.1
+7 −19 fasd.1.md
5 changes: 3 additions & 2 deletions modules/history/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ Options

- `BANG_HIST` treats the **!** character specially during expansion.
- `EXTENDED_HISTORY` writes the history file in the *:start:elapsed;command* format.
- `INC_APPEND_HISTORY` writes to the history file immediately, not when the shell exits.
- `SHARE_HISTORY` shares history between all sessions.
- `SHARE_HISTORY` shares history between all sessions. Note that
`SHARE_HISTORY`, `INC_APPEND_HISTORY`, and `INC_APPEND_HISTORY_TIME` are
mutually exclusive.
- `HIST_EXPIRE_DUPS_FIRST` expires a duplicate event first when trimming history.
- `HIST_IGNORE_DUPS` does not record an event that was just recorded again.
- `HIST_IGNORE_ALL_DUPS` deletes an old recorded event if a new event is a duplicate.
Expand Down
3 changes: 1 addition & 2 deletions modules/history/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

setopt BANG_HIST # Treat the '!' character specially during expansion.
setopt EXTENDED_HISTORY # Write the history file in the ':start:elapsed;command' format.
setopt INC_APPEND_HISTORY # Write to the history file immediately, not when the shell exits.
setopt SHARE_HISTORY # Share history between all sessions.
setopt HIST_EXPIRE_DUPS_FIRST # Expire a duplicate event first when trimming history.
setopt HIST_IGNORE_DUPS # Do not record an event that was just recorded again.
Expand All @@ -27,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
2 changes: 1 addition & 1 deletion modules/homebrew/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Aliases
### Homebrew

- `brewc` cleans outdated brews and their cached archives.
- `brewC` cleans outdated brews, including keg-only, and their cached archives.
- `brewi` installs a formula.
- `brewL` lists installed formulae that are not dependencies of another installed formula.
- `brewl` lists installed formulae.
- `brewo` lists brews which have an update available.
- `brews` searches for a formula.
Expand Down
4 changes: 2 additions & 2 deletions modules/homebrew/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fi
# Variables
#

# Load standard Homebrew shellenv into the shell session.
# Load standard Homebrew shellenv into the shell session.
# Load 'HOMEBREW_' prefixed variables only. Avoid loading 'PATH' related
# variables as they are already handled in standard zsh configuration.
if (( $+commands[brew] )); then
Expand All @@ -27,8 +27,8 @@ fi

# Homebrew
alias brewc='brew cleanup'
alias brewC='brew cleanup --force'
alias brewi='brew install'
alias brewL='brew leaves'
alias brewl='brew list'
alias brewo='brew outdated'
alias brews='brew search'
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
2 changes: 1 addition & 1 deletion modules/node/functions/node-info
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ elif (( $+commands[node] )) ; then
version="${$(node -v)#v}"
fi

if [[ "$version" != (none|) ]]; then
if [[ "$version" != (none|system) ]]; then
zstyle -s ':prezto:module:node:info:version' format 'version_format'
zformat -f version_formatted "$version_format" "v:$version"
node_info[version]="$version_formatted"
Expand Down
10 changes: 5 additions & 5 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 All @@ -34,7 +34,7 @@ fi
typeset -A compl_commands=(
npm 'npm completion'
grunt 'grunt --completion=zsh'
gupl 'gulp --completion=zsh'
gulp 'gulp --completion=zsh'
)

for compl_command in "${(k)compl_commands[@]}"; do
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
2 changes: 1 addition & 1 deletion modules/prompt/external/async
Submodule async updated 2 files
+6 −1 .travis.yml
+18 −2 async.zsh
1 change: 1 addition & 0 deletions modules/prompt/external/powerlevel10k
Submodule powerlevel10k added at 345d06
2 changes: 1 addition & 1 deletion modules/prompt/external/pure
Submodule pure updated 2 files
+1 −1 package.json
+1 −0 readme.md
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
Loading

0 comments on commit e0b403b

Please sign in to comment.