diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/brew/_brew | 3 | ||||
-rw-r--r-- | plugins/bundler/bundler.plugin.zsh | 10 | ||||
-rw-r--r-- | plugins/git-flow/git-flow.plugin.zsh | 6 | ||||
-rw-r--r-- | plugins/git/git.plugin.zsh | 23 | ||||
-rw-r--r-- | plugins/jump/jump.plugin.zsh | 8 | ||||
-rw-r--r-- | plugins/mosh/mosh.plugin.zsh | 2 | ||||
-rw-r--r-- | plugins/pip/_pip | 11 | ||||
-rw-r--r-- | plugins/tmux/tmux.plugin.zsh | 2 | ||||
-rw-r--r-- | plugins/web-search/web-search.plugin.zsh | 21 |
9 files changed, 72 insertions, 14 deletions
diff --git a/plugins/brew/_brew b/plugins/brew/_brew index e43ba2900..bf0a286c1 100644 --- a/plugins/brew/_brew +++ b/plugins/brew/_brew @@ -28,6 +28,7 @@ _1st_arguments=( 'missing:check all installed formuale for missing dependencies.' 'outdated:list formulas for which a newer version is available' 'prune:remove dead links' + 'reinstall:reinstall a formula' 'remove:remove a formula' 'search:search for a formula (/regex/ or string)' 'server:start a local web app that lets you browse formulae (requires Sinatra)' @@ -75,7 +76,7 @@ case "$words[1]" in install|home|homepage|log|info|abv|uses|cat|deps|edit|options|versions) _brew_all_formulae _wanted formulae expl 'all formulae' compadd -a formulae ;; - remove|rm|uninstall|unlink|cleanup|link|ln) + reinstall|remove|rm|uninstall|unlink|cleanup|link|ln) _brew_installed_formulae _wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;; esac diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh index c01241409..1e70db6af 100644 --- a/plugins/bundler/bundler.plugin.zsh +++ b/plugins/bundler/bundler.plugin.zsh @@ -1,10 +1,17 @@ alias be="bundle exec" -alias bi="bundle install" alias bl="bundle list" alias bp="bundle package" alias bo="bundle open" alias bu="bundle update" +if [[ "$(uname)" == 'Darwin' ]] +then + local cores_num="$(sysctl hw.ncpu | awk '{print $2}')" +else + local cores_num="$(nproc)" +fi +eval "alias bi='bundle install --jobs=$cores_num'" + # The following is based on https://github.com/gma/bundler-exec bundled_commands=(annotate berks cap capify cucumber foodcritic foreman guard jekyll kitchen knife middleman nanoc rackup rainbows rake rspec ruby shotgun spec spin spork strainer tailor thin thor unicorn unicorn_rails puma) @@ -42,3 +49,4 @@ for cmd in $bundled_commands; do compdef _$cmd bundled_$cmd=$cmd fi done + diff --git a/plugins/git-flow/git-flow.plugin.zsh b/plugins/git-flow/git-flow.plugin.zsh index ab9c0c848..b9ea06844 100644 --- a/plugins/git-flow/git-flow.plugin.zsh +++ b/plugins/git-flow/git-flow.plugin.zsh @@ -20,6 +20,12 @@ # c. Or, use this file as a oh-my-zsh plugin. # +#Alias +alias gf='git flow' +alias gcd='git checkout develop' +alias gch='git checkout hotfix' +alias gcr='git checkout release' + _git-flow () { local curcontext="$curcontext" state line diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 6b91b4a72..bcb32384b 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -54,9 +54,9 @@ compdef gcount=git alias gcl='git config --list' alias gcp='git cherry-pick' compdef _git gcp=git-cherry-pick -alias glg='git log --stat --max-count=5' +alias glg='git log --stat --max-count=10' compdef _git glg=git-log -alias glgg='git log --graph --max-count=5' +alias glgg='git log --graph --max-count=10' compdef _git glgg=git-log alias glgga='git log --graph --decorate --all' compdef _git glgga=git-log @@ -72,7 +72,10 @@ alias grh='git reset HEAD' alias grhh='git reset HEAD --hard' alias gclean='git reset --hard && git clean -dfx' alias gwc='git whatchanged -p --abbrev-commit --pretty=medium' -alias gf='git ls-files | grep' + +#remove the gf alias +#alias gf='git ls-files | grep' + alias gpoat='git push origin --all && git push origin --tags' alias gmt='git mergetool --no-prompt' compdef _git gm=git-mergetool @@ -126,3 +129,17 @@ function _git_log_prettily(){ } alias glp="_git_log_prettily" compdef _git glp=git-log + +# Work In Progress (wip) +# These features allow to pause a branch development and switch to another one (wip) +# When you want to go back to work, just unwip it +# +# This function return a warning if the current branch is a wip +function work_in_progress() { + if $(git log -n 1 | grep -q -c wip); then + echo "WIP!!" + fi +} +# these alias commit and uncomit wip branches +alias gwip='git add -A; git ls-files --deleted -z | xargs -0 git rm; git commit -m "wip"' +alias gunwip='git log -n 1 | grep -q -c wip && git reset HEAD~1' diff --git a/plugins/jump/jump.plugin.zsh b/plugins/jump/jump.plugin.zsh index a3c5cf8c3..5096879d8 100644 --- a/plugins/jump/jump.plugin.zsh +++ b/plugins/jump/jump.plugin.zsh @@ -38,7 +38,13 @@ marks() { } _completemarks() { - reply=($(ls $MARKPATH/**/*(-) | grep : | sed -E 's/(.*)\/([_\da-zA-Z\-]*):$/\2/g')) + if [[ $(ls "${MARKPATH}" | wc -l) -gt 1 ]]; then + reply=($(ls $MARKPATH/**/*(-) | grep : | sed -E 's/(.*)\/([_\da-zA-Z\-]*):$/\2/g')) + else + if readlink -e "${MARKPATH}"/* &>/dev/null; then + reply=($(ls "${MARKPATH}")) + fi + fi } compctl -K _completemarks jump compctl -K _completemarks unmark diff --git a/plugins/mosh/mosh.plugin.zsh b/plugins/mosh/mosh.plugin.zsh new file mode 100644 index 000000000..ea36b7ee9 --- /dev/null +++ b/plugins/mosh/mosh.plugin.zsh @@ -0,0 +1,2 @@ +# Allow SSH tab completion for mosh hostnames +compdef mosh=ssh diff --git a/plugins/pip/_pip b/plugins/pip/_pip index df53ba5ce..fb8765c7e 100644 --- a/plugins/pip/_pip +++ b/plugins/pip/_pip @@ -6,8 +6,8 @@ _pip_all() { # we cache the list of packages (originally from the macports plugin) if (( ! $+piplist )); then - echo -n " (caching package index...)" - piplist=($(pip search * | cut -d ' ' -f 1 | tr '[A-Z]' '[a-z]')) + echo -n " (caching package index...)" + piplist=($(pip search * | cut -d ' ' -f 1 | tr '[A-Z]' '[a-z]')) fi } @@ -62,8 +62,13 @@ case "$words[1]" in '(--no-install)--no-install[only download packages]' \ '(--no-download)--no-download[only install downloaded packages]' \ '(--install-option)--install-option[extra arguments to be supplied to the setup.py]' \ + '(--single-version-externally-managed)--single-version-externally-managed[do not download/install dependencies. requires --record or --root]'\ + '(--root)--root[treat this path as a fake chroot, installing into it. implies --single-version-externally-managed]'\ + '(--record)--record[file to record all installed files to.]'\ + '(-r --requirement)'{-r,--requirement}'[requirements file]: :_files'\ + '(-e --editable)'{-e,--editable}'[path of or url to source to link to instead of installing.]: :_files -/'\ '1: :->packages' && return 0 - + if [[ "$state" == packages ]]; then _pip_all _wanted piplist expl 'packages' compadd -a piplist diff --git a/plugins/tmux/tmux.plugin.zsh b/plugins/tmux/tmux.plugin.zsh index 3ecc2ac69..96fab80a6 100644 --- a/plugins/tmux/tmux.plugin.zsh +++ b/plugins/tmux/tmux.plugin.zsh @@ -38,7 +38,7 @@ if which tmux &> /dev/null fi # Set the correct local config file to use. - if [[ "$ZSH_TMUX_ITERM2" == "false" ]] && (( [[ -f $HOME/.tmux.conf ]] || -h $HOME/.tmux.conf ]] )) + if [[ "$ZSH_TMUX_ITERM2" == "false" ]] && [[ -f $HOME/.tmux.conf || -h $HOME/.tmux.conf ]] then #use this when they have a ~/.tmux.conf export _ZSH_TMUX_FIXED_CONFIG="$zsh_tmux_plugin_path/tmux.extra.conf" diff --git a/plugins/web-search/web-search.plugin.zsh b/plugins/web-search/web-search.plugin.zsh index 6b6de2b15..8eedb90ee 100644 --- a/plugins/web-search/web-search.plugin.zsh +++ b/plugins/web-search/web-search.plugin.zsh @@ -11,7 +11,7 @@ function web_search() { fi # check whether the search engine is supported - if [[ ! $1 =~ '(google|bing|yahoo)' ]]; + if [[ ! $1 =~ '(google|bing|yahoo|duckduckgo)' ]]; then echo "Search engine $1 not supported." return 1 @@ -24,8 +24,12 @@ function web_search() { $open_cmd "$url" return fi - - url="${url}/search?q=" + if [[ $1 == 'duckduckgo' ]]; then + #slightly different search syntax for DDG + url="${url}/?q=" + else + url="${url}/search?q=" + fi shift # shift out $1 while [[ $# -gt 0 ]]; do @@ -34,10 +38,19 @@ function web_search() { done url="${url%?}" # remove the last '+' - + $open_cmd "$url" } + alias bing='web_search bing' alias google='web_search google' alias yahoo='web_search yahoo' +alias ddg='web_search duckduckgo' +#add your own !bang searches here +alias wiki='web_search duckduckgo \!w' +alias news='web_search duckduckgo \!n' +alias youtube='web_search duckduckgo \!yt' +alias map='web_search duckduckgo \!m' +alias image='web_search duckduckgo \!i' +alias ducky='web_search duckduckgo \!' |