diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/archlinux/archlinux.plugin.zsh | 14 | ||||
-rw-r--r-- | plugins/branch/README.md | 33 | ||||
-rw-r--r-- | plugins/branch/branch.plugin.zsh | 26 | ||||
-rw-r--r-- | plugins/colored-man-pages/colored-man-pages.plugin.zsh | 36 | ||||
-rw-r--r-- | plugins/common-aliases/common-aliases.plugin.zsh | 2 | ||||
-rw-r--r-- | plugins/composer/composer.plugin.zsh | 4 | ||||
-rw-r--r-- | plugins/ember-cli/README.md | 24 | ||||
-rw-r--r-- | plugins/extract/extract.plugin.zsh | 2 | ||||
-rw-r--r-- | plugins/git-flow/git-flow.plugin.zsh | 2 | ||||
-rw-r--r-- | plugins/git/git.plugin.zsh | 31 | ||||
-rw-r--r-- | plugins/history-substring-search/history-substring-search.plugin.zsh | 9 | ||||
-rwxr-xr-x | plugins/history-substring-search/update-from-upstream.zsh | 6 | ||||
-rw-r--r-- | plugins/mercurial/mercurial.plugin.zsh | 3 | ||||
-rw-r--r-- | plugins/rails/rails.plugin.zsh | 1 | ||||
-rw-r--r-- | plugins/tmux-cssh/_tmux-cssh | 25 | ||||
-rw-r--r-- | plugins/web-search/web-search.plugin.zsh | 2 |
16 files changed, 153 insertions, 67 deletions
diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh index b83c24560..99de5b936 100644 --- a/plugins/archlinux/archlinux.plugin.zsh +++ b/plugins/archlinux/archlinux.plugin.zsh @@ -2,7 +2,7 @@ # Usage is also described at https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins # Look for yaourt, and add some useful functions if we have it. -if [[ -x `command -v yaourt` ]]; then +if (( $+commands[yaourt] )); then upgrade () { yaourt -Syu } @@ -21,11 +21,11 @@ if [[ -x `command -v yaourt` ]]; then alias yalst='yaourt -Qe' # List installed packages, even those installed from AUR (they're tagged as "local") alias yaorph='yaourt -Qtd' # Remove orphans using yaourt # Additional yaourt alias examples - if [[ -x `command -v abs` && -x `command -v aur` ]]; then + if (( $+commands[abs] && $+commands[aur] )); then alias yaupd='yaourt -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories - elif [[ -x `command -v abs` ]]; then + elif (( $+commands[abs] )); then alias yaupd='yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories - elif [[ -x `command -v aur` ]]; then + elif (( $+commands[aur] )); then alias yaupd='yaourt -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories else alias yaupd='yaourt -Sy' # Update and refresh the local package database against repositories @@ -49,11 +49,11 @@ alias pacreps='pacman -Ss' # Search for package(s) in the repositori alias pacloc='pacman -Qi' # Display information about a given package in the local database alias paclocs='pacman -Qs' # Search for package(s) in the local database # Additional pacman alias examples -if [[ -x `command -v abs` && -x `command -v aur` ]]; then +if (( $+commands[abs] && $+commands[aur] )); then alias pacupd='sudo pacman -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories -elif [[ -x `command -v abs` ]]; then +elif (( $+commands[abs] )); then alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories -elif [[ -x `command -v aur` ]]; then +elif (( $+commands[aur] )); then alias pacupd='sudo pacman -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories else alias pacupd='sudo pacman -Sy' # Update and refresh the local package database against repositories diff --git a/plugins/branch/README.md b/plugins/branch/README.md new file mode 100644 index 000000000..56ab8da4b --- /dev/null +++ b/plugins/branch/README.md @@ -0,0 +1,33 @@ +# Branch + +Displays the current Git or Mercurial branch fast. + +## Speed test + +### Mercurial + +```shell +$ time hg branch +0.11s user 0.14s system 70% cpu 0.355 total +``` + +### Branch plugin + +```shell +$ time zsh /tmp/branch_prompt_info_test.zsh +0.00s user 0.01s system 78% cpu 0.014 total +``` + +## Usage + +Edit your theme file (eg.: `~/.oh-my-zsh/theme/robbyrussell.zsh-theme`) +adding `$(branch_prompt_info)` in your prompt like this: + +```diff +- PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' ++ PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)$(branch_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +``` + +## Maintainer + +Victor Torres (<vpaivatorres@gmail.com>) diff --git a/plugins/branch/branch.plugin.zsh b/plugins/branch/branch.plugin.zsh new file mode 100644 index 000000000..a1e9ca31b --- /dev/null +++ b/plugins/branch/branch.plugin.zsh @@ -0,0 +1,26 @@ +# Branch: displays the current Git or Mercurial branch fast. +# Victor Torres <vpaivatorres@gmail.com> +# Oct 2, 2015 + +function branch_prompt_info() { + # Defines path as current directory + local current_dir=$PWD + # While current path is not root path + while [[ $current_dir != '/' ]] + do + # Git repository + if [[ -d "${current_dir}/.git" ]] + then + echo '±' ${"$(<"$current_dir/.git/HEAD")"##*/} + return; + fi + # Mercurial repository + if [[ -d "${current_dir}/.hg" ]] + then + echo '☿' $(<"$current_dir/.hg/branch") + return; + fi + # Defines path as parent directory and keeps looking for :) + current_dir="${current_dir:h}" + done +} diff --git a/plugins/colored-man-pages/colored-man-pages.plugin.zsh b/plugins/colored-man-pages/colored-man-pages.plugin.zsh index 5c613f49d..dd0f241f0 100644 --- a/plugins/colored-man-pages/colored-man-pages.plugin.zsh +++ b/plugins/colored-man-pages/colored-man-pages.plugin.zsh @@ -1,32 +1,32 @@ -if [ "$OSTYPE[0,7]" = "solaris" ] +if [ "$OSTYPE" = solaris* ] then - if [ ! -x ${HOME}/bin/nroff ] + if [ ! -x "$HOME/bin/nroff" ] then - mkdir -p ${HOME}/bin - cat > ${HOME}/bin/nroff <<EOF + mkdir -p "$HOME/bin" + cat > "$HOME/bin/nroff" <<EOF #!/bin/sh if [ -n "\$_NROFF_U" -a "\$1,\$2,\$3" = "-u0,-Tlp,-man" ]; then shift - exec /usr/bin/nroff -u\${_NROFF_U} "\$@" + exec /usr/bin/nroff -u\$_NROFF_U "\$@" fi #-- Some other invocation of nroff exec /usr/bin/nroff "\$@" EOF - chmod +x ${HOME}/bin/nroff + chmod +x "$HOME/bin/nroff" fi fi man() { - env \ - LESS_TERMCAP_mb=$(printf "\e[1;31m") \ - LESS_TERMCAP_md=$(printf "\e[1;31m") \ - LESS_TERMCAP_me=$(printf "\e[0m") \ - LESS_TERMCAP_se=$(printf "\e[0m") \ - LESS_TERMCAP_so=$(printf "\e[1;44;33m") \ - LESS_TERMCAP_ue=$(printf "\e[0m") \ - LESS_TERMCAP_us=$(printf "\e[1;32m") \ - PAGER=/usr/bin/less \ - _NROFF_U=1 \ - PATH=${HOME}/bin:${PATH} \ - man "$@" + env \ + LESS_TERMCAP_mb=$(printf "\e[1;31m") \ + LESS_TERMCAP_md=$(printf "\e[1;31m") \ + LESS_TERMCAP_me=$(printf "\e[0m") \ + LESS_TERMCAP_se=$(printf "\e[0m") \ + LESS_TERMCAP_so=$(printf "\e[1;44;33m") \ + LESS_TERMCAP_ue=$(printf "\e[0m") \ + LESS_TERMCAP_us=$(printf "\e[1;32m") \ + PAGER=/usr/bin/less \ + _NROFF_U=1 \ + PATH="$HOME/bin:$PATH" \ + man "$@" } diff --git a/plugins/common-aliases/common-aliases.plugin.zsh b/plugins/common-aliases/common-aliases.plugin.zsh index fc19d73c3..c7aafd8b8 100644 --- a/plugins/common-aliases/common-aliases.plugin.zsh +++ b/plugins/common-aliases/common-aliases.plugin.zsh @@ -52,7 +52,7 @@ alias mv='mv -i' # zsh is able to auto-do some kungfoo # depends on the SUFFIX :) -if [ ${ZSH_VERSION//\./} -ge 420 ]; then +if is-at-least 4.2.0; then # open browser on urls _browser_fts=(htm html de org net com at cx nl se dk dk php) for ft in $_browser_fts ; do alias -s $ft=$BROWSER ; done diff --git a/plugins/composer/composer.plugin.zsh b/plugins/composer/composer.plugin.zsh index 86f5be3d0..07eb1de88 100644 --- a/plugins/composer/composer.plugin.zsh +++ b/plugins/composer/composer.plugin.zsh @@ -7,11 +7,11 @@ # Composer basic command completion _composer_get_command_list () { - $_comp_command1 --no-ansi | sed "1,/Available commands/d" | awk '/^[ \t]*[a-z]+/ { print $1 }' + $_comp_command1 --no-ansi 2>/dev/null | sed "1,/Available commands/d" | awk '/^[ \t]*[a-z]+/ { print $1 }' } _composer_get_required_list () { - $_comp_command1 show -s --no-ansi | sed '1,/requires/d' | awk 'NF > 0 && !/^requires \(dev\)/{ print $1 }' + $_comp_command1 show -s --no-ansi 2>/dev/null | sed '1,/requires/d' | awk 'NF > 0 && !/^requires \(dev\)/{ print $1 }' } _composer () { diff --git a/plugins/ember-cli/README.md b/plugins/ember-cli/README.md index 482c347d2..1f92bba32 100644 --- a/plugins/ember-cli/README.md +++ b/plugins/ember-cli/README.md @@ -6,14 +6,16 @@ Ember CLI (http://www.ember-cli.com/) ### List of Aliases - alias es='ember serve' - alias ea='ember addon' - alias eb='ember build' - alias ed='ember destroy' - alias eg='ember generate' - alias eh='ember help' - alias ein='ember init' - alias ei='ember install' - alias et='ember test' - alias eu='ember update' - alias ev='ember version' +Alias | Ember-CLI command +----- | ----------------- +**es** | *ember serve* +**ea** | *ember addon* +**eb** | *ember build* +**ed** | *ember destroy* +**eg** | *ember generate* +**eh** | *ember help* +**ein** | *ember init* +**ei** | *ember install* +**et** | *ember test* +**eu** | *ember update* +**ev** | *ember version* diff --git a/plugins/extract/extract.plugin.zsh b/plugins/extract/extract.plugin.zsh index 690126ba6..5d0809e9a 100644 --- a/plugins/extract/extract.plugin.zsh +++ b/plugins/extract/extract.plugin.zsh @@ -52,7 +52,7 @@ function extract() { (*.xz) unxz "$1" ;; (*.lzma) unlzma "$1" ;; (*.Z) uncompress "$1" ;; - (*.zip|*.war|*.jar|*.sublime-package|*.ipsw) unzip "$1" -d $extract_dir ;; + (*.zip|*.war|*.jar|*.sublime-package|*.ipsw|*.xpi|*.apk) unzip "$1" -d $extract_dir ;; (*.rar) unrar x -ad "$1" ;; (*.7z) 7za x "$1" ;; (*.deb) diff --git a/plugins/git-flow/git-flow.plugin.zsh b/plugins/git-flow/git-flow.plugin.zsh index 444440bcb..a8386cb19 100644 --- a/plugins/git-flow/git-flow.plugin.zsh +++ b/plugins/git-flow/git-flow.plugin.zsh @@ -6,7 +6,7 @@ # To achieve git-flow completion nirvana: # # 0. Update your zsh's git-completion module to the newest version. -# From here. http://zsh.git.sourceforge.net/git/gitweb.cgi?p=zsh/zsh;a=blob_plain;f=Completion/Unix/Command/_git;hb=HEAD +# From here. https://raw.githubusercontent.com/zsh-users/zsh/master/Completion/Unix/Command/_git # # 1. Install this file. Either: # diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index d78b82df3..b851fb97d 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -6,19 +6,12 @@ zstyle -s ":vcs_info:git:*:-all-" "command" _omz_git_git_cmd # Functions # -# The current branch name -# Usage example: git pull origin $(current_branch) -# Using '--quiet' with 'symbolic-ref' will not cause a fatal error (128) if -# it's not a symbolic ref, but in a Git repo. +# The name of the current branch +# Back-compatibility wrapper for when this function was defined here in +# the plugin, before being pulled in to core lib/git.zsh as git_current_branch() +# to fix the core -> git plugin dependency. function current_branch() { - local ref - ref=$($_omz_git_git_cmd symbolic-ref --quiet HEAD 2> /dev/null) - local ret=$? - if [[ $ret != 0 ]]; then - [[ $ret == 128 ]] && return # no git repo. - ref=$($_omz_git_git_cmd rev-parse --short HEAD 2> /dev/null) || return - fi - echo ${ref#refs/heads/} + git_current_branch } # The list of remotes function current_repository() { @@ -99,7 +92,7 @@ alias gfo='git fetch origin' alias gg='git gui citool' alias gga='git gui citool --amend' ggf() { -[[ "$#" != 1 ]] && local b="$(current_branch)" +[[ "$#" != 1 ]] && local b="$(git_current_branch)" git push --force origin "${b:=$1}" } compdef _git ggf=git-checkout @@ -107,23 +100,23 @@ ggl() { if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then git pull origin "${*}" else -[[ "$#" == 0 ]] && local b="$(current_branch)" +[[ "$#" == 0 ]] && local b="$(git_current_branch)" git pull origin "${b:=$1}" fi } compdef _git ggl=git-checkout -alias ggpull='git pull origin $(current_branch)' +alias ggpull='git pull origin $(git_current_branch)' compdef _git ggpull=git-checkout ggp() { if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then git push origin "${*}" else -[[ "$#" == 0 ]] && local b="$(current_branch)" +[[ "$#" == 0 ]] && local b="$(git_current_branch)" git push origin "${b:=$1}" fi } compdef _git ggp=git-checkout -alias ggpush='git push origin $(current_branch)' +alias ggpush='git push origin $(git_current_branch)' compdef _git ggpush=git-checkout ggpnp() { if [[ "$#" == 0 ]]; then @@ -133,9 +126,9 @@ ggl "${*}" && ggp "${*}" fi } compdef _git ggpnp=git-checkout -alias ggsup='git branch --set-upstream-to=origin/$(current_branch)' +alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)' ggu() { -[[ "$#" != 1 ]] && local b="$(current_branch)" +[[ "$#" != 1 ]] && local b="$(git_current_branch)" git pull --rebase origin "${b:=$1}" } compdef _git ggu=git-checkout diff --git a/plugins/history-substring-search/history-substring-search.plugin.zsh b/plugins/history-substring-search/history-substring-search.plugin.zsh index 25fd3a2da..7883a65f3 100644 --- a/plugins/history-substring-search/history-substring-search.plugin.zsh +++ b/plugins/history-substring-search/history-substring-search.plugin.zsh @@ -13,11 +13,14 @@ fi # Bind terminal-specific up and down keys - +# Bind in both emacs and vi modes so it works in both, and is not +# sensitive to whether this is loaded before or after the vi-mode plugin if [[ -n "$terminfo[kcuu1]" ]]; then - bindkey "$terminfo[kcuu1]" history-substring-search-up + bindkey -M emacs "$terminfo[kcuu1]" history-substring-search-up + bindkey -M viins "$terminfo[kcuu1]" history-substring-search-up fi if [[ -n "$terminfo[kcud1]" ]]; then - bindkey "$terminfo[kcud1]" history-substring-search-down + bindkey -M emacs "$terminfo[kcud1]" history-substring-search-down + bindkey -M viins "$terminfo[kcud1]" history-substring-search-down fi diff --git a/plugins/history-substring-search/update-from-upstream.zsh b/plugins/history-substring-search/update-from-upstream.zsh index 6e6cca5d5..81e1942a5 100755 --- a/plugins/history-substring-search/update-from-upstream.zsh +++ b/plugins/history-substring-search/update-from-upstream.zsh @@ -76,10 +76,12 @@ cat >> $plugin_basename.plugin.zsh <<EOF # Bind terminal-specific up and down keys if [[ -n "\$terminfo[kcuu1]" ]]; then - bindkey "\$terminfo[kcuu1]" history-substring-search-up + bindkey -M emacs "\$terminfo[kcuu1]" history-substring-search-up + bindkey -M viins "\$terminfo[kcuu1]" history-substring-search-up fi if [[ -n "\$terminfo[kcud1]" ]]; then - bindkey "\$terminfo[kcud1]" history-substring-search-down + bindkey -M emacs "\$terminfo[kcud1]" history-substring-search-down + bindkey -M viins "\$terminfo[kcud1]" history-substring-search-down fi EOF diff --git a/plugins/mercurial/mercurial.plugin.zsh b/plugins/mercurial/mercurial.plugin.zsh index 86200ccf6..3ae59496e 100644 --- a/plugins/mercurial/mercurial.plugin.zsh +++ b/plugins/mercurial/mercurial.plugin.zsh @@ -14,8 +14,7 @@ alias hgo='hg outgoing' alias hgp='hg push' alias hgs='hg status' alias hgsl='hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n" ' -# this is the 'git commit --amend' equivalent -alias hgca='hg qimport -r tip ; hg qrefresh -e ; hg qfinish tip' +alias hgca='hg commit --amend' # list unresolved files (since hg does not list unmerged files in the status command) alias hgun='hg resolve --list' diff --git a/plugins/rails/rails.plugin.zsh b/plugins/rails/rails.plugin.zsh index a390c919c..8af1d6301 100644 --- a/plugins/rails/rails.plugin.zsh +++ b/plugins/rails/rails.plugin.zsh @@ -61,6 +61,7 @@ alias rr='rake routes' alias rrg='rake routes | grep' alias rt='rake test' alias rmd='rake middleware' +alias rsts='rake stats' # legacy stuff alias sstat='thin --stats "/thin/stats" start' diff --git a/plugins/tmux-cssh/_tmux-cssh b/plugins/tmux-cssh/_tmux-cssh new file mode 100644 index 000000000..604e2e478 --- /dev/null +++ b/plugins/tmux-cssh/_tmux-cssh @@ -0,0 +1,25 @@ +#compdef tmux-cssh + +# tmux-cssh autocompletion for oh-my-zsh +# Requires: tmux-cssh installed +# Author: Manfred Touron (@moul) + +_arguments \ +'(-h --help)'{-h,--help}'[This help.]' \ +'(-u --user)'{-u,--user}'[User to use.]' \ +'(-c --certificate)'{-c,--certificate}'[Path to ssh-certificate to use.]' \ +'(-sc --ssh)'{-sc,--ssh}'[SSH-connection-string, multiple.]' \ +'(-sa --ssh)'{-sa,--ssh}'[SSH connection arguments, used on every session.]' \ +'(-ts --tmux)'{-ts,--tmux}'[Alternative tmux-session-name, default: tmux-cssh]' \ +'(-ns --new)'{-ns,--new}'[Initializes a new session, like -ts \[name\].]' \ +'(-q --quiet)'{-q,--quiet}'[Quiet-mode.]' \ +'(-f --filename)'{-f,--filename}'[Filename of textfile to get -sc connection-strings from, line separated.]' \ +'(-cs --config)'{-cs,--config}'[Name of config-settings which should be get from config-file "$HOME/.tmux-cssh". Which can be a grep-regular expression to find the name(s).]' \ + ':hosts:_hosts' \ + '*:: :->subcmds' \ + && return 0 + +if (( CURRENT == 1 )); then + _describe -t commands "tmux-cssh command" + return +fi diff --git a/plugins/web-search/web-search.plugin.zsh b/plugins/web-search/web-search.plugin.zsh index 369a0e680..d3bf97d75 100644 --- a/plugins/web-search/web-search.plugin.zsh +++ b/plugins/web-search/web-search.plugin.zsh @@ -13,6 +13,7 @@ function web_search() { yandex "https://yandex.ru/yandsearch?text=" github "https://github.com/search?q=" baidu "https://www.baidu.com/s?wd=" + ecosia "https://www.ecosia.org/search?q=" ) # check whether the search engine is supported @@ -43,6 +44,7 @@ alias ddg='web_search duckduckgo' alias yandex='web_search yandex' alias github='web_search github' alias baidu='web_search baidu' +alias ecosia='web_search ecosia' #add your own !bang searches here alias wiki='web_search duckduckgo \!w' |