1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2026-02-11 05:39:45 +08:00

Compare commits

..

No commits in common. "1689e9bb907ab184d7418dd88bc2639a794c916d" and "2b499e1a9e8788d607768ecef67851e8234b72b3" have entirely different histories.

15 changed files with 192 additions and 193 deletions

View File

@ -83,7 +83,7 @@ function detect-clipboard() {
function clippaste() { tmux save-buffer -; }
elif [[ $(uname -r) = *icrosoft* ]]; then
function clipcopy() { clip.exe < "${1:-/dev/stdin}"; }
function clippaste() { powershell.exe -noprofile -command Get-Clipboard; }
function clippaste() { _retry_clipboard_detection_or_fail clippaste "$@"; }
else
function _retry_clipboard_detection_or_fail() {
local clipcmd="${1}"; shift

View File

@ -91,13 +91,12 @@ if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then
function update_terminalapp_cwd() {
emulate -L zsh
# Percent-encode the host and path names.
local URL_HOST URL_PATH
URL_HOST="$(omz_urlencode -P $HOST)" || return 1
URL_PATH="$(omz_urlencode -P $PWD)" || return 1
# Percent-encode the pathname.
local URL_PATH="$(omz_urlencode -P $PWD)"
[[ $? != 0 ]] && return 1
# Undocumented Terminal.app-specific control sequence
printf '\e]7;%s\a' "file://$URL_HOST$URL_PATH"
printf '\e]7;%s\a' "file://$HOST$URL_PATH"
}
# Use a precmd hook instead of a chpwd hook to avoid contaminating output

View File

@ -15,16 +15,20 @@ _composer_get_required_list () {
}
_composer () {
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments \
'*:: :->subcmds'
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments \
'1: :->command'\
'*: :->args'
if (( CURRENT == 1 )) || ( ((CURRENT == 2)) && [ "$words[1]" = "global" ] ) ; then
compadd $(_composer_get_command_list)
else
compadd $(_composer_get_required_list)
fi
case $state in
command)
compadd $(_composer_get_command_list)
;;
*)
compadd $(_composer_get_required_list)
;;
esac
}
compdef _composer composer

View File

@ -1,10 +1,10 @@
fancy-ctrl-z () {
if [[ $#BUFFER -eq 0 ]]; then
BUFFER="fg"
zle accept-line -w
zle accept-line
else
zle push-input -w
zle clear-screen -w
zle push-input
zle clear-screen
fi
}
zle -N fancy-ctrl-z

View File

@ -1,8 +1,7 @@
if [ $commands[fasd] ]; then # check if fasd is installed
fasd_cache="${ZSH_CACHE_DIR}/fasd-init-cache"
if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then
fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install \
zsh-wcomp zsh-wcomp-install >| "$fasd_cache"
fasd --init auto >| "$fasd_cache"
fi
source "$fasd_cache"
unset fasd_cache

View File

@ -1,19 +1,12 @@
ZSH-Geeknote
============
## ZSH-Geeknote
[Geeknote](https://github.com/VitaliyRodnenko/geeknote) plugin for oh-my-zsh.
Plugins provides:
* auto completion of commands and their options
* alias `gn`
- auto completion of commands and their options
- alias `gn`
## Installation
You can find information how to install Geeknote and it's available commands on the [project website](http://www.geeknote.me/).
### oh-my-zsh
This plugin is already bundled in oh-my-zsh. To enable just configure plugin definition
plugins=( ... geeknote ...)
### Antigen
Use [Antigen's](https://github.com/zsh-users/antigen) bundle command to install by adding `antigen bundle s7anley/zsh-geeknote` to your `.zshrc` along with your other plugins.
Maintainer : Ján Koščo ([@s7anley](https://twitter.com/s7anley))

View File

@ -1,157 +1,136 @@
#compdef geeknote
# Geeknote Autocomplete plugin for Zsh
# Requires: Geeknote installed
# Author : Ján Koščo (@s7anley)
__login() {
# no arguments
}
__logout() {
_arguments \
'--force[Do not ask about logging out.]'
}
__settings() {
_arguments \
"--editor+[Set the editor, which use to edit and create notes.]::"
}
__create() {
_arguments \
'--title+[The note title.]::' \
'--content+[The note content.]::' \
'--tags+[One tag or the list of tags which will be added to the note.]::' \
'--notebook+[Set the notebook where to save note.]::' \
'--resource+[Add a resource to the note.]::'
}
__edit() {
_arguments \
'--note+[The name or ID from the previous search of a note to edit.]::' \
'--title+[Set new title of the note.]::' \
'--content+[Set new content of the note.]::' \
'--tags+[Set new list o tags for the note.]::' \
'--notebook+[Assign new notebook for the note.]::' \
'--resource+[Add a resource to the note.]::'
}
__find() {
_arguments \
'--search+[Text to search.]::' \
'--tags+[Notes with which tag/tags to search.]::' \
'--notebook+[In which notebook search the note.]::' \
'--date+[Set date in format dd.mm.yyyy or date range dd.mm.yyyy-dd.mm.yyyy.]::' \
'--count+[How many notes show in the result list.]::' \
'--with-url[Add direct url of each note in results to Evernote web-version.]' \
'--content-search[Search by content, not by title.]' \
'--exact-entry[Search for exact entry of the request.]'
}
__show() {
_arguments \
'--note+[The name or ID from the previous search of a note to show.]::' \
'--raw[Show the raw note body.]'
}
__remove() {
_arguments \
'--note+[The name or ID from the previous search of a note to remove.]::' \
'--force[Do not ask about removing.]'
}
__notebook-list() {
# no arguments
}
__notebook-create() {
_arguments \
'--title+[Set the title of new notebook.]::'
}
__notebook-edit() {
_arguments \
'--title+[Set the title of new notebook.]::' \
'--notebook+[The name of a notebook to rename.]::'
}
__tag-list() {
# no arguments
}
__tag-create() {
_arguments \
'--title+[Set the title of new tag.]::'
}
__tag-edit() {
_arguments \
'--tagname+[The name of a tag to rename.]::' \
'--title+[Set the new name of tag.]::'
}
__user() {
_arguments \
'--full[Show full information.]'
}
# --------------- ------------------------------------------------------------
# Name : _geeknote
# Synopsis : zsh completion for geeknote
# Author : Ján Koščo <3k.stanley@gmail.com>
# HomePage : http://www.geeknote.me
# Version : 0.1
# Tag : [ shell, zsh, completion, evernote ]
# Copyright : © 2014 by Ján Koščo,
# Released under current GPL license.
# --------------- ------------------------------------------------------------
local -a _1st_arguments
_1st_arguments=(
'login':'Authorize in Evernote.'
'logout':'Logout from Evernote.'
'settings':'Show and edit current settings.'
'create':'Create note in Evernote.'
'edit':'Edit note in Evernote.'
'find':'Search notes in Evernote.'
'show':'Output note in the terminal.'
'remove':'Remove note from Evernote.'
'notebook-list':'Show the list of existing notebooks in your Evernote.'
'notebook-create':'Create new notebook.'
'notebook-edit':'Edit/rename notebook.'
'tag-list':'Show the list of existing tags in your Evernote.'
'tag-create':'Create new tag.'
'tag-edit':'Edit/rename tag.'
'user':'Show information about active user.'
'login'
'logout'
'settings'
'create'
'edit'
'find'
'show'
'remove'
'notebook-list'
'notebook-create'
'notebook-edit'
'tag-list'
'tag-create'
'tag-edit'
'tag-remove'
'gnsync'
'user'
)
_arguments '*:: :->command'
if (( CURRENT == 1 )); then
_describe -t commands "geeknote command" _1st_arguments
return
_describe -t commands "geeknote command" _1st_arguments
return
fi
local -a _command_args
case "$words[1]" in
login)
__login ;;
logout)
__logout ;;
settings)
__settings ;;
create)
__create ;;
edit)
__edit ;;
find)
__find ;;
show)
__show ;;
remove)
__remove ;;
notebook-list)
__notebook-list ;;
notebook-create)
__notebook-create ;;
notebook-edit)
__notebook-edit ;;
tag-list)
__tag-list ;;
tag-create)
__tag-create ;;
tag-edit)
__tag-edit ;;
user)
__user ;;
esac
user)
_command_args=(
'(--full)--full' \
)
;;
logout)
_command_args=(
'(--force)--force' \
)
;;
settings)
_command_args=(
'(--editor)--editor' \
)
;;
create)
_command_args=(
'(-t|--title)'{-t,--title}'[note title]' \
'(-c|--content)'{-c,--content}'[note content]' \
'(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \
'(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \
)
;;
edit)
_command_args=(
'(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
'(-t|--title)'{-t,--title}'[note title]' \
'(-c|--content)'{-c,--content}'[note content]' \
'(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \
'(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \
)
;;
remove)
_command_args=(
'(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
'(--force)--force' \
)
;;
show)
_command_args=(
'(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \
)
;;
find)
_command_args=(
'(-s|--search)'{-s,--search}'[text to search]' \
'(-tg|--tags)'{-tg,--tags}'[notes with which tag/tags to search]' \
'(-nb|--notebook)'{-nb,--notebook}'[in which notebook search the note]' \
'(-d|--date)'{-d,--date}'[date in format dd.mm.yyyy or date range dd.mm.yyyy-dd.mm.yyyy]' \
'(-cn|--count)'{-cn,--count}'[how many notes show in the result list]' \
'(-uo|--url-only)'{-uo,--url-only}'[add direct url of each note in results to Evernote web-version]' \
'(-ee|--exact-entry)'{-ee,--exact-entry}'[search for exact entry of the request]' \
'(-cs|--content-search)'{-cs,--content-search}'[search by content, not by title]' \
)
;;
notebook-create)
_command_args=(
'(-t|--title)'{-t,--title}'[notebook title]' \
)
;;
notebook-edit)
_command_args=(
'(-nb|--notebook)'{-nb,--notebook}'[name of notebook to rename]' \
'(-t|--title)'{-t,--title}'[new notebook title]' \
)
;;
notebook-remove)
_command_args=(
'(-nb|--notebook)'{-nb,--notebook}'[name of notebook to remove]' \
'(--force)--force' \
)
;;
tag-create)
_command_args=(
'(-t|--title)'{-t,--title}'[title of tag]' \
)
;;
tag-edit)
_command_args=(
'(-tgn|--tagname)'{-tgn,--tagname}'[tag to edit]' \
'(-t|--title)'{-t,--title}'[new tag name]' \
)
;;
tag-remove)
_command_args=(
'(-tgn|--tagname)'{-tgn,--tagname}'[tag to remove]' \
'(--force)--force' \
)
;;
esac
_arguments \
$_command_args \
&& return 0

View File

@ -1,4 +1,4 @@
function gi() { curl -fLw '\n' https://www.gitignore.io/api/"${(j:,:)@}" }
function gi() { curl -fL https://www.gitignore.io/api/${(j:,:)@} }
_gitignoreio_get_command_list() {
curl -sfL https://www.gitignore.io/api/list | tr "," "\n"

View File

@ -83,7 +83,7 @@ function _gradle_arguments() {
'--quiet[Log errors only]' \
'--recompile-scripts[Forces scripts to be recompiled, bypassing caching]' \
'--refresh-dependencies[Refresh the state of dependencies]' \
'--rerun-tasks[Specifies that any task optimization is ignored]' \
'--rerun-task[Specifies that any task optimization is ignored]' \
'--settings-file[Specifies the settings file]' \
'--stacktrace[Print out the stacktrace also for user exceptions]' \
'--status[Print Gradle Daemon status]' \

View File

@ -67,7 +67,7 @@ _kitchen() {
_kitchen_commands() {
local commands
commands=("${(@f)$(_call_program commands $service help | sed -n 's/^ kitchen \([[:alpha:]]*\) [ A-Z[].*# \(.*\)$/\1:\2/p')}")
commands=("${(@f)$(_call_program commands $service help | sed -n 's/^ kitchen \([[:alpha:]]*\) [ [].*# \(.*\)$/\1:\2/p')}")
_describe -t commands 'kitchen commands' commands
}

View File

@ -26,7 +26,6 @@ Update .zshrc:
### What's inside?
#### Adds handy aliases:
###### general
* `hga` - 'hg add`
* `hgc` - `hg commit`
* `hgb` - `hg branch`
* `hgba` - `hg branches`

View File

@ -34,7 +34,6 @@ _1st_arguments=(
'firmware:Nerves - Build a firmware image for the selected target platform'
'firmware.burn:Nerves - Writes the generated firmware image to an attached SDCard or file'
'firmware.image:Nerves - Create a firmware image file that can be copied byte-for-byte'
'format:Formats the given files and patterns'
'help:Print help information for tasks'
'hex:Print hex help information'
'hex.config:Read or update hex config'
@ -93,7 +92,7 @@ __task_list ()
local expl
declare -a tasks
tasks=(app.start archive archive.build archive.install archive.uninstall clean cmd compile compile.protocols deps deps.clean deps.compile deps.get deps.unlock deps.update do escript.build format help hex hex.config hex.docs hex.info hex.key hex.outdated hex.owner hex.publish hex.search hex.user loadconfig local local.hex local.rebar new phoenix.digest phoenix.gen.channel phoenix.gen.html phoenix.gen.json phoenix.gen.model phoenix.gen.secret phoenix.new phoenix.routes phoenix.server phx.digest phx.digest.clean phx.gen.channel phx.gen.context phx.gen.embedded phx.gen.html phx.gen.json phx.gen.presence phx.gen.schema phx.gen.secret phx.new phx.new.ecto phx.new.web phx.routes phx.server run test)
tasks=(app.start archive archive.build archive.install archive.uninstall clean cmd compile compile.protocols deps deps.clean deps.compile deps.get deps.unlock deps.update do escript.build help hex hex.config hex.docs hex.info hex.key hex.outdated hex.owner hex.publish hex.search hex.user loadconfig local local.hex local.rebar new phoenix.digest phoenix.gen.channel phoenix.gen.html phoenix.gen.json phoenix.gen.model phoenix.gen.secret phoenix.new phoenix.routes phoenix.server phx.digest phx.digest.clean phx.gen.channel phx.gen.context phx.gen.embedded phx.gen.html phx.gen.json phx.gen.presence phx.gen.schema phx.gen.secret phx.new phx.new.ecto phx.new.web phx.routes phx.server run test)
_wanted tasks expl 'help' compadd $tasks
}

View File

@ -10,14 +10,6 @@
# Please visit https://git.zx2c4.com/password-store/tree/COPYING for more information.
# If you use multiple repositories, you can configure completion like this:
#
# compdef _pass workpass
# zstyle ':completion::complete:workpass::' prefix "$HOME/work/pass"
# workpass() {
# PASSWORD_STORE_DIR=$HOME/work/pass pass $@
# }
# If you use multiple repositories, you can configure completion like this:
#
# compdef _pass workpass

View File

@ -1,2 +1,37 @@
autoload -U +X bashcompinit && bashcompinit
source <(stack --bash-completion-script stack)
function _stack_commands() {
local ret=1 state
_arguments ':subcommand:->subcommand' && ret=0
case $state in
subcommand)
subcommands=(
"build:Build the project(s) in this directory/configuration"
"install:Build executables and install to a user path"
"test:Build and test the project(s) in this directory/configuration"
"bench:Build and benchmark the project(s) in this directory/configuration"
"haddock:Generate haddocks for the project(s) in this directory/configuration"
"new:Create a brand new project"
"init:Initialize a stack project based on one or more stack packages"
"solver:Use a dependency solver to try and determine missing extra-deps"
"setup:Get the appropriate ghc for your project"
"path:Print out handy path information"
"unpack:Unpack one or more packages locally"
"update:Update the package index"
"upgrade:Upgrade to the latest stack (experimental)"
"upload:Upload a package to Hackage"
"dot:Visualize your project's dependency graph using Graphviz dot"
"exec:Execute a command"
"ghc:Run ghc"
"ghci:Run ghci in the context of project(s)"
"ide:Run ide-backend-client with the correct arguments"
"runghc:Run runghc"
"clean:Clean the local packages"
"docker:Subcommands specific to Docker use"
)
_describe -t subcommands 'stack subcommands' subcommands && ret=0
esac
return ret
}
compdef _stack_commands stack

View File

@ -3,7 +3,7 @@ src() {
autoload -U compinit zrecompile
compinit -i -d "$cache/zcomp-$HOST"
for f in ${ZDOTDIR:-~}/.zshrc "$cache/zcomp-$HOST"; do
for f in ~/.zshrc "$cache/zcomp-$HOST"; do
zrecompile -p $f && command rm -f $f.zwc.old
done