Skip to content

Commit

Permalink
Merge remote-tracking branch 'github/master'
Browse files Browse the repository at this point in the history
* github/master: (61 commits)
  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)
  prompt: update powerlevel10k to latest commit
  ...
  • Loading branch information
Kiril Angov committed Oct 9, 2019
2 parents 4de2e76 + 2873885 commit 71fa904
Show file tree
Hide file tree
Showing 52 changed files with 409 additions and 161 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@
[submodule "modules/prompt/external/powerlevel9k"]
path = modules/prompt/external/powerlevel9k
url = https://github.com/bhilburn/powerlevel9k.git
[submodule "modules/prompt/external/powerlevel10k"]
path = modules/prompt/external/powerlevel10k
url = https://github.com/romkatv/powerlevel10k.git
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ version is 4.3.11.
done
```

Note: If you already have any of the given config files, ln will error. In
simple cases you can add `source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"` to
the bottom of your `.zshrc` to load prezto but keep your config intact. For
more complicated setups, it is recommended that you back up your original
Note: If you already have any of the given configuration files, `ln` will
cause error. In simple cases you can load prezto by adding the line
`source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"` to the bottom of your
`.zshrc` and keep the rest of your Zsh configuration intact. For more
complicated setups, it is recommended that you back up your original
configs and replace them with the provided prezto runcoms.

4. Set Zsh as your default shell:
Expand Down Expand Up @@ -88,8 +89,12 @@ accompanying README files to learn of what is available.
3. Load the theme you like in *~/.zpreztorc* then open a new Zsh terminal
window or tab.

![sorin theme][2]
Note that the 'git' module may be required for special symbols to appear, such as those on the right of the above image. Add `'git'` to the list under `zstyle ':prezto:load' pmodule \ ` in your `.zpreztorc` to enable this module.
![sorin theme][2]
Note that the 'git' module may be required for special symbols to appear,
such as those on the right of the above image. Add `'git'` to the `pmodule`
list (under `zstyle ':prezto:load' pmodule \` in your *~/.zpreztorc*) to
enable this module.

### External Modules

1. By default modules will be loaded from */modules* and */contrib*.
Expand All @@ -99,7 +104,7 @@ accompanying README files to learn of what is available.
Note that module names need to be unique or they will cause an error when
loading.

```console
```sh
zstyle ':prezto:load' pmodule-dirs $HOME/.zprezto-contrib
```

Expand Down
6 changes: 3 additions & 3 deletions modules/archive/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ installed:
- *.7z* requires `7za`.
- *.deb* requires `ar`, `tar`.

Additionally, if `pigz` and/or `pbzip2` are installed, `archive` will use them over
their traditional counterparts, `gzip` and `bzip2` respectively, to take full advantage
of all available CPU cores for compression.
Additionally, if `pigz` and/or `pbzip2` are installed, `archive` will use them
over their traditional counterparts, `gzip` and `bzip2` respectively, to take
full advantage of all available CPU cores for compression.

Alternatives
------------
Expand Down
42 changes: 22 additions & 20 deletions modules/archive/functions/archive
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

# function archive {

local archive_name dir_to_archive _gzip_bin _bzip2_bin
local archive_name path_to_archive _gzip_bin _bzip2_bin _xz_bin

if (( $# != 2 )); then
if (( $# < 2 )); then
cat >&2 <<EOF
usage: $0 [archive_name.zip] [/path/to/include/into/archive]
usage: $0 [archive_name.zip] [/path/to/include/into/archive ...]
Where 'archive.zip' uses any of the following extensions:
Expand All @@ -28,14 +28,8 @@ fi

# strip the path, just in case one is provided for some reason
archive_name="${1:t}"
# use absolute paths, and follow symlinks
dir_to_archive="${2}"

# if the directory doesn't exist, quit. Nothing to archive
if [[ ! -e "${dir_to_archive}" ]]; then
print "$0: file or directory not valid: ${dir_to_archive}" >&2
return 1
fi
# let paths be handled by actual archive helper
path_to_archive="${@:2}"

# here, we check for dropin/multi-threaded replacements
# this should eventually be moved to modules/archive/init.zsh
Expand All @@ -46,21 +40,29 @@ 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'
fi

case "${archive_name}" in
(*.tar.gz|*.tgz) tar -cvf "${archive_name}" --use-compress-program="${_gzip_bin}" "${dir_to_archive}" ;;
(*.tar.bz2|*.tbz|*.tbz2) tar -cvf "${archive_name}" --use-compress-program="${_bzip2_bin}" "${dir_to_archive}" ;;
(*.tar.xz|*.txz) tar -cvJf "${archive_name}" "${dir_to_archive}" ;;
(*.tar.lzma|*.tlz) tar -cvf "${archive_name}" --lzma "${dir_to_archive}" ;;
(*.tar) tar -cvf "${archive_name}" "${dir_to_archive}" ;;
(*.zip|*.jar) zip -r "${archive_name}" "${dir_to_archive}" ;;
(*.rar) rar a "${archive_name}" "${dir_to_archive}" ;;
(*.7z) 7za a "${archive_name}" "${dir_to_archive}" ;;
(*.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 -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}" ;;
(*.rar) rar a "${archive_name}" "${=path_to_archive}" ;;
(*.7z) 7za a "${archive_name}" "${=path_to_archive}" ;;
(*.gz) print "\n.gz is only useful for single files, and does not capture permissions. Use .tar.gz" ;;
(*.bz2) print "\n.bzip2 is only useful for single files, and does not capture permissions. Use .tar.bz2" ;;
(*.xz) print "\n.xz is only useful for single files, and does not capture permissions. Use .tar.xz" ;;
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
5 changes: 0 additions & 5 deletions modules/autosuggestions/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
Autosuggestions
---------------

Integrates zsh-autosuggestions into Prezto.

Autosuggestions
===============

Expand Down
7 changes: 4 additions & 3 deletions modules/command-not-found/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ Command-Not-Found

When you try to use a command that is not available locally, searches
the package manager for a package offering that command and suggests
the proper install command.
the proper install command.

Debian-based and Arch Linux-based distributions use the [`command-not-found`][1] tool.
Debian and Arch Linux based distributions use the [`command-not-found`][1] tool.

macOS uses Homebrew's [`command-not-found` clone][2]. Note that you also need to [follow the instructions to tap the `command-not-found` homebrew repository][3].
macOS uses Homebrew's [`command-not-found` clone][2]. Note that you also need to
[follow the instructions][3] to tap the `command-not-found` homebrew repository.


Authors
Expand Down
27 changes: 24 additions & 3 deletions modules/command-not-found/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,30 @@ if [[ -s '/etc/zsh_command_not_found' ]]; then
# Load command-not-found on Arch Linux-based distributions.
elif [[ -s '/usr/share/doc/pkgfile/command-not-found.zsh' ]]; then
source '/usr/share/doc/pkgfile/command-not-found.zsh'
# Load command-not-found on macOS when homebrew tap is configured.
elif [[ -s '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh' ]]; then
source '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh'
# Load command-not-found on macOS when Homebrew tap is configured.
# To avoid performance penalty, we do not use Homebrew's ruby based command
# lookup mechanism (viz., `brew command command-not-found-init`) and instead
# `find` it ourselves from `TAP_DIRECTORY` defined internally in Homebrew.
elif (( $+commands[brew] )); then
cnf_command=(
"$(brew --repository 2> /dev/null)"/Library/Taps/*/*/cmd/brew-command-not-found-init(|.rb)(.N)
)
if (( $#cnf_command )); then
cache_file="${TMPDIR:-/tmp}/prezto-brew-command-not-found-cache.$UID.zsh"

if [[ "${${(@o)cnf_command}[1]}" -nt "$cache_file" \
|| "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \
|| ! -s "$cache_file" ]]; then
# brew command-not-found-init is slow; cache its output.
brew command-not-found-init >! "$cache_file" 2> /dev/null
fi

source "$cache_file"

unset cache_file
fi

unset cnf_command
# Return if requirements are not found.
else
return 1
Expand Down
13 changes: 13 additions & 0 deletions modules/completion/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ the [zsh-completions][1] project.

This module must be loaded **after** the *utility* module.

Options
-------

- `COMPLETE_IN_WORD` complete from both ends of a word.
- `ALWAYS_TO_END` move cursor to the end of a completed word.
- `PATH_DIRS` perform path search even on command names with slashes.
- `AUTO_MENU` show completion menu on a successive tab press.
- `AUTO_LIST` automatically list choices on ambiguous completion.
- `AUTO_PARAM_SLASH` if completed parameter is a directory, add a trailing slash.
- `EXTENDED_GLOB` needed for file modification glob modifiers with compinit.
- `MENU_COMPLETE` do not autoselect the first completion entry.
- `FLOW_CONTROL` disable start/stop characters in shell editor.

Settings
--------

Expand Down
2 changes: 1 addition & 1 deletion modules/completion/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ zstyle ':completion:*:history-words' remove-all-dups yes
zstyle ':completion:*:history-words' list false
zstyle ':completion:*:history-words' menu yes

# Environmental Variables
# Environment Variables
zstyle ':completion::*:(-command-|export):*' fake-parameters ${${${_comps[(I)-value-*]#*,}%%,*}:#-*-}

# Populate hostname completion. But allow ignoring custom entries from static
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
12 changes: 11 additions & 1 deletion modules/editor/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
Editor
======

Sets key bindings.
Sets editor specific key bindings options and variables.

Options
-------

- `BEEP` beep on error in line editor.

Variables
---------

- `WORDCHARS` treat a given set of characters as part of a word.

Settings
--------
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
Loading

0 comments on commit 71fa904

Please sign in to comment.