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

Compare commits

...

14 Commits

Author SHA1 Message Date
Alexander Schlarb
1689e9bb90
zsh_reload: respect $ZDOTDIR when searching for .zshrc (#7706) 2020-02-28 21:01:34 +01:00
Gianluca Recchia
befdb4649b
gitignore: add newline to gi output (#7586)
* Add trailing new line at the end of output
* Double-quote variable expansion
2020-02-28 21:00:44 +01:00
Michal Kielan
dddbb5c9eb
mercurial: add hga alias to README (#7547) 2020-02-28 20:51:38 +01:00
Cody Fuller
f94e55a1a9
mix: add format option to completion (#7256) 2020-02-28 20:42:18 +01:00
Wenbing Li
e61228282a
gradle: fix command option name in completion (#6586)
It should be `--rerun-tasks`, the original one miss a 's' at the end.
See https://docs.gradle.org/current/userguide/command_line_interface.html
2020-02-28 20:35:19 +01:00
Sven Hergenhahn
389de86cf5
pass: update completion to upstream version (675a002e) (#6475) 2020-02-28 20:29:44 +01:00
Ville Lautanala
c3984a7759
fasd: cache full fasd initialisation script (#6097)
Using `fasd —-init auto` will first detect terminal and then call
fasd again to generate the final initialisation script. Caching that gives a more significant performance boost.
2020-02-28 20:01:14 +01:00
Joshua Pratt
5023a4787b
stack: use builtin completion command (#6230) 2020-02-28 19:59:33 +01:00
Stephen Heuer
a2cad16790
lib: urlencode hostname in update_terminalapp_cwd (#6245)
Apple's Terminal doesn't open a new tab in your current directory if your hostname has UTF-8 characters in it. Percent encoding the host in addition to the path in update_terminalapp_cwd appears to solve this issue.

Co-authored-by: Marc Cornellà <marc.cornella@live.com>
2020-02-28 19:50:17 +01:00
Thomas Ruiz
864b441688
composer: keep composer autocompletion when using global (#5933) 2020-02-28 19:28:55 +01:00
Gustavo Maia
6f85dc2389
kitchen: change sed regex in completion to capture all commands (#5820)
Co-authored-by: Marc Cornellà <marc.cornella@live.com>
2020-02-28 19:23:36 +01:00
Marc Cornellà
888ab9091c lib: add support for clippaste in WSL using powershell
Source: https://github.com/microsoft/WSL/issues/4852#issuecomment-579616808
2020-02-28 19:07:05 +01:00
Ján Koščo
3e16d64347
geeknote: update completion (#4986)
Fixes Completion only working for first parameter
2020-02-28 17:29:11 +01:00
mickk-on-cpp
08b04f5df2
fancy-ctrl-z: ensure widgets are called with full context (#4838)
This allows other plugins that hook e.g. accept-line to identify the
fancy-ctrl-z widget as the caller and take appropriate steps when
necessary.

See https://github.com/tarruda/zsh-autosuggestions/issues/82#issuecomment-181133379
2020-02-28 17:27:16 +01:00
15 changed files with 193 additions and 192 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() { _retry_clipboard_detection_or_fail clippaste "$@"; } function clippaste() { powershell.exe -noprofile -command Get-Clipboard; }
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,12 +91,13 @@ 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 pathname. # Percent-encode the host and path names.
local URL_PATH="$(omz_urlencode -P $PWD)" local URL_HOST URL_PATH
[[ $? != 0 ]] && return 1 URL_HOST="$(omz_urlencode -P $HOST)" || 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://$HOST$URL_PATH" printf '\e]7;%s\a' "file://$URL_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

@ -15,20 +15,16 @@ _composer_get_required_list () {
} }
_composer () { _composer () {
local curcontext="$curcontext" state line local curcontext="$curcontext" state line
typeset -A opt_args typeset -A opt_args
_arguments \ _arguments \
'1: :->command'\ '*:: :->subcmds'
'*: :->args'
case $state in if (( CURRENT == 1 )) || ( ((CURRENT == 2)) && [ "$words[1]" = "global" ] ) ; then
command) compadd $(_composer_get_command_list)
compadd $(_composer_get_command_list) else
;; compadd $(_composer_get_required_list)
*) fi
compadd $(_composer_get_required_list)
;;
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 zle accept-line -w
else else
zle push-input zle push-input -w
zle clear-screen zle clear-screen -w
fi fi
} }
zle -N fancy-ctrl-z zle -N fancy-ctrl-z

View File

@ -1,7 +1,8 @@
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 auto >| "$fasd_cache" fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install \
zsh-wcomp zsh-wcomp-install >| "$fasd_cache"
fi fi
source "$fasd_cache" source "$fasd_cache"
unset fasd_cache unset fasd_cache

View File

@ -1,12 +1,19 @@
## 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`
You can find information how to install Geeknote and it's available commands on the [project website](http://www.geeknote.me/). ## Installation
Maintainer : Ján Koščo ([@s7anley](https://twitter.com/s7anley)) ### 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.

View File

@ -1,136 +1,157 @@
#compdef geeknote #compdef geeknote
# --------------- ------------------------------------------------------------
# Name : _geeknote # Geeknote Autocomplete plugin for Zsh
# Synopsis : zsh completion for geeknote # Requires: Geeknote installed
# Author : Ján Koščo <3k.stanley@gmail.com> # Author : Ján Koščo (@s7anley)
# HomePage : http://www.geeknote.me
# Version : 0.1 __login() {
# Tag : [ shell, zsh, completion, evernote ] # no arguments
# 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' 'login':'Authorize in Evernote.'
'logout' 'logout':'Logout from Evernote.'
'settings' 'settings':'Show and edit current settings.'
'create' 'create':'Create note in Evernote.'
'edit' 'edit':'Edit note in Evernote.'
'find' 'find':'Search notes in Evernote.'
'show' 'show':'Output note in the terminal.'
'remove' 'remove':'Remove note from Evernote.'
'notebook-list' 'notebook-list':'Show the list of existing notebooks in your Evernote.'
'notebook-create' 'notebook-create':'Create new notebook.'
'notebook-edit' 'notebook-edit':'Edit/rename notebook.'
'tag-list' 'tag-list':'Show the list of existing tags in your Evernote.'
'tag-create' 'tag-create':'Create new tag.'
'tag-edit' 'tag-edit':'Edit/rename tag.'
'tag-remove' 'user':'Show information about active user.'
'gnsync'
'user'
) )
_arguments '*:: :->command' _arguments '*:: :->command'
if (( CURRENT == 1 )); then if (( CURRENT == 1 )); then
_describe -t commands "geeknote command" _1st_arguments _describe -t commands "geeknote command" _1st_arguments
return return
fi fi
local -a _command_args local -a _command_args
case "$words[1]" in case "$words[1]" in
user) login)
_command_args=( __login ;;
'(--full)--full' \ logout)
) __logout ;;
;; settings)
logout) __settings ;;
_command_args=( create)
'(--force)--force' \ __create ;;
) edit)
;; __edit ;;
settings) find)
_command_args=( __find ;;
'(--editor)--editor' \ show)
) __show ;;
;; remove)
create) __remove ;;
_command_args=( notebook-list)
'(-t|--title)'{-t,--title}'[note title]' \ __notebook-list ;;
'(-c|--content)'{-c,--content}'[note content]' \ notebook-create)
'(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \ __notebook-create ;;
'(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \ notebook-edit)
) __notebook-edit ;;
;; tag-list)
edit) __tag-list ;;
_command_args=( tag-create)
'(-n|--note)'{-n,--note}'[name or ID from the previous search of a note to edit]' \ __tag-create ;;
'(-t|--title)'{-t,--title}'[note title]' \ tag-edit)
'(-c|--content)'{-c,--content}'[note content]' \ __tag-edit ;;
'(-tg|--tags)'{-tg,--tags}'[one tag or the list of tags which will be added to the note]' \ user)
'(-nb|--notebook)'{-nb,--notebook}'[name of notebook where to save note]' \ __user ;;
) esac
;;
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 -fL https://www.gitignore.io/api/${(j:,:)@} } function gi() { curl -fLw '\n' 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-task[Specifies that any task optimization is ignored]' \ '--rerun-tasks[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:]]*\) [ [].*# \(.*\)$/\1:\2/p')}") commands=("${(@f)$(_call_program commands $service help | sed -n 's/^ kitchen \([[:alpha:]]*\) [ A-Z[].*# \(.*\)$/\1:\2/p')}")
_describe -t commands 'kitchen commands' commands _describe -t commands 'kitchen commands' commands
} }

View File

@ -26,6 +26,7 @@ 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,6 +34,7 @@ _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'
@ -92,7 +93,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 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 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)
_wanted tasks expl 'help' compadd $tasks _wanted tasks expl 'help' compadd $tasks
} }

View File

@ -10,6 +10,14 @@
# 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,37 +1,2 @@
function _stack_commands() { autoload -U +X bashcompinit && bashcompinit
local ret=1 state source <(stack --bash-completion-script stack)
_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 ~/.zshrc "$cache/zcomp-$HOST"; do for f in ${ZDOTDIR:-~}/.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