1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2026-02-12 05:49:47 +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 -; } function clippaste() { tmux save-buffer -; }
elif [[ $(uname -r) = *icrosoft* ]]; then elif [[ $(uname -r) = *icrosoft* ]]; then
function clipcopy() { clip.exe < "${1:-/dev/stdin}"; } function clipcopy() { clip.exe < "${1:-/dev/stdin}"; }
function clippaste() { powershell.exe -noprofile -command Get-Clipboard; } function clippaste() { _retry_clipboard_detection_or_fail clippaste "$@"; }
else else
function _retry_clipboard_detection_or_fail() { function _retry_clipboard_detection_or_fail() {
local clipcmd="${1}"; shift local clipcmd="${1}"; shift

View File

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

View File

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

View File

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

View File

@ -1,8 +1,7 @@
if [ $commands[fasd] ]; then # check if fasd is installed if [ $commands[fasd] ]; then # check if fasd is installed
fasd_cache="${ZSH_CACHE_DIR}/fasd-init-cache" fasd_cache="${ZSH_CACHE_DIR}/fasd-init-cache"
if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then if [ "$(command -v fasd)" -nt "$fasd_cache" -o ! -s "$fasd_cache" ]; then
fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install \ fasd --init auto >| "$fasd_cache"
zsh-wcomp zsh-wcomp-install >| "$fasd_cache"
fi fi
source "$fasd_cache" source "$fasd_cache"
unset 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. [Geeknote](https://github.com/VitaliyRodnenko/geeknote) plugin for oh-my-zsh.
Plugins provides: Plugins provides:
* auto completion of commands and their options - auto completion of commands and their options
* alias `gn` - 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 Maintainer : Ján Koščo ([@s7anley](https://twitter.com/s7anley))
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.

View File

@ -1,118 +1,34 @@
#compdef geeknote #compdef geeknote
# --------------- ------------------------------------------------------------
# Geeknote Autocomplete plugin for Zsh # Name : _geeknote
# Requires: Geeknote installed # Synopsis : zsh completion for geeknote
# Author : Ján Koščo (@s7anley) # Author : Ján Koščo <3k.stanley@gmail.com>
# HomePage : http://www.geeknote.me
__login() { # Version : 0.1
# no arguments # Tag : [ shell, zsh, completion, evernote ]
} # Copyright : © 2014 by Ján Koščo,
# Released under current GPL license.
__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.]'
}
local -a _1st_arguments local -a _1st_arguments
_1st_arguments=( _1st_arguments=(
'login':'Authorize in Evernote.' 'login'
'logout':'Logout from Evernote.' 'logout'
'settings':'Show and edit current settings.' 'settings'
'create':'Create note in Evernote.' 'create'
'edit':'Edit note in Evernote.' 'edit'
'find':'Search notes in Evernote.' 'find'
'show':'Output note in the terminal.' 'show'
'remove':'Remove note from Evernote.' 'remove'
'notebook-list':'Show the list of existing notebooks in your Evernote.' 'notebook-list'
'notebook-create':'Create new notebook.' 'notebook-create'
'notebook-edit':'Edit/rename notebook.' 'notebook-edit'
'tag-list':'Show the list of existing tags in your Evernote.' 'tag-list'
'tag-create':'Create new tag.' 'tag-create'
'tag-edit':'Edit/rename tag.' 'tag-edit'
'user':'Show information about active user.' 'tag-remove'
'gnsync'
'user'
) )
_arguments '*:: :->command' _arguments '*:: :->command'
@ -124,34 +40,97 @@ fi
local -a _command_args local -a _command_args
case "$words[1]" in 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)
__user ;; _command_args=(
esac '(--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() { _gitignoreio_get_command_list() {
curl -sfL https://www.gitignore.io/api/list | tr "," "\n" curl -sfL https://www.gitignore.io/api/list | tr "," "\n"

View File

@ -83,7 +83,7 @@ function _gradle_arguments() {
'--quiet[Log errors only]' \ '--quiet[Log errors only]' \
'--recompile-scripts[Forces scripts to be recompiled, bypassing caching]' \ '--recompile-scripts[Forces scripts to be recompiled, bypassing caching]' \
'--refresh-dependencies[Refresh the state of dependencies]' \ '--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]' \ '--settings-file[Specifies the settings file]' \
'--stacktrace[Print out the stacktrace also for user exceptions]' \ '--stacktrace[Print out the stacktrace also for user exceptions]' \
'--status[Print Gradle Daemon status]' \ '--status[Print Gradle Daemon status]' \

View File

@ -67,7 +67,7 @@ _kitchen() {
_kitchen_commands() { _kitchen_commands() {
local 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 _describe -t commands 'kitchen commands' commands
} }

View File

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

View File

@ -34,7 +34,6 @@ _1st_arguments=(
'firmware:Nerves - Build a firmware image for the selected target platform' '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.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' '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' 'help:Print help information for tasks'
'hex:Print hex help information' 'hex:Print hex help information'
'hex.config:Read or update hex config' 'hex.config:Read or update hex config'
@ -93,7 +92,7 @@ __task_list ()
local expl local expl
declare -a tasks 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 _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. # 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: # If you use multiple repositories, you can configure completion like this:
# #
# compdef _pass workpass # compdef _pass workpass

View File

@ -1,2 +1,37 @@
autoload -U +X bashcompinit && bashcompinit function _stack_commands() {
source <(stack --bash-completion-script stack) 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 autoload -U compinit zrecompile
compinit -i -d "$cache/zcomp-$HOST" 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 zrecompile -p $f && command rm -f $f.zwc.old
done done