Skip to content

Commit

Permalink
Merge commit '5b03d7fa32cae51cee7903d3338f87c2d7d89657'
Browse files Browse the repository at this point in the history
* commit '5b03d7fa32cae51cee7903d3338f87c2d7d89657':
  prompt: fix usage of zsh-async in sorin prompt (sorin-ionescu#1810)
  Fix missing dependency on helper module for helpers added in sorin-ionescu#1793 (sorin-ionescu#1811)
  prompt: update powerlevel10k submodule to v1.5.0
  feat(helper): add os-type helper functions
  Update syntax-highlighting module
  prompt: update powerlevel10k submodule to v1.4.0
  • Loading branch information
Andreas Pataki committed Apr 5, 2020
2 parents 91c9d4e + 5b03d7f commit 3f5fe90
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 11 deletions.
5 changes: 4 additions & 1 deletion modules/haskell/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ if (( ! $+commands[ghc] )); then
return 1
fi

# Load dependencies.
pmodload 'helper'

# Prepend Cabal per user directories to PATH.
if [[ "$OSTYPE" == darwin* && -d $HOME/Library/Haskell ]]; then
if is-darwin && [[ -d $HOME/Library/Haskell ]]; then
path=($HOME/Library/Haskell/bin(/N) $path)
else
path=($HOME/.cabal/bin(/N) $path)
Expand Down
20 changes: 20 additions & 0 deletions modules/helper/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,23 @@ function coalesce {
done
return 1
}

# is true on MacOS Darwin
function is-darwin {
[[ "$OSTYPE" == darwin* ]]
}

# is true on Linux's
function is-linux {
[[ "$OSTYPE" == linux* ]]
}

# is true on BSD's
function is-bsd {
[[ "$OSTYPE" == *bsd* ]]
}

# is true on Cygwin (Windows)
function is-cygwin {
[[ "$OSTYPE" == cygwin* ]]
}
2 changes: 1 addition & 1 deletion modules/homebrew/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#

# Return if requirements are not found.
if [[ "$OSTYPE" != (darwin|linux)* ]]; then
if ! is-darwin || ! is-linux; then
return 1
fi

Expand Down
5 changes: 4 additions & 1 deletion modules/macports/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
# Sorin Ionescu <[email protected]>
#

# Load dependencies.
pmodload 'helper'

# Return if requirements are not found.
if [[ "$OSTYPE" != darwin* ]]; then
if ! is-darwin; then
return 1
fi

Expand Down
5 changes: 4 additions & 1 deletion modules/osx/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
# Sorin Ionescu <[email protected]>
#

# Load dependencies.
pmodload 'helper'

# Return if requirements are not found.
if [[ "$OSTYPE" != darwin* ]]; then
if ! is-darwin; then
return 1
fi

Expand Down
5 changes: 4 additions & 1 deletion modules/perl/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ if (( ! $+commands[perl] )); then
return 1
fi

# Load dependencies.
pmodload 'helper'

#
# Load Perlbrew or plenv
#
Expand Down Expand Up @@ -37,7 +40,7 @@ fi
# Local Module Installation
#

if [[ "$OSTYPE" == darwin* ]]; then
if is-darwin; then
# Perl is slow; cache its output.
cache_file="${TMPDIR:-/tmp}/prezto-perl-cache.$UID.zsh"
perl_path="$HOME/Library/Perl/5.12"
Expand Down
7 changes: 7 additions & 0 deletions modules/prompt/functions/prompt_sorin_setup
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ function prompt_sorin_async_callback {
zle && zle reset-prompt
fi
;;
"[async]")
# Code is 1 for corrupted worker output and 2 for dead worker.
if [[ $2 -eq 2 ]]; then
# Our worker died unexpectedly.
typeset -g prompt_prezto_async_init=0
fi
;;
esac
}

Expand Down
5 changes: 4 additions & 1 deletion modules/python/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
# Patrick Bos <[email protected]>
#

# Load dependencies
pmodload 'helper'

# Load manually installed pyenv into the path
if [[ -s "${PYENV_ROOT:=$HOME/.pyenv}/bin/pyenv" ]]; then
path=("${PYENV_ROOT}/bin" $path)
Expand All @@ -22,7 +25,7 @@ elif (( $+commands[pyenv] )); then
else
if [[ -n "$PYTHONUSERBASE" ]]; then
path=($PYTHONUSERBASE/bin $path)
elif [[ "$OSTYPE" == darwin* ]]; then
elif is-darwin; then
path=($HOME/Library/Python/*/bin(N) $path)
else
# This is subject to change.
Expand Down
5 changes: 4 additions & 1 deletion modules/rsync/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ if (( ! $+commands[rsync] )); then
return 1
fi

# Load dependencies.
pmodload 'helper'

#
# Aliases
#
Expand All @@ -23,7 +26,7 @@ fi

# macOS and HFS+ Enhancements
# https://bombich.com/kb/ccc5/credits
if [[ "$OSTYPE" == darwin* ]] && grep -q 'file-flags' <(rsync --help 2>&1); then
if is-darwin && grep -q 'file-flags' <(rsync --help 2>&1); then
_rsync_cmd="${_rsync_cmd} --crtimes --fileflags --protect-decmpfs --force-change"
fi

Expand Down
6 changes: 3 additions & 3 deletions modules/utility/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ if zstyle -t ':prezto:module:utility:grep' color; then
fi

# macOS Everywhere
if [[ "$OSTYPE" == darwin* ]]; then
if is-darwin; then
alias o='open'
elif [[ "$OSTYPE" == cygwin* ]]; then
elif is-cygwin; then
alias o='cygstart'
alias pbcopy='tee > /dev/clipboard'
alias pbpaste='cat /dev/clipboard'
Expand Down Expand Up @@ -166,7 +166,7 @@ fi
alias df='df -kh'
alias du='du -kh'

if [[ "$OSTYPE" == (darwin*|*bsd*) ]]; then
if is-darwin || is-bsd; then
alias topc='top -o cpu'
alias topm='top -o vsize'
else
Expand Down

0 comments on commit 3f5fe90

Please sign in to comment.