revert tmux split keys to original

This commit is contained in:
Maxim Kraev 2016-07-18 13:03:47 +01:00 committed by Maksim Kraev
commit 09b6fde6af
19 changed files with 1422 additions and 85 deletions

336
plugins/archlinux/_yaourt Normal file
View file

@ -0,0 +1,336 @@
#compdef yaourt yaourt.static=yaourt
# copy this file to /usr/share/zsh/site-functions/_pacman
typeset -A opt_args
# options for passing to _arguments: main pacman commands
_yaourt_opts_commands=(
'-Q[Query the package database]'
'-R[Remove a package from the system]'
'-S[Synchronize packages]'
'-U[Upgrade a package]'
'-V[Display version and exit]'
'-h[Display usage]'
'-B[backup pacman database]'
'-G[Get PKGBUILD]'
'-C[Clean backup files]'
'--stats[Package Statistics]'
)
# options for passing to _arguments: options common to all commands
_yaourt_opts_common=(
'-b[Alternate database location]:database_location:_files -/'
'-h[Display syntax for the given operation]'
'-r[Set alternate installation root]:installation root:_files -/'
'-v[Be more verbose]'
'--cachedir[Alternate package cache location]:cache_location:_files -/'
'--config[An alternate configuration file]:config file:_files'
'--logfile[An alternate log file]:config file:_files'
'--noconfirm[Do not ask for confirmation]'
'--noprogressbar[Do not show a progress bar when downloading files]'
'--noscriptlet[Do not execute the install scriptlet if one exists]'
'--print[Only print the targets instead of performing the operation]'
)
# options for passing to _arguments: options for --upgrade commands
_yaourt_opts_pkgfile=(
'-d[Skip dependency checks]'
'-f[Overwrite conflicting files]'
'*:package file:_files -g "*.pkg.tar.*(.)"'
)
# options for passing to _arguments: subactions for --query command
_yaourt_opts_query_actions=(
'-g[View all members of a package group]:*:package groups:->query_group'
'-o[Query the package that owns a file]:file:_files'
'-p[Package file to query]:*:package file:->query_file'
'-s[Search package names and descriptions]:*:search text:->query_search'
)
# options for passing to _arguments: options for --query and subcommands
_yaourt_opts_query_modifiers=(
'-c[List package changelog]'
'-d[List packages installed as dependencies]'
'-e[List packages explicitly installed]'
'-i[View package information]'
'-ii[View package information including backup files]'
'-k[Check package files]'
'-l[List package contents]'
'-m[List installed packages not found in sync db(s)]'
'-t[List packages not required by any package]'
'-u[List packages that can be upgraded]'
'--aur[Install packages from aur, even if they are in community, or, with the -u option, update packages installed from aur]'
'--devel[Used with -u updates all cvs/svn/git/hg/bzr packages]'
)
# options for passing to _arguments: options for --remove command
_yaourt_opts_remove=(
'-c[Remove all dependent packages]'
'-d[Skip dependency checks]'
'-k[Only remove database entry, do not remove files]'
'-n[Remove protected configuration files]'
'-s[Remove dependencies not required by other packages]'
'*:installed package:_yaourt_completions_installed_packages'
)
# options for passing to _arguments: options for --sync command
_yaourt_opts_sync_actions=(
'*-c[Remove old packages from cache]:*:clean:->sync_clean'
'*-cc[Remove all packages from cache]:*:clean:->sync_clean'
'-g[View all members of a package group]:*:package groups:->sync_group'
'-s[Search package names and descriptions]:*:search text:->sync_search'
)
# options for passing to _arguments: options for --sync command
_yaourt_opts_sync_modifiers=(
'-d[Skip dependency checks]'
'-f[Overwrite conflicting files]'
'-i[View package information]'
'-l[List all packages in a repository]'
'-p[Print download URIs for each package to be installed]'
'-u[Upgrade all out-of-date packages]'
'-w[Download packages only]'
'-y[Download fresh package databases]'
'*--ignore[Ignore a package upgrade]:package:
_yaourt_completions_all_packages'
'*--ignoregroup[Ignore a group upgrade]:package group:
_yaourt_completions_all_groups'
'--asdeps[Install packages as non-explicitly installed]'
'--asexplicit[Install packages as explicitly installed]'
)
# handles --help subcommand
_yaourt_action_help() {
_arguments -s : \
"$_yaourt_opts_commands[@]"
}
# handles cases where no subcommand has yet been given
_yaourt_action_none() {
_arguments -s : \
"$_yaourt_opts_commands[@]"
}
# handles --query subcommand
_yaourt_action_query() {
local context state line
typeset -A opt_args
# _arguments -s : \
# "$_yaourt_opts_common[@]" \
# "$_yaourt_opts_query_actions[@]" \
# "$_yaourt_opts_query_modifiers[@]"
case $state in
query_file)
_arguments -s : \
"$_yaourt_opts_common[@]" \
"$_yaourt_opts_query_modifiers[@]" \
'*:package file:_files -g "*.pkg.tar.*"'
;;
query_group)
_arguments -s : \
"$_yaourt_opts_common[@]" \
"$_yaourt_opts_query_modifiers[@]" \
'*:groups:_yaourt_completions_installed_groups'
;;
query_owner)
_arguments -s : \
"$_yaourt_opts_common[@]" \
"$_yaourt_opts_query_modifiers[@]" \
'*:file:_files'
;;
query_search)
_arguments -s : \
"$_yaourt_opts_common[@]" \
"$_yaourt_opts_query_modifiers[@]" \
'*:search text: '
;;
*)
_arguments -s : \
"$_yaourt_opts_common[@]" \
"$_yaourt_opts_query_actions[@]" \
"$_yaourt_opts_query_modifiers[@]" \
'*:package:_yaourt_completions_installed_packages'
;;
esac
}
# handles --remove subcommand
_yaourt_action_remove() {
_arguments -s : \
"$_yaourt_opts_common[@]" \
"$_yaourt_opts_remove[@]"
}
# handles --sync subcommand
_yaourt_action_sync() {
local context state line
typeset -A opt_args
# _arguments -s : \
# "$_yaourt_opts_common[@]" \
# "$_yaourt_opts_sync_actions[@]" #\
# #"$_yaourt_opts_sync_modifiers[@]"
case $state in
sync_clean)
_arguments -s : \
"$_yaourt_opts_common[@]" \
"$_yaourt_opts_sync_modifiers[@]" \
'*-c[Remove old packages from cache]' \
;;
sync_group)
_arguments -s : \
"$_yaourt_opts_common[@]" \
"$_yaourt_opts_sync_modifiers[@]" \
'*:package group:_yaourt_completions_all_groups'
;;
sync_search)
_arguments -s : \
"$_yaourt_opts_common[@]" \
"$_yaourt_opts_sync_modifiers[@]" \
'*:search text: '
;;
*)
_arguments -s : \
"$_yaourt_opts_common[@]" \
"$_yaourt_opts_sync_modifiers[@]" \
'*:package:_yaourt_completions_all_packages'
;;
esac
}
# handles --upgrade subcommand
_yaourt_action_upgrade() {
_arguments -s : \
"$_yaourt_opts_common[@]" \
"$_yaourt_opts_pkgfile[@]"
}
# handles --version subcommand
_yaourt_action_version() {
# no further arguments
return 0
}
# provides completions for package groups
_yaourt_completions_all_groups() {
local -a cmd groups
_yaourt_get_command
groups=( $(_call_program groups $cmd[@] -Sg) )
typeset -U groups
compadd "$@" -a groups
}
# provides completions for packages available from repositories
# these can be specified as either 'package' or 'repository/package'
_yaourt_completions_all_packages() {
local -a cmd packages repositories packages_long
_yaourt_get_command
if compset -P1 '*/*'; then
packages=( $(_call_program packages $cmd[@] -Sql ${words[CURRENT]%/*}) )
typeset -U packages
_wanted repo_packages expl "repository/package" compadd ${(@)packages}
else
packages=( $(_call_program packages $cmd[@] -Sql) )
typeset -U packages
_wanted packages expl "packages" compadd - "${(@)packages}"
repositories=(${(o)${${${(M)${(f)"$(</etc/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
typeset -U repositories
_wanted repo_packages expl "repository/package" compadd -S "/" $repositories
fi
}
# provides completions for package groups
_yaourt_completions_installed_groups() {
local -a cmd groups
_yaourt_get_command
groups=(${(o)${(f)"$(_call_program groups $cmd[@] -Qg)"}% *})
typeset -U groups
compadd "$@" -a groups
}
# provides completions for installed packages
_yaourt_completions_installed_packages() {
local -a cmd packages packages_long
packages_long=(/var/lib/pacman/local/*(/))
packages=( ${${packages_long#/var/lib/pacman/local/}%-*-*} )
compadd "$@" -a packages
}
# provides completions for repository names
_yaourt_completions_repositories() {
local -a cmd repositories
repositories=(${(o)${${${(M)${(f)"$(</etc/pacman.conf)"}:#\[*}/\[/}/\]/}:#options})
# Uniq the array
typeset -U repositories
compadd "$@" -a repositories
}
# builds command for invoking pacman in a _call_program command - extracts
# relevant options already specified (config file, etc)
# $cmd must be declared by calling function
_yaourt_get_command() {
# this is mostly nicked from _perforce
cmd=( "pacman" )
integer i
for (( i = 2; i < CURRENT - 1; i++ )); do
if [[ ${words[i]} = "--config" || ${words[i]} = "--root" ]]; then
cmd+=( ${words[i,i+1]} )
fi
done
}
# main dispatcher
_pacman() {
case $words[2] in
-Q*g*) # ipkg groups
_arguments -s : \
"$_yaourt_opts_common[@]" \
"$_yaourt_opts_query_modifiers[@]" \
'*:groups:_yaourt_completions_installed_groups'
;;
-Q*o*) # file
_arguments -s : \
"$_yaourt_opts_common[@]" \
"$_yaourt_opts_query_modifiers[@]" \
'*:package file:_files'
;;
-Q*p*) # file *.pkg.tar.*
_arguments -s : \
"$_yaourt_opts_common[@]" \
"$_yaourt_opts_query_modifiers[@]" \
'*:package file:_files -g "*.pkg.tar.*"'
;;
-Q*) _yaourt_action_query ;;
-R*) _yaourt_action_remove ;;
-S*c*) # no completion
return 0
;;
-S*l*) # repos
_arguments -s : \
"$_yaourt_opts_common[@]" \
"$_yaourt_opts_sync_modifiers[@]" \
'*:package repo:_yaourt_completions_repositories' \
;;
-S*g*) # pkg groups
_arguments -s : \
"$_yaourt_opts_common[@]" \
"$_yaourt_opts_sync_modifiers[@]" \
'*:package group:_yaourt_completions_all_groups'
;;
-S*) _yaourt_action_sync ;;
-U*) _yaourt_action_upgrade ;;
-V*) _yaourt_action_version ;;
-h*) _yaourt_action_help ;;
- ) _yaourt_action_none ;;
* ) return 1 ;;
esac
}
# run the main dispatcher
_pacman "$@"

View file

@ -67,7 +67,7 @@ else
sudo pacman -Syu
}
fi
if (( $+commands[pacman] )); then
# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
alias pacupg='sudo pacman -Syu'
alias pacin='sudo pacman -S'
@ -134,3 +134,4 @@ pacmansignkeys() {
--no-permission-warning --command-fd 0 --edit-key $key
done
}
fi

View file

@ -0,0 +1,84 @@
# Autocompletion for homebrew-cask.
#
# This script intercepts calls to the brew plugin and adds autocompletion
# for the cask subcommand.
#
# Author: https://github.com/pstadler
compdef _brew-cask brew
_brew-cask()
{
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments -C \
':command:->command' \
':subcmd:->subcmd' \
'*::options:->options'
case $state in
(command)
__call_original_brew
cask_commands=(
'cask:manage casks'
)
_describe -t commands 'brew cask command' cask_commands ;;
(subcmd)
case "$line[1]" in
cask)
if (( CURRENT == 3 )); then
local -a subcommands
subcommands=(
"alfred:used to modify Alfred's scope to include the Caskroom"
'audit:verifies installability of casks'
'checklinks:checks for bad cask links'
'cleanup:cleans up cached downloads'
'create:creates a cask of the given name and opens it in an editor'
'doctor:checks for configuration issues'
'edit:edits the cask of the given name'
'fetch:downloads Cask resources to local cache'
'home:opens the homepage of the cask of the given name'
'info:displays information about the cask of the given name'
'install:installs the cask of the given name'
'list:with no args, lists installed casks; given installed casks, lists installed files'
'search:searches all known casks'
'uninstall:uninstalls the cask of the given name'
"update:a synonym for 'brew update'"
)
_describe -t commands "brew cask subcommand" subcommands
fi ;;
*)
__call_original_brew ;;
esac ;;
(options)
local -a casks installed_casks
local expl
case "$line[2]" in
list|uninstall)
__brew_installed_casks
_wanted installed_casks expl 'installed casks' compadd -a installed_casks ;;
audit|edit|home|info|install)
__brew_all_casks
_wanted casks expl 'all casks' compadd -a casks ;;
esac ;;
esac
}
__brew_all_casks() {
casks=(`brew cask search`)
}
__brew_installed_casks() {
installed_casks=(`brew cask list`)
}
__call_original_brew()
{
local ret=1
_call_function ret _brew
compdef _brew-cask brew
}

145
plugins/brew/_brew Normal file
View file

@ -0,0 +1,145 @@
#compdef brew
#autoload
# imported from https://github.com/Homebrew/homebrew/blob/29f73d2212c2b202fe25f69dcbf440d8391fa4c9/Library/Contributions/brew_zsh_completion.zsh
# Brew ZSH completion function
# Drop this somewhere in your $fpath (like /usr/share/zsh/site-functions)
# and rename it _brew
#
# altered from _fink
_brew_all_formulae() {
formulae=(`brew search`)
}
_brew_installed_formulae() {
installed_formulae=(`brew list`)
}
_brew_installed_taps() {
installed_taps=(`brew tap`)
}
_brew_official_taps() {
official_taps=(`brew tap --list-official`)
}
_brew_pinned_taps() {
pinned_taps=(`brew tap --list-pinned`)
}
_brew_outdated_formulae() {
outdated_formulae=(`brew outdated`)
}
local -a _1st_arguments
_1st_arguments=(
'audit:check formulae for Homebrew coding style'
'cat:display formula file for a formula'
'cleanup:uninstall unused and old versions of packages'
'commands:show a list of commands'
'config:show homebrew and system configuration'
'create:create a new formula'
'deps:list dependencies and dependants of a formula'
'desc:display a description of a formula'
'doctor:audits your installation for common issues'
'edit:edit a formula'
'fetch:download formula resources to the cache'
'gist-logs:generate a gist of the full build logs'
'home:visit the homepage of a formula or the brew project'
'info:information about a formula'
'install:install a formula'
'reinstall:install a formula anew; re-using its current options'
'leaves:show installed formulae that are not dependencies of another installed formula'
'link:link a formula'
'linkapps:symlink .app bundles provided by formulae into /Applications'
'list:list files in a formula or not-installed formulae'
'log:git commit log for a formula'
'missing:check all installed formuale for missing dependencies.'
'migrate:migrate renamed formula to new name'
'outdated:list formulae for which a newer version is available'
'pin:pin specified formulae'
'postinstall:perform post_install for a given formula'
'prune:remove dead links'
'remove:remove a formula'
'search:search for a formula (/regex/ or string)'
'switch:switch between different versions of a formula'
'tap:tap a new formula repository from GitHub, or list existing taps'
'tap-info:information about a tap'
'tap-pin:pin a tap'
'tap-unpin:unpin a tap'
'test-bot:test a formula and build a bottle'
'uninstall:uninstall a formula'
'unlink:unlink a formula'
'unlinkapps:remove symlinked .app bundles provided by formulae from /Applications'
'unpin:unpin specified formulae'
'untap:remove a tapped repository'
'update:fetch latest version of Homebrew and all formulae'
'upgrade:upgrade outdated formulae'
'uses:show formulae which depend on a formula'
`brew commands --quiet --include-aliases`
)
local expl
local -a formulae installed_formulae installed_taps official_taps outdated_formulae
_arguments \
'(-v)-v[verbose]' \
'(--cellar)--cellar[brew cellar]' \
'(--env)--env[brew environment]' \
'(--repository)--repository[brew repository]' \
'(--version)--version[version information]' \
'(--prefix)--prefix[where brew lives on this system]' \
'(--cache)--cache[brew cache]' \
'*:: :->subcmds' && return 0
if (( CURRENT == 1 )); then
_describe -t commands "brew subcommand" _1st_arguments
return
fi
case "$words[1]" in
install|reinstall|audit|home|homepage|log|info|abv|uses|cat|deps|desc|edit|options|switch)
_brew_all_formulae
_wanted formulae expl 'all formulae' compadd -a formulae ;;
linkapps|unlinkapps)
_arguments \
'(--local)--local[operate on ~/Applications instead of /Applications]' \
'1: :->forms' && return 0
if [[ "$state" == forms ]]; then
_brew_installed_formulae
_wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae
fi ;;
list|ls)
_arguments \
'(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \
'(--pinned)--pinned[list all versions of pinned formulae]' \
'(--versions)--versions[list all installed versions of a formula]' \
'1: :->forms' && return 0
if [[ "$state" == forms ]]; then
_brew_installed_formulae
_wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae
fi ;;
remove|rm|uninstall|unlink|cleanup|link|ln|pin|unpin)
_brew_installed_formulae
_wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae ;;
search|-S)
_arguments \
'(--macports)--macports[search the macports repository]' \
'(--fink)--fink[search the fink repository]' ;;
untap|tap-info|tap-pin)
_brew_installed_taps
_wanted installed_taps expl 'installed taps' compadd -a installed_taps ;;
tap)
_brew_official_taps
_wanted official_taps expl 'official taps' compadd -a official_taps ;;
tap-unpin)
_brew_pinned_taps
_wanted pinned_taps expl 'pinned taps' compadd -a pinned_taps ;;
upgrade)
_brew_outdated_formulae
_wanted outdated_formulae expl 'outdated formulae' compadd -a outdated_formulae ;;
esac

View file

@ -48,6 +48,8 @@ alias gb='git branch'
alias gba='git branch -a'
alias gbd='git branch -d'
alias gbda='git branch --no-color --merged | command grep -vE "^(\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d'
alias gbclean='git fetch -p && git branch --merged master | grep -v "\* master" | grep -v "master" | xargs -r -n 1 git branch -d'
alias gbda='git branch --merged | command grep -vE "^(\*|\s*master\s*$)" | command xargs -n 1 git branch -d'
alias gbl='git blame -b -w'
alias gbnm='git branch --no-merged'
alias gbr='git branch --remote'

83
plugins/grunt/README.md Normal file
View file

@ -0,0 +1,83 @@
# grunt-zsh-completion
`grunt-zsh-completion` is the zsh completion script for
[grunt](https://github.com/gruntjs/grunt)/
[grunt-cli](https://github.com/gruntjs/grunt-cli)
It quickly response because it uses the cache.
![Screenshot1](https://raw.github.com/yonchu/grunt-zsh-completion/master/img/screenshot01.png)
![Screenshot2](https://raw.github.com/yonchu/grunt-zsh-completion/master/img/screenshot02.png)
## Installation
Put the `_grunt` file to the `fpath` directory.
```sh
$ cp _grunt /usr/local/share/zsh/site-functions/
$ exec zsh
```
Where the `fpath` directory is ?
```sh
$ echo "$fpath" | tr " " "\n"
```
## Installation for oh-my-zsh
1. In the command line, change to `oh-my-zsh` plugins directory:
```console
$ cd ~/.oh-my-zsh/custom/plugins
```
2. Clone the repository into a new directory called `grunt`:
```console
git clone https://github.com/yonchu/grunt-zsh-completion.git grunt
```
3. Include `grunt` plugin to your .zshrc file along with other plugins:
```zsh
...
plugins=(git grunt)
...
```
4. Restart your terminal application.
## Usage
### Enable caching
If you want to use the cache, set the followings in your .zshrc:
```zsh
zstyle ':completion:*' use-cache yes
```
### Settings
Show grunt file path:
```zsh
zstyle ':completion::complete:grunt::options:' show_grunt_path yes
```
Cache expiration days (default: 7):
```zsh
zstyle ':completion::complete:grunt::options:' expire 1
```
Note that if you change the zstyle settings,
you should delete the cache file and restart zsh.
```console
$ rm ~/.zcompcache/grunt
$ exec zsh
```

257
plugins/grunt/_grunt Normal file
View file

@ -0,0 +1,257 @@
#compdef grunt
#autoload
# -----------------------------------------------------------------------------
# _grunt
#
# Completion script for grunt.
# - https://github.com/gruntjs/grunt
# - https://github.com/gruntjs/grunt-cli
#
# -----------------------------------------------------------------------------
#
# Version : 0.1.1
# Author : Yonchu <yuyuchu3333@gmail.com>
# License : MIT License
# Repository : https://github.com/yonchu/grunt-zsh-completion
# Last Change : 29 Aug 2013.
#
# Copyright (c) 2013 Yonchu.
#
# -----------------------------------------------------------------------------
# USAGE
# -----
#
# Enable caching:
#
# If you want to use the cache, set the followings in your .zshrc:
#
# zstyle ':completion:*' use-cache yes
#
#
# Settings:
#
# - Show grunt file path:
# zstyle ':completion::complete:grunt::options:' show_grunt_path yes
#
# - Cache expiration days (default: 7):
# zstyle ':completion::complete:grunt::options:' expire 1
#
# - Not update options cache if target gruntfile is changed.
# zstyle ':completion::complete:grunt::options:' no_update_options yes
#
# Note that if you change the zstyle settings,
# you should delete the cache file and restart zsh.
#
# $ rm ~/.zcompcache/grunt
# $ exec zsh
#
# -----------------------------------------------------------------------------
function __grunt() {
local curcontext="$curcontext" update_policy state
local show_grunt_path update_msg gruntfile opts tasks
# Setup cache-policy.
zstyle -s ":completion:${curcontext}:" cache-policy update_policy
if [[ -z $update_policy ]]; then
zstyle ":completion:${curcontext}:" cache-policy __grunt_caching_policy
fi
# Check show_path option.
zstyle -b ":completion:${curcontext}:options:" show_grunt_path show_grunt_path
# Get current gruntfile.
gruntfile=$(__grunt_get_gruntfile)
# Initialize opts and tasks.
opts=()
tasks=()
# Add help options.
opts+=('(- 1 *)'{-h,--help}'[Display this help text.]')
## Complete without gruntfile.
if [[ ! -f $gruntfile ]]; then
_arguments "${opts[@]}"
return
fi
## Complete with gruntfile.
# Retrieve cache.
if ! __grunt_update_cache "$gruntfile"; then
update_msg=' (cache updated)'
fi
# Make optioins completion.
if [[ ${#__grunt_opts} -gt 0 ]]; then
opts+=("${__grunt_opts[@]}")
fi
# Complete arguments.
_arguments \
"${opts[@]}" \
'*: :->tasks' \
&& return
case $state in
tasks)
if [[ $show_grunt_path == 'yes' ]]; then
update_msg="$update_msg: ${${gruntfile/#$HOME/~}%/}"
fi
# Make tasks completion.
if [[ ${#__grunt_tasks} -gt 0 ]]; then
tasks+=("${__grunt_tasks[@]}")
_describe -t grunt-task "$verbose grunt task$update_msg" tasks || return 1
fi
;;
esac
return 0
}
# Cache policy:
# The cache file name: grunt
# The cache variable name: __grunt_version __grunt_gruntfile __grunt_opts __grunt_tasks
function __grunt_update_cache() {
# TODO
local version='0.1.1'
local is_updating=0
local gruntfile="$1"
local grunt_info no_update_options cache_path
# Check no_update_options option.
zstyle -b ":completion:${curcontext}:options:" no_update_options no_update_options
if ! ( (( $+__grunt_gruntfile )) \
&& (( $+__grunt_opts )) \
&& (( $+__grunt_tasks )) ) \
&& ! _retrieve_cache 'grunt'; then
is_updating=1
fi
if [[ $gruntfile != $__grunt_gruntfile ]]; then
# Except for --help options.
__grunt_gruntfile=$gruntfile
if [[ $no_update_options == 'yes' ]]; then
if [[ $PREFIX == ${PREFIX#-} ]]; then
# Not options completions.
is_updating=1
elif [[ ${#__grunt_opts} -lt 2 ]]; then
is_updating=1
else
unset __grunt_gruntfile
fi
else
is_updating=1
fi
else
if [[ $PREFIX != ${PREFIX#-} && ${#__grunt_opts} -gt 1 ]]; then
unset __grunt_gruntfile
fi
fi
if _cache_invalid 'grunt'; then
is_updating=1
fi
# Check _grunt version.
if [[ $__grunt_version != $version ]]; then
is_updating=1
fi
if [[ $is_updating -ne 0 ]]; then
# Update caceh.
__grunt_version=$version
__grunt_gruntfile=$gruntfile
is_updating=1
grunt_info=$(grunt --help --no-color --gruntfile "$__grunt_gruntfile" 2>/dev/null)
__grunt_opts=(${(f)"$(__grunt_get_opts "$grunt_info")"})
__grunt_tasks=(${(f)"$(__grunt_get_tasks "$grunt_info")"})
_store_cache 'grunt' __grunt_version __grunt_gruntfile __grunt_opts __grunt_tasks
fi
return $is_updating
}
function __grunt_get_tasks() {
echo -E "$1" \
| grep 'Available tasks' -A 100 \
| grep '^ ' \
| sed -e 's/^[[:blank:]]*//' -e 's/[[:blank:]]*$//' \
| sed -e 's/ /:/'
}
function __grunt_get_opts() {
local opt_hunk opt_sep opt_num line opt
opt_hunk=$(echo -E "$1" \
| grep 'Options$' -A 100 \
| sed '1 d' \
| sed -e 's/[[:blank:]]*$//' \
)
opt_sep=()
opt_hunk=(${(f)opt_hunk})
opt_num=0
for line in "$opt_hunk[@]"; do
opt=$(echo -E "$line" | sed -e 's/^[[:blank:]]*//')
if [[ $line == $opt ]]; then
break
fi
if [[ $opt != ${opt#-} ]]; then
# Start with -
(( opt_num++ ))
opt=$(echo -E "$opt" | sed 's/^\(\(--[^ ]*\)\(, \(-[^ ]*\)\)*\) */\2\\t\4\\\t/')
fi
opt_sep[$opt_num]=("${opt_sep[$opt_num]}${opt}")
done
for line in "$opt_sep[@]"; do
opt=(${(s:\t:)line})
if [[ ${opt[1]} == '--help' ]]; then
continue
fi
if [[ ${#opt} -eq 2 ]]; then
echo -E "(${opt[1]})${opt[1]}[${opt[2]}]"
else
echo -E "(${opt[1]},${opt[2]})${opt[1]}[${opt[3]}]"
echo -E "(${opt[1]},${opt[2]})${opt[2]}[${opt[3]}]"
fi
done
}
function __grunt_get_gruntfile() {
local gruntfile
local curpath="$PWD"
while [ "$curpath" ]; do
for gruntfile in "$curpath/"{G,g}runtfile.{js,coffee}; do
if [[ -e "$gruntfile" ]]; then
echo "$gruntfile"
return
fi
done
curpath=${curpath%/*}
done
return 1
}
function __grunt_caching_policy() {
# Returns status zero if the completions cache needs rebuilding.
# Rebuild if .agignore more recent than cache.
if [[ -f $__grunt_gruntfile && $__grunt_gruntfile -nt $1 ]]; then
# Invalid cache because gruntfile is old.
return 0
fi
local -a oldp
local expire
zstyle -s ":completion:${curcontext}:options:" expire expire || expire=7
# Rebuild if cache is more than $expire days.
oldp=( "$1"(Nm+$expire) )
(( $#oldp ))
}
__grunt "$@"
zstyle ':completion:*' use-cache yes
zstyle ':completion::complete:grunt::options:' expire 7

View file

@ -0,0 +1,105 @@
#Custom functino from MaximKraev
name() {
name=$1
vared -c -p 'rename to: ' name
command mv $1 $name
}
compdef name rename
# мои функции
#
ccd() { cd $1 && ls}
# создать директорию и перейти в нее
mcd(){ mkdir $1; cd $1 }
# если текущая директория пустая, то удалить ее и перейти в родительскую директорию
rcd(){ local P="`pwd`"; cd .. && rmdir "$P" || cd "$P"; }
# разукрашиваем некоторые команды с помощью grc
[[ -f /usr/bin/grc ]] && {
alias ping="grc --colour=auto ping -c 4"
alias traceroute="grc --colour=auto traceroute"
alias make="grc --colour=auto make"
alias diff="grc --colour=auto diff"
alias cvs="grc --colour=auto cvs"
alias netstat="grc --colour=auto netstat"
# разукрашиваем логи с помощью grc
alias logf="grc tailf"
alias logt="grc tail"
alias logc="grc cat"
alias logh="grc head"
}
alias mkpass="makepasswd --char 8"
alias mkpass16="makepasswd --char 16"
# принудимтельное удаление без коррекции
alias rmf='rm -f'
# принудительное рекурсивное удаление без коррекции
alias rmrf='rm -fR'
alias df='df -h'
alias du='du -h'
alias cp='cp --reflink=auto'
alias copy='gpaste-client <'
alias clean_color='sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"'
alias mpv-nv='mpv --profile=no-video'
#escape urls
autoload -U url-quote-magic
zle -N self-insert url-quote-magic
autoload -Uz bracketed-paste-magic
zle -N bracketed-paste bracketed-paste-magic
# if archlinux use gems in local folder
if [[ -x `which pacman` ]]; then
export PATH="`ruby -rubygems -e 'puts Gem.user_dir'`/bin:$PATH"
export GEM_HOME=$(ruby -e 'puts Gem.user_dir')
fi
if [[ -x `which subl3` ]]; then
alias s=subl3
fi
export EDITOR=vim
export VISUAL=$EDITOR
if [ -d "$HOME/bin" ] ; then
export PATH=${HOME}/bin:${PATH}
fi
if [ -d "$HOME/.local/bin" ] ; then
export PATH=$HOME/.local/bin:$PATH
fi
#npm
if [ -d "$HOME/.npm/bin" ] ; then
export PATH=${HOME}/.npm/bin:${PATH}
fi
#go
if [ -d "${HOME}/Projects/go" ] ; then
export GOPATH=$HOME/Projects/go
fi
if [ -d "${HOME}/Projects/go/bin" ] ; then
export PATH=${PATH}:${HOME}/Projects/go/bin
fi
if [ -n "$TMUX" ]; then
function refresh {
export $(tmux show-environment | grep "^SSH_AUTH_SOCK")
export $(tmux show-environment | grep "^DISPLAY")
export $(tmux show-environment | grep "^XAUTHORITY")
export $(tmux show-environment | grep "^SSH_ASKPASS")
export $(tmux show-environment | grep "^SSH_AGENT_PID")
export $(tmux show-environment | grep "^DBUS_SESSION_BUS_ADDRESS")
}
else
function refresh { }
fi
# function preexec {
# refresh
# }
#export PULSE_LATENCY_MSEC=60

5
plugins/osx/_man-preview Normal file
View file

@ -0,0 +1,5 @@
#compdef man-preview
#autoload
_man

View file

@ -1,2 +1,22 @@
set -g default-terminal $ZSH_TMUX_TERM
set -g base-index 1
set -g repeat-time 0
set-window-option -g mode-keys vi
# Allow mouse to select which pane to use
# set -g mouse-select-pane on
#bind C-z run "tmux save-buffer - | xclip -i -selection clipboard"
bind C-c run "tmux show-buffer | gpaste-client"
set -g prefix C-a
bind C-a send-prefix
#bind C-v split-window -h
#bind C-h split-window
bind C-q kill-window
set-window-option -g xterm-keys on
source $HOME/.tmux.conf

View file

@ -1 +1,20 @@
set -g default-terminal $ZSH_TMUX_TERM
set -g base-index 1
set -g repeat-time 0
set-window-option -g mode-keys vi
# Allow mouse to select which pane to use
# set -g mouse-select-pane on
#bind C-z run "tmux save-buffer - | xclip -i -selection clipboard"
bind C-c run "tmux show-buffer | gpaste-client"
set -g prefix C-a
bind C-a send-prefix
#bind C-v split-window -h
#bind C-h split-window
bind C-q kill-window
set-window-option -g xterm-keys on