Unverified Commit 8c95c523 authored by Kozlov Alexander's avatar Kozlov Alexander Committed by GitHub
Browse files

Merge branch 'master' into master

parents dd30cf10 3d8f2bda
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2009-2017 Robby Russell and contributors Copyright (c) 2009-2018 Robby Russell and contributors
See the full list at https://github.com/robbyrussell/oh-my-zsh/contributors See the full list at https://github.com/robbyrussell/oh-my-zsh/contributors
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<img src="https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png" alt="Oh My Zsh"> <img src="https://s3.amazonaws.com/ohmyzsh/oh-my-zsh-logo.png" alt="Oh My Zsh">
</p> </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. Sounds boring. Let's try again.
...@@ -12,7 +12,7 @@ Once installed, your terminal shell will become the talk of the town _or your mo ...@@ -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. 😬 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 ## Getting Started
...@@ -21,7 +21,7 @@ To learn more, visit [ohmyz.sh](http://ohmyz.sh) and follow [@ohmyzsh](https://t ...@@ -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._ __Disclaimer:__ _Oh My Zsh works best on macOS and Linux._
* Unix-like operating system (macOS or 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 * `curl` or `wget` should be installed
* `git` should be installed * `git` should be installed
...@@ -141,7 +141,7 @@ export ZSH="$HOME/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.githubus ...@@ -141,7 +141,7 @@ export ZSH="$HOME/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.githubus
##### 1. Clone the repository: ##### 1. Clone the repository:
```shell ```shell
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
``` ```
##### 2. *Optionally*, backup your existing `~/.zshrc` file: ##### 2. *Optionally*, backup your existing `~/.zshrc` file:
...@@ -215,7 +215,7 @@ If you want to uninstall `oh-my-zsh`, just run `uninstall_oh_my_zsh` from the co ...@@ -215,7 +215,7 @@ If you want to uninstall `oh-my-zsh`, just run `uninstall_oh_my_zsh` from the co
## Contributing ## 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. 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.
...@@ -238,7 +238,7 @@ We're on the social media. ...@@ -238,7 +238,7 @@ We're on the social media.
## Merchandise ## 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 ## License
...@@ -248,4 +248,4 @@ Oh My Zsh is released under the [MIT license](LICENSE.txt). ...@@ -248,4 +248,4 @@ Oh My Zsh is released under the [MIT license](LICENSE.txt).
![Planet Argon](https://pa-github-assets.s3.amazonaws.com/PARGON_logo_digital_COL-small.jpg) ![Planet Argon](https://pa-github-assets.s3.amazonaws.com/PARGON_logo_digital_COL-small.jpg)
Oh My Zsh was started by the team at [Planet Argon](https://www.planetargon.com/?utm_source=github), a [Ruby on Rails development agency](https://www.planetargon.com/skills/ruby-on-rails-development?utm_source=github). Oh My Zsh was started by the team at [Planet Argon](https://www.planetargon.com/?utm_source=github), a [Ruby on Rails development agency](https://www.planetargon.com/skills/ruby-on-rails-development?utm_source=github). Check out our [other open source projects](https://www.planetargon.com/open-source?utm_source=github).
# Found on the ZshWiki # Put your custom themes in this folder.
# http://zshwiki.org/home/config/prompt # Example:
#
PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% " PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% "
\ No newline at end of file
...@@ -2,10 +2,6 @@ ...@@ -2,10 +2,6 @@
# insecure ownership or permissions) by: # insecure ownership or permissions) by:
# #
# * Human-readably notifying the user of these insecurities. # * 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() { function handle_completion_insecurities() {
# List of the absolute paths of all unique insecure directories, split on # List of the absolute paths of all unique insecure directories, split on
# newline from compaudit()'s output resembling: # newline from compaudit()'s output resembling:
...@@ -22,39 +18,27 @@ function handle_completion_insecurities() { ...@@ -22,39 +18,27 @@ function handle_completion_insecurities() {
insecure_dirs=( ${(f@):-"$(compaudit 2>/dev/null)"} ) insecure_dirs=( ${(f@):-"$(compaudit 2>/dev/null)"} )
# If no such directories exist, get us out of here. # If no such directories exist, get us out of here.
if (( ! ${#insecure_dirs} )); then (( ! ${#insecure_dirs} )) && return
print "[oh-my-zsh] No insecure completion-dependent directories detected."
return
fi
# List ownership and permissions of all insecure directories. # List ownership and permissions of all insecure directories.
print "[oh-my-zsh] Insecure completion-dependent directories detected:" print "[oh-my-zsh] Insecure completion-dependent directories detected:"
ls -ld "${(@)insecure_dirs}" 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 cat <<EOD
# 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
# List of the absolute paths of all unique existing completion caches. [oh-my-zsh] For safety, we will not load completions from these directories until
local -aU zcompdump_files [oh-my-zsh] you fix their permissions and ownership and restart zsh.
zcompdump_files=( "${ZSH_COMPDUMP}"(.) "${ZDOTDIR:-${HOME}}"/.zcompdump* ) [oh-my-zsh] See the above list for directories with group or other writability.
# Move such caches to a temporary directory. [oh-my-zsh] To fix your permissions you can do so by disabling
if (( ${#zcompdump_files} )); then [oh-my-zsh] the write permission of "group" and "others" and making sure that the
# Absolute path of the directory to which such files will be moved. [oh-my-zsh] owner of these directories is either root or your current user.
local ZSH_ZCOMPDUMP_BAD_DIR="${ZSH_CACHE_DIR}/zcompdump-bad" [oh-my-zsh] The following command may help:
[oh-my-zsh] compaudit | xargs chmod g-w,o-w
# List such files first. [oh-my-zsh] If the above didn't help or you want to skip the verification of
print "[oh-my-zsh] Insecure completion caches also detected:" [oh-my-zsh] insecure directories you can set the variable ZSH_DISABLE_COMPFIX to
ls -l "${(@)zcompdump_files}" [oh-my-zsh] "true" before oh-my-zsh is sourced in your zshrc file.
# For safety, move rather than permanently remove such files. EOD
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
} }
...@@ -25,6 +25,9 @@ else ...@@ -25,6 +25,9 @@ else
fi fi
unset CASE_SENSITIVE HYPHEN_INSENSITIVE unset CASE_SENSITIVE HYPHEN_INSENSITIVE
# Complete . and .. special directories
zstyle ':completion:*' special-dirs true
zstyle ':completion:*' list-colors '' zstyle ':completion:*' list-colors ''
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
......
if [[ "$ENABLE_CORRECTION" == "true" ]]; then if [[ "$ENABLE_CORRECTION" == "true" ]]; then
alias cp='nocorrect cp'
alias ebuild='nocorrect ebuild' alias ebuild='nocorrect ebuild'
alias gist='nocorrect gist' alias gist='nocorrect gist'
alias heroku='nocorrect heroku' alias heroku='nocorrect heroku'
......
...@@ -28,7 +28,3 @@ alias lsa='ls -lah' ...@@ -28,7 +28,3 @@ alias lsa='ls -lah'
alias l='ls -lah' alias l='ls -lah'
alias ll='ls -lh' alias ll='ls -lh'
alias la='ls -lAh' alias la='ls -lAh'
# Push and pop directories on directory stack
alias pu='pushd'
alias po='popd'
...@@ -11,21 +11,20 @@ function upgrade_oh_my_zsh() { ...@@ -11,21 +11,20 @@ function upgrade_oh_my_zsh() {
} }
function take() { function take() {
mkdir -p $1 mkdir -p $@ && cd ${@:$#}
cd $1
} }
function open_command() { function open_command() {
emulate -L zsh
setopt shwordsplit
local open_cmd local open_cmd
# define the open command # define the open command
case "$OSTYPE" in case "$OSTYPE" in
darwin*) open_cmd='open' ;; darwin*) open_cmd='open' ;;
cygwin*) open_cmd='cygstart' ;; 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 ""' ;; msys*) open_cmd='start ""' ;;
*) echo "Platform $OSTYPE not supported" *) echo "Platform $OSTYPE not supported"
return 1 return 1
...@@ -34,9 +33,9 @@ function open_command() { ...@@ -34,9 +33,9 @@ function open_command() {
# don't use nohup on OSX # don't use nohup on OSX
if [[ "$OSTYPE" == darwin* ]]; then if [[ "$OSTYPE" == darwin* ]]; then
$open_cmd "$@" &>/dev/null ${=open_cmd} "$@" &>/dev/null
else else
nohup $open_cmd "$@" &>/dev/null nohup ${=open_cmd} "$@" &>/dev/null
fi fi
} }
...@@ -52,8 +51,7 @@ function open_command() { ...@@ -52,8 +51,7 @@ function open_command() {
# 1 if it does not exist # 1 if it does not exist
# #
function alias_value() { function alias_value() {
alias "$1" | sed "s/^$1='\(.*\)'$/\1/" (( $+aliases[$1] )) && echo $aliases[$1]
test $(alias "$1")
} }
# #
......
...@@ -77,8 +77,8 @@ function git_current_branch() { ...@@ -77,8 +77,8 @@ function git_current_branch() {
# Gets the number of commits ahead from remote # Gets the number of commits ahead from remote
function git_commits_ahead() { function git_commits_ahead() {
if command git rev-parse --git-dir &>/dev/null; then if command git rev-parse --git-dir &>/dev/null; then
local commits="$(git rev-list --count @{upstream}..HEAD)" local commits="$(git rev-list --count @{upstream}..HEAD 2>/dev/null)"
if [[ "$commits" != 0 ]]; then if [[ -n "$commits" && "$commits" != 0 ]]; then
echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$commits$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX" echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$commits$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX"
fi fi
fi fi
...@@ -87,8 +87,8 @@ function git_commits_ahead() { ...@@ -87,8 +87,8 @@ function git_commits_ahead() {
# Gets the number of commits behind remote # Gets the number of commits behind remote
function git_commits_behind() { function git_commits_behind() {
if command git rev-parse --git-dir &>/dev/null; then if command git rev-parse --git-dir &>/dev/null; then
local commits="$(git rev-list --count HEAD..@{upstream})" local commits="$(git rev-list --count HEAD..@{upstream} 2>/dev/null)"
if [[ "$commits" != 0 ]]; then if [[ -n "$commits" && "$commits" != 0 ]]; then
echo "$ZSH_THEME_GIT_COMMITS_BEHIND_PREFIX$commits$ZSH_THEME_GIT_COMMITS_BEHIND_SUFFIX" echo "$ZSH_THEME_GIT_COMMITS_BEHIND_PREFIX$commits$ZSH_THEME_GIT_COMMITS_BEHIND_SUFFIX"
fi fi
fi fi
...@@ -141,11 +141,15 @@ function git_prompt_status() { ...@@ -141,11 +141,15 @@ function git_prompt_status() {
STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS" STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS"
elif $(echo "$INDEX" | grep '^M ' &> /dev/null); then elif $(echo "$INDEX" | grep '^M ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS" STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS"
elif $(echo "$INDEX" | grep '^MM ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_ADDED$STATUS"
fi fi
if $(echo "$INDEX" | grep '^ M ' &> /dev/null); then if $(echo "$INDEX" | grep '^ M ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
elif $(echo "$INDEX" | grep '^AM ' &> /dev/null); then elif $(echo "$INDEX" | grep '^AM ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
elif $(echo "$INDEX" | grep '^MM ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
elif $(echo "$INDEX" | grep '^ T ' &> /dev/null); then elif $(echo "$INDEX" | grep '^ T ' &> /dev/null); then
STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS" STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
fi fi
...@@ -181,7 +185,7 @@ function git_prompt_status() { ...@@ -181,7 +185,7 @@ function git_prompt_status() {
# Outputs -1, 0, or 1 if the installed version is less than, equal to, or # Outputs -1, 0, or 1 if the installed version is less than, equal to, or
# greater than the input version, respectively. # greater than the input version, respectively.
function git_compare_version() { function git_compare_version() {
local INPUT_GIT_VERSION INSTALLED_GIT_VERSION local INPUT_GIT_VERSION INSTALLED_GIT_VERSION i
INPUT_GIT_VERSION=(${(s/./)1}) INPUT_GIT_VERSION=(${(s/./)1})
INSTALLED_GIT_VERSION=($(command git --version 2>/dev/null)) INSTALLED_GIT_VERSION=($(command git --version 2>/dev/null))
INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]}) INSTALLED_GIT_VERSION=(${(s/./)INSTALLED_GIT_VERSION[3]})
......
## Command history configuration ## History wrapper
if [ -z "$HISTFILE" ]; then function omz_history {
HISTFILE=$HOME/.zsh_history local clear list
fi zparseopts -E c=clear l=list
HISTSIZE=10000 if [[ -n "$clear" ]]; then
SAVEHIST=10000 # 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
# unless a number is provided, show all history events (starting from 1)
[[ ${@[-1]} = *[0-9]* ]] && builtin fc -l "$@" || builtin fc -l "$@" 1
fi
}
# Show history # Timestamp format
case $HIST_STAMPS in case $HIST_STAMPS in
"mm/dd/yyyy") alias history='fc -fl 1' ;; "mm/dd/yyyy") alias history='omz_history -f' ;;
"dd.mm.yyyy") alias history='fc -El 1' ;; "dd.mm.yyyy") alias history='omz_history -E' ;;
"yyyy-mm-dd") alias history='fc -il 1' ;; "yyyy-mm-dd") alias history='omz_history -i' ;;
*) alias history='fc -l 1' ;; "") alias history='omz_history' ;;
*) alias history="omz_history -t '$HIST_STAMPS'" ;;
esac esac
setopt append_history ## History file configuration
setopt extended_history [ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
setopt hist_expire_dups_first HISTSIZE=50000
setopt hist_ignore_dups # ignore duplication command history list SAVEHIST=10000
setopt hist_ignore_space
setopt hist_verify ## History command configuration
setopt inc_append_history setopt extended_history # record timestamp of command in HISTFILE
setopt share_history # share command history data 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
...@@ -18,9 +18,8 @@ fi ...@@ -18,9 +18,8 @@ fi
## jobs ## jobs
setopt long_list_jobs setopt long_list_jobs
## pager env_default 'PAGER' 'less'
env_default PAGER 'less' env_default 'LESS' '-R'
env_default LESS '-R'
## super user alias ## super user alias
alias _='sudo' alias _='sudo'
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# Real implementations will be used when the respective plugins are loaded # Real implementations will be used when the respective plugins are loaded
function chruby_prompt_info hg_prompt_info pyenv_prompt_info \ function chruby_prompt_info hg_prompt_info pyenv_prompt_info \
rbenv_prompt_info svn_prompt_info vi_mode_prompt_info \ rbenv_prompt_info svn_prompt_info vi_mode_prompt_info \
virtualenv_prompt_info { virtualenv_prompt_info jenv_prompt_info {
return 1 return 1
} }
......
#! /bin/zsh #! /bin/zsh
# A script to make using 256 colors in zsh less painful. # A script to make using 256 colors in zsh less painful.
# P.C. Shyamshankar <sykora@lucentbeing.com> # 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 typeset -AHg FX FG BG
......
...@@ -80,7 +80,7 @@ preexec_functions+=(omz_termsupport_preexec) ...@@ -80,7 +80,7 @@ preexec_functions+=(omz_termsupport_preexec)
# Keep Apple Terminal.app's current working directory updated # 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 # With extra fixes to handle multibyte chars and non-UTF-8 locales
if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
......
# 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... # Check for updates on initial load...
if [ "$DISABLE_AUTO_UPDATE" != "true" ]; then 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 fi
# Initializes Oh My Zsh # Initializes Oh My Zsh
...@@ -11,20 +22,12 @@ fpath=($ZSH/functions $ZSH/completions $fpath) ...@@ -11,20 +22,12 @@ fpath=($ZSH/functions $ZSH/completions $fpath)
# Load all stock functions (from $fpath files) called below. # Load all stock functions (from $fpath files) called below.
autoload -U compaudit compinit autoload -U compaudit compinit
: ${ZSH_DISABLE_COMPFIX:=true}
# Set ZSH_CUSTOM to the path where your custom config files # Set ZSH_CUSTOM to the path where your custom config files
# and plugins exists, or else we will use the default custom/ # and plugins exists, or else we will use the default custom/
if [[ -z "$ZSH_CUSTOM" ]]; then if [[ -z "$ZSH_CUSTOM" ]]; then
ZSH_CUSTOM="$ZSH/custom" ZSH_CUSTOM="$ZSH/custom"
fi 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 # 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 # TIP: Add files you don't want in git to .gitignore
...@@ -65,16 +68,15 @@ if [ -z "$ZSH_COMPDUMP" ]; then ...@@ -65,16 +68,15 @@ if [ -z "$ZSH_COMPDUMP" ]; then
fi fi
if [[ $ZSH_DISABLE_COMPFIX != true ]]; then 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 if ! compaudit &>/dev/null; then
# This function resides in the "lib/compfix.zsh" script sourced above.
handle_completion_insecurities handle_completion_insecurities
# Else, enable and cache completions to the desired file.
else
compinit -d "${ZSH_COMPDUMP}"
fi fi
else # Load only from secure directories
compinit -i -d "${ZSH_COMPDUMP}" compinit -i -d "${ZSH_COMPDUMP}"
else
# If the user wants it, load from all found directories
compinit -u -d "${ZSH_COMPDUMP}"
fi fi
# Load all of the plugins that were defined in ~/.zshrc # Load all of the plugins that were defined in ~/.zshrc
......
...@@ -48,8 +48,8 @@ _arguments \ ...@@ -48,8 +48,8 @@ _arguments \
case "$state" in case "$state" in
specify_device) specify_device)
_values 'devices' $(adb devices -l|awk 'NR>1&& $1 ~ /^[a-zA-Z0-9].*$/ \ _values -C 'devices' ${$(adb devices -l|awk 'NR>1&& $1 \
{printf "%s[%s] ",$1,$6 }') {sub(/ +/," ",$0);gsub(":","\\:",$1); printf "%s[%s] ",$1, $NF}'):-""}
return return
;; ;;
esac esac
......
# Ant
This plugin provides completion for [Ant](https://ant.apache.org/).
To use it add ant to the plugins array in your zshrc file.
```bash
plugins=(... ant)
```
It caches ant targets in a file named `.ant_targets`, you might want to add that to
your `.gitignore` file.
...@@ -2,6 +2,51 @@ ...@@ -2,6 +2,51 @@
## Features ## Features
#### YAY
| Alias | Command | Description |
|---------|------------------------------------|---------------------------------------------------------------------|
| yaconf | yay -Pg | Print current configuration |
| yain | yay -S | Install packages from the repositories |
| yains | yay -U | Install a package from a local file |
| yainsd | yay -S --asdeps | Install packages as dependencies of another package |
| yaloc | yay -Qi | Display information about a package in the local database |
| yalocs | yay -Qs | Search for packages in the local database |
| yalst | yay -Qe | List installed packages including from AUR (tagged as "local") |
| yamir | yay -Syy | Force refresh of all package lists after updating mirrorlist |
| yaorph | yay -Qtd | Remove orphans using yaourt |
| yare | yay -R | Remove packages, keeping its settings and dependencies |
| yarem | yay -Rns | Remove packages, including its settings and unneeded dependencies |
| yarep | yay -Si | Display information about a package in the repositories |
| yareps | yay -Ss | Search for packages in the repositories |
| yaupg | yay -Syu | Sync with repositories before upgrading packages |
| yasu | yay -Syu --no-confirm | Same as `yaupg`, but without confirmation |
#### TRIZEN
| Alias | Command | Description |
|---------|------------------------------------|---------------------------------------------------------------------|
| trconf | trizen -C | Fix all configuration files with vimdiff |
| trin | trizen -S | Install packages from the repositories |
| trins | trizen -U | Install a package from a local file |
| trinsd | trizen -S --asdeps | Install packages as dependencies of another package |
| trloc | trizen -Qi | Display information about a package in the local database |
| trlocs | trizen -Qs | Search for packages in the local database |
| trlst | trizen -Qe | List installed packages including from AUR (tagged as "local") |
| trmir | trizen -Syy | Force refresh of all package lists after updating mirrorlist |
| trorph | trizen -Qtd | Remove orphans using yaourt |
| trre | trizen -R | Remove packages, keeping its settings and dependencies |
| trrem | trizen -Rns | Remove packages, including its settings and unneeded dependencies |
| trrep | trizen -Si | Display information about a package in the repositories |
| trreps | trizen -Ss | Search for packages in the repositories |
| trupd | trizen -Sy && sudo abs && sudo aur | Update and refresh local package, ABS and AUR databases |
| 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 |
| 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 |
#### YAOURT #### YAOURT
| Alias | Command | Description | | Alias | Command | Description |
...@@ -27,7 +72,7 @@ ...@@ -27,7 +72,7 @@
| yasu | yaourt -Syua --no-confirm | Same as `yaupg`, but without confirmation | | yasu | yaourt -Syua --no-confirm | Same as `yaupg`, but without confirmation |
| upgrade | yaourt -Syu | Sync with repositories before upgrading packages | | upgrade | yaourt -Syu | Sync with repositories before upgrading packages |
### PACAUR #### PACAUR
| Alias | Command | Description | | Alias | Command | Description |
|---------|------------------------------------|---------------------------------------------------------------------| |---------|------------------------------------|---------------------------------------------------------------------|
...@@ -74,7 +119,9 @@ ...@@ -74,7 +119,9 @@
| pacupg | sudo pacman -Syu | Sync with repositories before upgrading packages | | pacupg | sudo pacman -Syu | Sync with repositories before upgrading packages |
| upgrade | sudo pacman -Syu | Sync with repositories before upgrading packages | | upgrade | sudo pacman -Syu | Sync with repositories before upgrading packages |
| pacfileupg | sudo pacman -Fy | Download fresh package databases from the server | | pacfileupg | sudo pacman -Fy | Download fresh package databases from the server |
| pacfiles | pacman -Fs | Search package file names for matching strings. | | pacfiles | pacman -Fs | Search package file names for matching strings |
| pacls | pacman -Ql | List files in a package |
| pacown | pacman -Qo | Show which package owns a file |
| Function | Description | | Function | Description |
|----------------|------------------------------------------------------| |----------------|------------------------------------------------------|
...@@ -82,6 +129,7 @@ ...@@ -82,6 +129,7 @@
| paclist | List all installed packages with a short description | | paclist | List all installed packages with a short description |
| pacmanallkeys | Get all keys for developers and trusted users | | pacmanallkeys | Get all keys for developers and trusted users |
| pacmansignkeys | Locally trust all keys passed as parameters | | pacmansignkeys | Locally trust all keys passed as parameters |
| pacweb | Open the website of an ArchLinux package |
--- ---
...@@ -95,3 +143,4 @@ ...@@ -95,3 +143,4 @@
- ornicar - thibault.duplessis@gmail.com - ornicar - thibault.duplessis@gmail.com
- Juraj Fiala - doctorjellyface@riseup.net - Juraj Fiala - doctorjellyface@riseup.net
- Majora320 (Moses Miller) - Majora320@gmail.com - Majora320 (Moses Miller) - Majora320@gmail.com
- Ybalrid (Arthur Brainville) - ybalrid@ybalrid.info
if (( $+commands[trizen] )); then
alias trconf='trizen -C'
alias trupg='trizen -Syua'
alias trsu='trizen -Syua --noconfirm'
alias trin='trizen -S'
alias trins='trizen -U'
alias trre='trizen -R'
alias trrem='trizen -Rns'
alias trrep='trizen -Si'
alias trreps='trizen -Ss'
alias trloc='trizen -Qi'
alias trlocs='trizen -Qs'
alias trlst='trizen -Qe'
alias trorph='trizen -Qtd'
alias trinsd='trizen -S --asdeps'
alias trmir='trizen -Syy'
if (( $+commands[abs] && $+commands[aur] )); then
alias trupd='trizen -Sy && sudo abs && sudo aur'
elif (( $+commands[abs] )); then
alias trupd='trizen -Sy && sudo abs'
elif (( $+commands[aur] )); then
alias trupd='trizen -Sy && sudo aur'
else
alias trupd='trizen -Sy'
fi
fi
if (( $+commands[yaourt] )); then if (( $+commands[yaourt] )); then
alias yaconf='yaourt -C' alias yaconf='yaourt -C'
alias yaupg='yaourt -Syua' alias yaupg='yaourt -Syua'
...@@ -27,6 +56,35 @@ if (( $+commands[yaourt] )); then ...@@ -27,6 +56,35 @@ if (( $+commands[yaourt] )); then
fi fi
fi fi
if (( $+commands[yay] )); then
alias yaconf='yay -Pg'
alias yaupg='yay -Syu'
alias yasu='yay -Syu --noconfirm'
alias yain='yay -S'
alias yains='yay -U'
alias yare='yay -R'
alias yarem='yay -Rns'
alias yarep='yay -Si'
alias yareps='yay -Ss'
alias yaloc='yay -Qi'
alias yalocs='yay -Qs'
alias yalst='yay -Qe'
alias yaorph='yay -Qtd'
alias yainsd='yay -S --asdeps'
alias yamir='yay -Syy'
if (( $+commands[abs] && $+commands[aur] )); then
alias yaupd='yay -Sy && sudo abs && sudo aur'
elif (( $+commands[abs] )); then
alias yaupd='yay -Sy && sudo abs'
elif (( $+commands[aur] )); then
alias yaupd='yay -Sy && sudo aur'
else
alias yaupd='yay -Sy'
fi
fi
if (( $+commands[pacaur] )); then if (( $+commands[pacaur] )); then
alias paupg='pacaur -Syu' alias paupg='pacaur -Syu'
alias pasu='pacaur -Syu --noconfirm' alias pasu='pacaur -Syu --noconfirm'
...@@ -54,16 +112,24 @@ if (( $+commands[pacaur] )); then ...@@ -54,16 +112,24 @@ if (( $+commands[pacaur] )); then
fi fi
fi fi
if (( $+commands[pacaur] )); then if (( $+commands[trizen] )); then
upgrade() { function upgrade() {
trizen -Syu
}
elif (( $+commands[pacaur] )); then
function upgrade() {
pacaur -Syu pacaur -Syu
} }
elif (( $+commands[yaourt] )); then elif (( $+commands[yaourt] )); then
upgrade() { function upgrade() {
yaourt -Syu yaourt -Syu
} }
elif (( $+commands[yay] )); then
function upgrade() {
yay -Syu
}
else else
upgrade() { function upgrade() {
sudo pacman -Syu sudo pacman -Syu
} }
fi fi
...@@ -83,7 +149,9 @@ alias pacmir='sudo pacman -Syy' ...@@ -83,7 +149,9 @@ alias pacmir='sudo pacman -Syy'
alias paclsorphans='sudo pacman -Qdt' alias paclsorphans='sudo pacman -Qdt'
alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)' alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)'
alias pacfileupg='sudo pacman -Fy' alias pacfileupg='sudo pacman -Fy'
alias pacfiles='pacman tFs' alias pacfiles='pacman -Fs'
alias pacls='pacman -Ql'
alias pacown='pacman -Qo'
if (( $+commands[abs] && $+commands[aur] )); then if (( $+commands[abs] && $+commands[aur] )); then
...@@ -96,13 +164,13 @@ else ...@@ -96,13 +164,13 @@ else
alias pacupd='sudo pacman -Sy' alias pacupd='sudo pacman -Sy'
fi fi
paclist() { function paclist() {
# Source: https://bbs.archlinux.org/viewtopic.php?id=93683 # Source: https://bbs.archlinux.org/viewtopic.php?id=93683
LC_ALL=C pacman -Qei $(pacman -Qu | cut -d " " -f 1) | \ LC_ALL=C pacman -Qei $(pacman -Qu | cut -d " " -f 1) | \
awk 'BEGIN {FS=":"} /^Name/{printf("\033[1;36m%s\033[1;37m", $2)} /^Description/{print $2}' awk 'BEGIN {FS=":"} /^Name/{printf("\033[1;36m%s\033[1;37m", $2)} /^Description/{print $2}'
} }
pacdisowned() { function pacdisowned() {
emulate -L zsh emulate -L zsh
tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$ tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$
...@@ -120,14 +188,14 @@ pacdisowned() { ...@@ -120,14 +188,14 @@ pacdisowned() {
comm -23 "$fs" "$db" comm -23 "$fs" "$db"
} }
pacmanallkeys() { function pacmanallkeys() {
emulate -L zsh emulate -L zsh
curl -s https://www.archlinux.org/people/{developers,trustedusers}/ | \ curl -s https://www.archlinux.org/people/{developers,trustedusers}/ | \
awk -F\" '(/pgp.mit.edu/) { sub(/.*search=0x/,""); print $1}' | \ awk -F\" '(/pgp.mit.edu/) { sub(/.*search=0x/,""); print $1}' | \
xargs sudo pacman-key --recv-keys xargs sudo pacman-key --recv-keys
} }
pacmansignkeys() { function pacmansignkeys() {
emulate -L zsh emulate -L zsh
for key in $*; do for key in $*; do
sudo pacman-key --recv-keys $key sudo pacman-key --recv-keys $key
...@@ -136,3 +204,16 @@ pacmansignkeys() { ...@@ -136,3 +204,16 @@ pacmansignkeys() {
--no-permission-warning --command-fd 0 --edit-key $key --no-permission-warning --command-fd 0 --edit-key $key
done done
} }
if (( $+commands[xdg-open] )); then
function pacweb() {
pkg="$1"
infos="$(pacman -Si "$pkg")"
if [[ -z "$infos" ]]; then
return
fi
repo="$(grep '^Repo' <<< "$infos" | grep -oP '[^ ]+$')"
arch="$(grep '^Arch' <<< "$infos" | grep -oP '[^ ]+$')"
xdg-open "https://www.archlinux.org/packages/$repo/$arch/$pkg/" &>/dev/null
}
fi
# Find where asdf should be installed. # Find where asdf should be installed
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}" ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
# Load asdf, if found. # If not found, check for Homebrew package
if [ -f $ASDF_DIR/asdf.sh ]; then if [[ ! -d $ASDF_DIR ]] && (( $+commands[brew] )); then
. $ASDF_DIR/asdf.sh 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 fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment