Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
* upstream/master: (225 commits)
  Feat: add Salt completion plugin (ohmyzsh#7031)
  Add fzf plugin (ohmyzsh#6910)
  fasd: use xdg-open in o alias back again
  fasd: drop-in replace the autojump j alias (ohmyzsh#3860)
  jump: fix printf path output (ohmyzsh#7105)
  vi-mode: reset-prompt if zle is active (TRAPWINCH)
  fix nmap vuln category name (ohmyzsh#7044)
  Update kubectl.plugin.zsh (ohmyzsh#6636)
  Fix rvm-prompt usage in fino* themes (ohmyzsh#6477)
  vi-mode show indicator on zle-line-init and SIGWINCH (ohmyzsh#6449)
  execute mvnw with "mvn" when mvnw-file is present (ohmyzsh#6484)
  executing gradlew, when gradlew-file exists (ohmyzsh#6485)
  Fixed `fwl` function in `firewalld` plugin when `sources` used (ohmyzsh#7011)
  kubectl: add alias for `kubectl cp` (ohmyzsh#7068)
  Update golang.plugin.zsh (ohmyzsh#6750)
  Update brew.plugin.zsh (ohmyzsh#6947)
  Add aliases for kubectl nodes (ohmyzsh#7093)
  Clarify random theme setting (ohmyzsh#7090)
  [plugins/git] Updated git clone alias (ohmyzsh#6893)
  Updating 'sbcl' to 'sbcln' (ohmyzsh#7095)
  ...
  • Loading branch information
lesterchan committed Sep 7, 2018
2 parents 8dd2cbc + f73c29a commit 122c6f4
Show file tree
Hide file tree
Showing 226 changed files with 6,540 additions and 2,248 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<img src="https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png" alt="Oh My Zsh">
</p>

Oh My Zsh is an open source, community-driven framework for managing your [zsh](http://www.zsh.org/) configuration.
Oh My Zsh is an open source, community-driven framework for managing your [zsh](https://www.zsh.org/) configuration.

Sounds boring. Let's try again.

Expand All @@ -12,7 +12,7 @@ Once installed, your terminal shell will become the talk of the town _or your mo

Finally, you'll begin to get the sort of attention that you have always felt you deserved. ...or maybe you'll use the time that you're saving to start flossing more often. 😬

To learn more, visit [ohmyz.sh](http://ohmyz.sh) and follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter.
To learn more, visit [ohmyz.sh](https://ohmyz.sh) and follow [@ohmyzsh](https://twitter.com/ohmyzsh) on Twitter.

## Getting Started

Expand All @@ -21,7 +21,7 @@ To learn more, visit [ohmyz.sh](http://ohmyz.sh) and follow [@ohmyzsh](https://t
__Disclaimer:__ _Oh My Zsh works best on macOS and Linux._

* Unix-like operating system (macOS or Linux)
* [Zsh](http://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (`zsh --version` to confirm), check the following instruction here: [Installing ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH)
* [Zsh](https://www.zsh.org) should be installed (v4.3.9 or more recent). If not pre-installed (`zsh --version` to confirm), check the following instruction here: [Installing ZSH](https://github.com/robbyrussell/oh-my-zsh/wiki/Installing-ZSH)
* `curl` or `wget` should be installed
* `git` should be installed

Expand Down Expand Up @@ -215,7 +215,7 @@ If you want to uninstall `oh-my-zsh`, just run `uninstall_oh_my_zsh` from the co

## Contributing

I'm far from being a [Zsh](http://www.zsh.org/) expert and suspect there are many ways to improve – if you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests!
I'm far from being a [Zsh](https://www.zsh.org/) expert and suspect there are many ways to improve – if you have ideas on how to make the configuration easier to maintain (and faster), don't hesitate to fork and send pull requests!

We also need people to test out pull-requests. So take a look through [the open issues](https://github.com/robbyrussell/oh-my-zsh/issues) and help where you can.

Expand All @@ -238,7 +238,7 @@ We're on the social media.

## Merchandise

We have [stickers](https://shop.planetargon.com/products/ohmyzsh-stickers-set-of-3-stickers) and [shirts](http://shop.planetargon.com/products/ohmyzsh-t-shirts) for you to show off your love of Oh My Zsh. Again, this will help you become the talk of the town!
We have [stickers](https://shop.planetargon.com/products/ohmyzsh-stickers-set-of-3-stickers) and [shirts](https://shop.planetargon.com/products/ohmyzsh-t-shirts) for you to show off your love of Oh My Zsh. Again, this will help you become the talk of the town!

## License

Expand Down
4 changes: 4 additions & 0 deletions custom/themes/example.zsh-theme
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Put your custom themes in this folder.
# Example:

PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% "
44 changes: 14 additions & 30 deletions lib/compfix.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
# insecure ownership or permissions) by:
#
# * Human-readably notifying the user of these insecurities.
# * Moving away all existing completion caches to a temporary directory. Since
# any of these caches may have been generated from insecure directories, they
# are all suspect now. Failing to do so typically causes subsequent compinit()
# calls to fail with "command not found: compdef" errors. (That's bad.)
function handle_completion_insecurities() {
# List of the absolute paths of all unique insecure directories, split on
# newline from compaudit()'s output resembling:
Expand All @@ -22,39 +18,27 @@ function handle_completion_insecurities() {
insecure_dirs=( ${(f@):-"$(compaudit 2>/dev/null)"} )

# If no such directories exist, get us out of here.
if (( ! ${#insecure_dirs} )); then
print "[oh-my-zsh] No insecure completion-dependent directories detected."
return
fi
(( ! ${#insecure_dirs} )) && return

# List ownership and permissions of all insecure directories.
print "[oh-my-zsh] Insecure completion-dependent directories detected:"
ls -ld "${(@)insecure_dirs}"
print "[oh-my-zsh] For safety, completions will be disabled until you manually fix all"
print "[oh-my-zsh] insecure directory permissions and ownership and restart oh-my-zsh."
print "[oh-my-zsh] See the above list for directories with group or other writability.\n"

# Locally enable the "NULL_GLOB" option, thus removing unmatched filename
# globs from argument lists *AND* printing no warning when doing so. Failing
# to do so prints an unreadable warning if no completion caches exist below.
setopt local_options null_glob
cat <<EOD
# List of the absolute paths of all unique existing completion caches.
local -aU zcompdump_files
zcompdump_files=( "${ZSH_COMPDUMP}"(.) "${ZDOTDIR:-${HOME}}"/.zcompdump* )
[oh-my-zsh] For safety, we will not load completions from these directories until
[oh-my-zsh] you fix their permissions and ownership and restart zsh.
[oh-my-zsh] See the above list for directories with group or other writability.
# Move such caches to a temporary directory.
if (( ${#zcompdump_files} )); then
# Absolute path of the directory to which such files will be moved.
local ZSH_ZCOMPDUMP_BAD_DIR="${ZSH_CACHE_DIR}/zcompdump-bad"
[oh-my-zsh] To fix your permissions you can do so by disabling
[oh-my-zsh] the write permission of "group" and "others" and making sure that the
[oh-my-zsh] owner of these directories is either root or your current user.
[oh-my-zsh] The following command may help:
[oh-my-zsh] compaudit | xargs chmod g-w,o-w
# List such files first.
print "[oh-my-zsh] Insecure completion caches also detected:"
ls -l "${(@)zcompdump_files}"
[oh-my-zsh] If the above didn't help or you want to skip the verification of
[oh-my-zsh] insecure directories you can set the variable ZSH_DISABLE_COMPFIX to
[oh-my-zsh] "true" before oh-my-zsh is sourced in your zshrc file.
# For safety, move rather than permanently remove such files.
print "[oh-my-zsh] Moving to \"${ZSH_ZCOMPDUMP_BAD_DIR}/\"...\n"
mkdir -p "${ZSH_ZCOMPDUMP_BAD_DIR}"
mv "${(@)zcompdump_files}" "${ZSH_ZCOMPDUMP_BAD_DIR}/"
fi
EOD
}
3 changes: 3 additions & 0 deletions lib/completion.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ else
fi
unset CASE_SENSITIVE HYPHEN_INSENSITIVE

# Complete . and .. special directories
zstyle ':completion:*' special-dirs true

zstyle ':completion:*' list-colors ''
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'

Expand Down
1 change: 1 addition & 0 deletions lib/correction.zsh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
if [[ "$ENABLE_CORRECTION" == "true" ]]; then
alias cp='nocorrect cp'
alias ebuild='nocorrect ebuild'
alias gist='nocorrect gist'
alias heroku='nocorrect heroku'
Expand Down
4 changes: 0 additions & 4 deletions lib/directories.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,3 @@ alias lsa='ls -lah'
alias l='ls -lah'
alias ll='ls -lh'
alias la='ls -lAh'

# Push and pop directories on directory stack
alias pu='pushd'
alias po='popd'
18 changes: 8 additions & 10 deletions lib/functions.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,20 @@ function upgrade_oh_my_zsh() {
}

function take() {
mkdir -p $1
cd $1
mkdir -p $@ && cd ${@:$#}
}

function open_command() {
emulate -L zsh
setopt shwordsplit

local open_cmd

# define the open command
case "$OSTYPE" in
darwin*) open_cmd='open' ;;
cygwin*) open_cmd='cygstart' ;;
linux*) open_cmd='xdg-open' ;;
linux*) ! [[ $(uname -a) =~ "Microsoft" ]] && open_cmd='xdg-open' || {
open_cmd='cmd.exe /c start ""'
[[ -e "$1" ]] && { 1="$(wslpath -w "${1:a}")" || return 1 }
} ;;
msys*) open_cmd='start ""' ;;
*) echo "Platform $OSTYPE not supported"
return 1
Expand All @@ -34,9 +33,9 @@ function open_command() {

# don't use nohup on OSX
if [[ "$OSTYPE" == darwin* ]]; then
$open_cmd "$@" &>/dev/null
${=open_cmd} "$@" &>/dev/null
else
nohup $open_cmd "$@" &>/dev/null
nohup ${=open_cmd} "$@" &>/dev/null
fi
}

Expand All @@ -52,8 +51,7 @@ function open_command() {
# 1 if it does not exist
#
function alias_value() {
alias "$1" | sed "s/^$1='\(.*\)'$/\1/"
test $(alias "$1")
(( $+aliases[$1] )) && echo $aliases[$1]
}

#
Expand Down
56 changes: 37 additions & 19 deletions lib/history.zsh
Original file line number Diff line number Diff line change
@@ -1,24 +1,42 @@
## Command history configuration
if [ -z "$HISTFILE" ]; then
HISTFILE=$HOME/.zsh_history
fi
## History wrapper
function omz_history {
# Delete the history file if `-c' argument provided.
# This won't affect the `history' command output until the next login.
zparseopts -E c=clear l=list

HISTSIZE=10000
SAVEHIST=10000
if [[ -n "$clear" ]]; then
# if -c provided, clobber the history file
echo -n >| "$HISTFILE"
echo >&2 History file deleted. Reload the session to see its effects.
elif [[ -n "$list" ]]; then
# if -l provided, run as if calling `fc' directly
builtin fc "$@"
else
# otherwise, call `fc -l 1` to show all available
# history (and pass additional parameters)
builtin fc "$@" -l 1
fi
}

# Show history
# Timestamp format
case $HIST_STAMPS in
"mm/dd/yyyy") alias history='fc -fl 1' ;;
"dd.mm.yyyy") alias history='fc -El 1' ;;
"yyyy-mm-dd") alias history='fc -il 1' ;;
*) alias history='fc -l 1' ;;
"mm/dd/yyyy") alias history='omz_history -f' ;;
"dd.mm.yyyy") alias history='omz_history -E' ;;
"yyyy-mm-dd") alias history='omz_history -i' ;;
"") alias history='omz_history' ;;
*) alias history="omz_history -t '$HIST_STAMPS'" ;;
esac

setopt append_history
setopt extended_history
setopt hist_expire_dups_first
setopt hist_ignore_dups # ignore duplication command history list
setopt hist_ignore_space
setopt hist_verify
setopt inc_append_history
setopt share_history # share command history data
## History file configuration
[ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
HISTSIZE=50000
SAVEHIST=10000

## History command configuration
setopt extended_history # record timestamp of command in HISTFILE
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
setopt hist_ignore_dups # ignore duplicated commands history list
setopt hist_ignore_space # ignore commands that start with space
setopt hist_verify # show command with history expansion to user before running it
setopt inc_append_history # add commands to HISTFILE in order of execution
setopt share_history # share command history data
2 changes: 1 addition & 1 deletion lib/prompt_info_functions.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# Real implementations will be used when the respective plugins are loaded
function chruby_prompt_info hg_prompt_info pyenv_prompt_info \
rbenv_prompt_info svn_prompt_info vi_mode_prompt_info \
virtualenv_prompt_info {
virtualenv_prompt_info jenv_prompt_info {
return 1
}

Expand Down
2 changes: 1 addition & 1 deletion lib/spectrum.zsh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#! /bin/zsh
# A script to make using 256 colors in zsh less painful.
# P.C. Shyamshankar <sykora@lucentbeing.com>
# Copied from http://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
# Copied from https://github.com/sykora/etc/blob/master/zsh/functions/spectrum/

typeset -AHg FX FG BG

Expand Down
2 changes: 1 addition & 1 deletion lib/termsupport.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ preexec_functions+=(omz_termsupport_preexec)


# Keep Apple Terminal.app's current working directory updated
# Based on this answer: http://superuser.com/a/315029
# Based on this answer: https://superuser.com/a/315029
# With extra fixes to handle multibyte chars and non-UTF-8 locales

if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
Expand Down
32 changes: 17 additions & 15 deletions oh-my-zsh.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
# Set ZSH_CACHE_DIR to the path where cache files should be created
# or else we will use the default cache/
if [[ -z "$ZSH_CACHE_DIR" ]]; then
ZSH_CACHE_DIR="$ZSH/cache"
fi

# Migrate .zsh-update file to $ZSH_CACHE_DIR
if [ -f ~/.zsh-update ] && [ ! -f ${ZSH_CACHE_DIR}/.zsh-update ]; then
mv ~/.zsh-update ${ZSH_CACHE_DIR}/.zsh-update
fi

# Check for updates on initial load...
if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then
env ZSH=$ZSH DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh
env ZSH=$ZSH ZSH_CACHE_DIR=$ZSH_CACHE_DIR DISABLE_UPDATE_PROMPT=$DISABLE_UPDATE_PROMPT zsh -f $ZSH/tools/check_for_upgrade.sh
fi

# Initializes Oh My Zsh
Expand All @@ -11,20 +22,12 @@ fpath=($ZSH/functions $ZSH/completions $fpath)
# Load all stock functions (from $fpath files) called below.
autoload -U compaudit compinit

: ${ZSH_DISABLE_COMPFIX:=true}

# Set ZSH_CUSTOM to the path where your custom config files
# and plugins exists, or else we will use the default custom/
if [[ -z "$ZSH_CUSTOM" ]]; then
ZSH_CUSTOM="$ZSH/custom"
fi

# Set ZSH_CACHE_DIR to the path where cache files should be created
# or else we will use the default cache/
if [[ -z "$ZSH_CACHE_DIR" ]]; then
ZSH_CACHE_DIR="$ZSH/cache"
fi


# Load all of the config files in ~/oh-my-zsh that end in .zsh
# TIP: Add files you don't want in git to .gitignore
Expand Down Expand Up @@ -65,16 +68,15 @@ if [ -z "$ZSH_COMPDUMP" ]; then
fi

if [[ $ZSH_DISABLE_COMPFIX != true ]]; then
# If completion insecurities exist, warn the user without enabling completions.
# If completion insecurities exist, warn the user
if ! compaudit &>/dev/null; then
# This function resides in the "lib/compfix.zsh" script sourced above.
handle_completion_insecurities
# Else, enable and cache completions to the desired file.
else
compinit -d "${ZSH_COMPDUMP}"
fi
else
# Load only from secure directories
compinit -i -d "${ZSH_COMPDUMP}"
else
# If the user wants it, load from all found directories
compinit -u -d "${ZSH_COMPDUMP}"
fi

# Load all of the plugins that were defined in ~/.zshrc
Expand Down
4 changes: 2 additions & 2 deletions plugins/adb/_adb
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ _arguments \

case "$state" in
specify_device)
_values 'devices' $(adb devices -l|awk 'NR>1&& $1 ~ /^[a-zA-Z0-9].*$/ \
{printf "%s[%s] ",$1,$6 }')
_values -C 'devices' ${$(adb devices -l|awk 'NR>1&& $1 \
{sub(/ +/," ",$0);gsub(":","\\:",$1); printf "%s[%s] ",$1, $NF}'):-""}
return
;;
esac
Expand Down
2 changes: 1 addition & 1 deletion plugins/archlinux/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
| trupd | trizen -Sy && sudo abs | Update and refresh the local package and ABS databases |
| trupd | trizen -Sy && sudo aur | Update and refresh the local package and AUR databases |
| trupd | trizen -Sy | Update and refresh the local package database |
| trupd | trizen -Syua | Sync with repositories before upgrading all packages (from AUR too) |
| trupg | trizen -Syua | Sync with repositories before upgrading all packages (from AUR too) |
| trsu | trizen -Syua --no-confirm | Same as `trupg`, but without confirmation |
| upgrade | trizen -Syu | Sync with repositories before upgrading packages |

Expand Down
18 changes: 14 additions & 4 deletions plugins/asdf/asdf.plugin.zsh
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
# Find where asdf should be installed.
# Find where asdf should be installed
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"

# Load asdf, if found.
if [ -f $ASDF_DIR/asdf.sh ]; then
. $ASDF_DIR/asdf.sh
# If not found, check for Homebrew package
if [[ ! -d $ASDF_DIR ]] && (( $+commands[brew] )); then
ASDF_DIR="$(brew --prefix asdf)"
fi

# Load command
if [[ -f "$ASDF_DIR/asdf.sh" ]]; then
. "$ASDF_DIR/asdf.sh"

# Load completions
if [[ -f "$ASDF_DIR/completions/asdf.bash" ]]; then
. "$ASDF_DIR/completions/asdf.bash"
fi
fi
4 changes: 2 additions & 2 deletions plugins/autojump/autojump.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ if [ $commands[autojump] ]; then # check if autojump is installed
. /etc/profile.d/autojump.sh
elif [ -f /usr/local/share/autojump/autojump.zsh ]; then # freebsd installation
. /usr/local/share/autojump/autojump.zsh
elif [ -f /opt/local/etc/profile.d/autojump.zsh ]; then # mac os x with ports
. /opt/local/etc/profile.d/autojump.zsh
elif [ -f /opt/local/etc/profile.d/autojump.sh ]; then # mac os x with ports
. /opt/local/etc/profile.d/autojump.sh
elif [ $commands[brew] -a -f `brew --prefix`/etc/autojump.sh ]; then # mac os x with brew
. `brew --prefix`/etc/autojump.sh
fi
Expand Down

0 comments on commit 122c6f4

Please sign in to comment.