Skip to content

Commit

Permalink
Merging the latest changes (#1)
Browse files Browse the repository at this point in the history
* Ignore tmux autostart in vscode terminal

* Allow users to easily define LS_COLORS and LSCOLORS (sorin-ionescu#1546)

* Feat (git): add an alias displaying the commits yet to be applied to upstream (sorin-ionescu#1565)

* Revert "Only call reset-prompt when the appropriate zstyle is set"

This reverts commit 6d00fdf.

As unfortunate as it is, this workaround was a hack and doesn't take
into account prompts like spaceship which don't use $editor_info but
rely on $KEYMAP directly. We'll need to find a more consistent solution
to fix this.

* Add proper prompt_opts to smiley prompt

* Rename "Mac OS X" to "macOS" in comments

This only changes references in text for human consumption. It leaves
out renaming paths because that can cause breaking changes.

Related issue sorin-ionescu#1449.

* command-not-found: Directly source homebrew command-not-found handler

Fixes sorin-ionescu#1577, Fixes sorin-ionescu#1451

* Export VIRTUAL_ENV_DISABLE_PROMPT when enabling virutalenv

Adding `export` ensures the define is available in the shell so pyenv
or virtualenvwrapper do not duplicate the virtualenv name on the
prompt.

* Update cache files when .zpreztorc file is modified

Fixes sorin-ionescu#1581

* Document macOS support for `command-not-found`

Document macOS support for `command-not-found`

* Document `gpf` vs `gpF`

Document the difference between `gpf` and `gpF`. These were changed in sorin-ionescu#1040 / sorin-ionescu@ddfc870, but never documented.

* Remove zlogout's Apu quote (sorin-ionescu#1583)

* Remove zlogout's Apu quote

For questions about why, see https://en.wikipedia.org/wiki/The_Problem_with_Apu

* Add a couple of random sayings per feedback in sorin-ionescu#1583

* Fix spelling error in CONTRIBUTING.md (sorin-ionescu#1590)

* Fix path to global ssh known hosts file

The path to the global known hosts file is /etc/ssh/ssh_known_hosts, not
/etc/ssh_hosts.

* syntax-highlighting: Update README to clarify module load order

Fixes sorin-ionescu#1584

* completion: Compact path to global ssh known hosts file

* coreutils: update list of included coreutils (sorin-ionescu#1592)
  • Loading branch information
g1910 authored Jul 2, 2018
1 parent d0febeb commit b68eda1
Show file tree
Hide file tree
Showing 26 changed files with 83 additions and 62 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ there are a number of additional things to keep in mind.
- Prefer `zstyle` over environment variables for configuration.
- Prefer (( ... )) over [[ ... ]] for arithmetic expression.
- Use the function keyword to define functions.
- The 80 character hard limit can be waved for readability.
- The 80 character hard limit can be waived for readability.

#### Using an Alternative zprezto Directory

Expand Down
6 changes: 3 additions & 3 deletions modules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Integrates zsh-autosuggestions into Prezto.
Command-Not-Found
-----------------

Loads the command-not-found tool on Debian-based distributions.
Loads the command-not-found tool on macOS or Debian-based distributions.

Completion
----------
Expand Down Expand Up @@ -122,7 +122,7 @@ Initializes OCaml package management.
OSX
---

Defines Mac OS X aliases and functions.
Defines macOS aliases and functions.

Pacman
------
Expand All @@ -132,7 +132,7 @@ Provides aliases and functions for the Pacman package manager and frontends.
Perl
----

Enables local Perl module installation on Mac OS X and defines alises.
Enables local Perl module installation on macOS and defines alises.

Prompt
------
Expand Down
6 changes: 3 additions & 3 deletions modules/command-not-found/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ 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 Mac OS X when homebrew tap is configured.
elif (( $+commands[brew] )) && brew command command-not-found-init > /dev/null 2>&1; then
eval "$(brew command-not-found-init)"
# 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'
# Return if requirements are not found.
else
return 1
Expand Down
2 changes: 1 addition & 1 deletion modules/completion/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ zstyle ':completion::*:(-command-|export):*' fake-parameters ${${${_comps[(I)-va
zstyle -a ':prezto:module:completion:*:hosts' etc-host-ignores '_etc_host_ignores'

zstyle -e ':completion:*:hosts' hosts 'reply=(
${=${=${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) 2> /dev/null)"}%%[#| ]*}//\]:[0-9]*/ }//,/ }//\[/ }
${=${=${=${${(f)"$(cat {/etc/ssh/ssh_,~/.ssh/}known_hosts(|2)(N) 2> /dev/null)"}%%[#| ]*}//\]:[0-9]*/ }//,/ }//\[/ }
${=${(f)"$(cat /etc/hosts(|)(N) <<(ypcat hosts 2> /dev/null))"}%%(\#${_etc_host_ignores:+|${(j:|:)~_etc_host_ignores}})*}
${=${${${${(@M)${(f)"$(cat ~/.ssh/config 2> /dev/null)"}:#Host *}#Host }:#*\**}:#*\?*}}
)'
Expand Down
2 changes: 0 additions & 2 deletions modules/editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ zstyle ':prezto:module:editor' dot-expansion 'yes'

### PS Context

**NOTE:** *This is deprecated and will be removed in future versions.*

To enable the prompt context to be set, add the following to your
*zpreztorc*.

Expand Down
15 changes: 7 additions & 8 deletions modules/editor/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -116,21 +116,20 @@ function editor-info {
}
zle -N editor-info

# Reset the prompt based on the current context and whether the prompt utilizes
# the editor:info zstyle. If the prompt does utilize the editor:info, we must
# reset the prompt, otherwise the change in the prompt will never update. If the
# prompt does not utilize the editor:info, we simply redisplay the command line.
# Reset the prompt based on the current context and
# the ps-context option.
function zle-reset-prompt {
# Explicitly check to see if there is an editor info keymap set that would
# require a reset of the prompt
if zstyle -L ':prezto:module:editor:info*' | grep -v 'completing' > /dev/null 2>&1; then
if zstyle -t ':prezto:module:editor' ps-context; then
# If we aren't within one of the specified contexts, then we want to reset
# the prompt with the appropriate editor_info[keymap] if there is one.
if [[ $CONTEXT != (select|cont) ]]; then
zle reset-prompt
zle -R
fi
else
zle reset-prompt
zle -R
fi
zle -R
}
zle -N zle-reset-prompt

Expand Down
4 changes: 3 additions & 1 deletion modules/fasd/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ fi
#

cache_file="${TMPDIR:-/tmp}/prezto-fasd-cache.$UID.zsh"
if [[ "${commands[fasd]}" -nt "$cache_file" || ! -s "$cache_file" ]]; then
if [[ "${commands[fasd]}" -nt "$cache_file" \
|| "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \
|| ! -s "$cache_file" ]]; then
# Set the base init arguments.
init_args=(zsh-hook)

Expand Down
5 changes: 4 additions & 1 deletion modules/git/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ zstyle ':prezto:module:git:alias' skip 'yes'
- `gcR` removes the *HEAD* commit.
- `gcs` displays various types of objects.
- `gcl` lists lost commits.
- `gcy` displays commits yet to be applied to upstream in the short format.
- `gcY` displays commits yet to be applied to upstream.

### Conflict

Expand Down Expand Up @@ -231,7 +233,8 @@ zstyle ':prezto:module:git:alias' skip 'yes'
### Push

- `gp` updates remote refs along with associated objects.
- `gpf` forcefully updates remote refs along with associated objects.
- `gpf` forcefully updates remote refs along with associated objects using the safer `--force-with-lease` option.
- `gpF` forcefully updates remote refs along with associated objects using the riskier `--force` option.
- `gpa` updates remote branches along with associated objects.
- `gpA` updates remote branches and tags along with associated objects.
- `gpt` updates remote tags along with associated objects.
Expand Down
2 changes: 2 additions & 0 deletions modules/git/alias.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ if ! zstyle -t ':prezto:module:git:alias' skip 'yes'; then
alias gcR='git reset "HEAD^"'
alias gcs='git show'
alias gcl='git-commit-lost'
alias gcy='git cherry -v --abbrev'
alias gcY='git cherry -v'

# Conflict (C)
alias gCl='git --no-pager diff --name-only --diff-filter=U'
Expand Down
10 changes: 5 additions & 5 deletions modules/gnu-utility/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ fi

_gnu_utility_cmds=(
# Coreutils
'[' 'base64' 'basename' 'cat' 'chcon' 'chgrp' 'chmod' 'chown'
'[' 'b2sum' 'base32' 'base64' 'basename' 'cat' 'chcon' 'chgrp' 'chmod' 'chown'
'chroot' 'cksum' 'comm' 'cp' 'csplit' 'cut' 'date' 'dd' 'df'
'dir' 'dircolors' 'dirname' 'du' 'echo' 'env' 'expand' 'expr'
'factor' 'false' 'fmt' 'fold' 'groups' 'head' 'hostid' 'id'
'install' 'join' 'kill' 'link' 'ln' 'logname' 'ls' 'md5sum'
'mkdir' 'mkfifo' 'mknod' 'mktemp' 'mv' 'nice' 'nl' 'nohup' 'nproc'
'od' 'paste' 'pathchk' 'pinee' 'pr' 'printenv' 'printf' 'ptx'
'install' 'join' 'kill' 'link' 'ln' 'logname' 'ls' 'md5sum' 'mkdir'
'mkfifo' 'mknod' 'mktemp' 'mv' 'nice' 'nl' 'nohup' 'nproc'
'numfmt' 'od' 'paste' 'pathchk' 'pinky' 'pr' 'printenv' 'printf' 'ptx'
'pwd' 'readlink' 'realpath' 'rm' 'rmdir' 'runcon' 'seq' 'sha1sum'
'sha224sum' 'sha256sum' 'sha384sum' 'sha512sum' 'shred' 'shuf'
'sleep' 'sort' 'split' 'stat' 'stty' 'sum' 'sync' 'tac' 'tail'
'sleep' 'sort' 'split' 'stat' 'stdbuf' 'stty' 'sum' 'sync' 'tac' 'tail'
'tee' 'test' 'timeout' 'touch' 'tr' 'true' 'truncate' 'tsort'
'tty' 'uname' 'unexpand' 'uniq' 'unlink' 'uptime' 'users' 'vdir'
'wc' 'who' 'whoami' 'yes'
Expand Down
4 changes: 3 additions & 1 deletion modules/node/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ fi
if (( $+commands[npm] )); then
cache_file="${TMPDIR:-/tmp}/prezto-node-cache.$UID.zsh"

if [[ "$commands[npm]" -nt "$cache_file" || ! -s "$cache_file" ]]; then
if [[ "$commands[npm]" -nt "$cache_file" \
|| "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \
|| ! -s "$cache_file" ]]; then
# npm is slow; cache its output.
npm completion >! "$cache_file" 2> /dev/null
fi
Expand Down
6 changes: 3 additions & 3 deletions modules/osx/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
OSX
===

Defines [Mac OS X][1] aliases and functions.
Defines [macOS][1] aliases and functions.

Settings
--------
Expand Down Expand Up @@ -34,8 +34,8 @@ Functions
- `tab` creates a new tab (works in both _Terminal_ and [_iTerm_][3]).
- `ql` previews files in Quick Look.
- `osx-rm-dir-metadata` deletes .DS\_Store, \_\_MACOSX cruft.
- `osx-ls-download-history` displays the Mac OS X download history.
- `osx-rm-download-history` deletes the Mac OS X download history.
- `osx-ls-download-history` displays the macOS download history.
- `osx-rm-download-history` deletes the macOS download history.

Authors
-------
Expand Down
2 changes: 1 addition & 1 deletion modules/osx/functions/osx-ls-download-history
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Displays the Mac OS X download history.
# Displays the macOS download history.
#
# Authors:
# Sorin Ionescu <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion modules/osx/functions/osx-rm-download-history
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Deletes the Mac OS X download history.
# Deletes the macOS download history.
#
# Authors:
# Sorin Ionescu <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion modules/osx/init.zsh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Defines Mac OS X aliases and functions.
# Defines macOS aliases and functions.
#
# Authors:
# Sorin Ionescu <[email protected]>
Expand Down
4 changes: 2 additions & 2 deletions modules/perl/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Perl
====

Enables local [Perl][1] module installation on Mac OS X and defines aliases.
Enables local [Perl][1] module installation on macOS and defines aliases.

Local Module Installation
-------------------------

Perl versions older than 5.14 do not support the local installation of Perl
modules natively. This module allows for local installation of Perl modules on
Mac OS X in *~/Library/Perl/5.12* by altering the environment.
macOS in *~/Library/Perl/5.12* by altering the environment.

### Usage

Expand Down
4 changes: 2 additions & 2 deletions modules/perl/init.zsh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Enables local Perl module installation on Mac OS X and defines aliases.
# Enables local Perl module installation on macOS and defines aliases.
#
# Authors:
# Sorin Ionescu <[email protected]>
Expand Down Expand Up @@ -43,7 +43,7 @@ if [[ "$OSTYPE" == darwin* ]]; then
perl_path="$HOME/Library/Perl/5.12"

if [[ -f "$perl_path/lib/perl5/local/lib.pm" ]]; then
if [[ ! -s "$cache_file" ]]; then
if [[ "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" || ! -s "$cache_file" ]]; then
perl -I$perl_path/lib/perl5 -Mlocal::lib=$perl_path >! "$cache_file"
fi

Expand Down
8 changes: 5 additions & 3 deletions modules/python/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ elif (( $+commands[pyenv] )); then
eval "$(pyenv init -)"

# Prepend PEP 370 per user site packages directory, which defaults to
# ~/Library/Python on Mac OS X and ~/.local elsewhere, to PATH. The
# ~/Library/Python on macOS and ~/.local elsewhere, to PATH. The
# path can be overridden using PYTHONUSERBASE.
else
if [[ -n "$PYTHONUSERBASE" ]]; then
Expand Down Expand Up @@ -94,7 +94,7 @@ if (( $+VIRTUALENVWRAPPER_VIRTUALENV || $+commands[virtualenv] )) && \
export WORKON_HOME="${WORKON_HOME:-$HOME/.virtualenvs}"

# Disable the virtualenv prompt.
VIRTUAL_ENV_DISABLE_PROMPT=1
export VIRTUAL_ENV_DISABLE_PROMPT=1

# Create a sorted array of available virtualenv related 'pyenv' commands to
# look for plugins of interest. Scanning shell '$path' isn't enough as they
Expand Down Expand Up @@ -149,7 +149,9 @@ if (( $#commands[(i)pip(|[23])] )); then
# Detect and use one available from among 'pip', 'pip2', 'pip3' variants
pip_command="$commands[(i)pip(|[23])]"

if [[ "$pip_command" -nt "$cache_file" || ! -s "$cache_file" ]]; then
if [[ "$pip_command" -nt "$cache_file" \
|| "${ZDOTDIR:-$HOME}/.zpreztorc" -nt "$cache_file" \
|| ! -s "$cache_file" ]]; then
# pip is slow; cache its output. And also support 'pip2', 'pip3' variants
$pip_command completion --zsh \
| sed -e "s|compctl -K [-_[:alnum:]]* pip|& pip2 pip3|" >! "$cache_file" 2> /dev/null
Expand Down
2 changes: 1 addition & 1 deletion modules/rsync/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Rsync

Defines [rsync][1] aliases.

Mac OS X users are encouraged to use [Bombich's rsync][2], which has HFS+
macOS users are encouraged to use [Bombich's rsync][2], which has HFS+
enhancements.

Aliases
Expand Down
2 changes: 1 addition & 1 deletion modules/rsync/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if grep -q 'xattrs' <(rsync --help 2>&1); then
_rsync_cmd="${_rsync_cmd} --acls --xattrs"
fi

# Mac OS X and HFS+ Enhancements
# macOS and HFS+ Enhancements
# http://help.bombich.com/kb/overview/credits#opensource
if [[ "$OSTYPE" == darwin* ]] && grep -q 'file-flags' <(rsync --help 2>&1); then
_rsync_cmd="${_rsync_cmd} --crtimes --fileflags --protect-decmpfs --force-change"
Expand Down
8 changes: 5 additions & 3 deletions modules/syntax-highlighting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ Syntax Highlighting

Integrates [zsh-syntax-highlighting][1] into Prezto.

This module should be loaded *second to last*, where last is the *prompt*
module, unless used in conjuncture with the *history-substring-search* module
where it must be loaded **before** it.
This module should be loaded before the *prompt* module.

Additionally, if this module is used in conjunction with the
*history-substring-search* module, this module must be loaded **before** the
*history-substring-search* module.

Contributors
------------
Expand Down
4 changes: 2 additions & 2 deletions modules/tmux/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Aliases
Caveats
-------

On Mac OS X, launching tmux can cause the error **launch_msg(...): Socket is not
On macOS, launching tmux can cause the error **launch_msg(...): Socket is not
connected** to be displayed, which can be fixed by installing
[reattach-to-user-namespace][3], available in [Homebrew][4], and adding the
following to *tmux.conf*:
Expand All @@ -71,7 +71,7 @@ following to *tmux.conf*:
set-option -g default-command "reattach-to-user-namespace -l $SHELL -l"
```

Furthermore, tmux is known to cause **kernel panics** on Mac OS X. A discussion
Furthermore, tmux is known to cause **kernel panics** on macOS. A discussion
about this and Prezto has already been [opened][2].

Authors
Expand Down
2 changes: 1 addition & 1 deletion modules/tmux/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if ([[ "$TERM_PROGRAM" = 'iTerm.app' ]] && \
_tmux_iterm_integration='-CC'
fi

if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" && -z "$INSIDE_EMACS" ]] && ( \
if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" && -z "$INSIDE_EMACS" && -z "$VSCODE_PID" ]] && ( \
( [[ -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
25 changes: 16 additions & 9 deletions modules/utility/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,13 @@ if is-callable 'dircolors'; then
alias ls='ls --group-directories-first'

if zstyle -t ':prezto:module:utility:ls' color; then
if [[ -s "$HOME/.dir_colors" ]]; then
eval "$(dircolors --sh "$HOME/.dir_colors")"
else
eval "$(dircolors --sh)"
# Call dircolors to define colors if they're missing
if [[ -z "$LS_COLORS" ]]; then
if [[ -s "$HOME/.dir_colors" ]]; then
eval "$(dircolors --sh "$HOME/.dir_colors")"
else
eval "$(dircolors --sh)"
fi
fi

alias ls="${aliases[ls]:-ls} --color=auto"
Expand All @@ -89,11 +92,15 @@ if is-callable 'dircolors'; then
else
# BSD Core Utilities
if zstyle -t ':prezto:module:utility:ls' color; then
# Define colors for BSD ls.
export LSCOLORS='exfxcxdxbxGxDxabagacad'
# Define colors for BSD ls if they're not already defined
if [[ -z "$LSCOLORS" ]]; then
export LSCOLORS='exfxcxdxbxGxDxabagacad'
fi

# Define colors for the completion system.
export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=36;01:cd=33;01:su=31;40;07:sg=36;40;07:tw=32;40;07:ow=33;40;07:'
# Define colors for the completion system if they're not already defined
if [[ -z "$LS_COLORS" ]]; then
export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=36;01:cd=33;01:su=31;40;07:sg=36;40;07:tw=32;40;07:ow=33;40;07:'
fi

alias ls="${aliases[ls]:-ls} -G"
else
Expand Down Expand Up @@ -121,7 +128,7 @@ if zstyle -t ':prezto:module:utility:grep' color; then
alias grep="${aliases[grep]:-grep} --color=auto"
fi

# Mac OS X Everywhere
# macOS Everywhere
if [[ "$OSTYPE" == darwin* ]]; then
alias o='open'
elif [[ "$OSTYPE" == cygwin* ]]; then
Expand Down
11 changes: 6 additions & 5 deletions runcoms/zlogout
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
# Execute code only if STDERR is bound to a TTY.
[[ -o INTERACTIVE && -t 2 ]] && {

# Print the message.
cat <<-EOF
SAYINGS=(
"So long and thanks for all the fish.\n -- Douglas Adams"
"Good morning! And in case I don't see ya, good afternoon, good evening and goodnight.\n --Truman Burbank"
)

Thank you. Come again!
-- Dr. Apu Nahasapeemapetilon
EOF
# Print a randomly-chosen message:
echo $SAYINGS[$(($RANDOM % ${#SAYINGS} + 1))]

} >&2
Loading

0 comments on commit b68eda1

Please sign in to comment.