1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-10-16 11:40:46 +00:00

Compare commits

...

3 commits

Author SHA1 Message Date
Christopher Pecoraro
54f5e4338e
Merge cf4093dbdc into 1514145a09 2024-09-20 00:19:35 +02:00
Carlo Sala
1514145a09
feat(nvm): add _omz_nvm_load function 2024-09-19 11:44:51 +02:00
Christopher Pecoraro
cf4093dbdc Add Sanity autocompletion. 2020-05-13 01:22:30 -04:00
4 changed files with 64 additions and 11 deletions

View file

@ -42,6 +42,8 @@ as you want:
zstyle ':omz:plugins:nvm' lazy-cmd eslint prettier typescript ...
```
There will be a function `_omz_nvm_load` available to load `nvm` without executing any other trigger command.
#### `.nvmrc` autoload
Note: _if used at the same time as `lazy`, `autoload` will start working only after nvm has been lazy-loaded_

View file

@ -20,7 +20,7 @@ if [[ -z "$NVM_DIR" ]] || [[ ! -f "$NVM_DIR/nvm.sh" ]]; then
return
fi
function _omz_load_nvm_completion {
function _omz_nvm_setup_completion {
local _nvm_completion
# Load nvm bash completion
for _nvm_completion in "$NVM_DIR/bash_completion" "$NVM_HOMEBREW/etc/bash_completion.d/nvm"; do
@ -33,12 +33,12 @@ function _omz_load_nvm_completion {
break
fi
done
unfunction _omz_load_nvm_completion
unfunction _omz_nvm_setup_completion
}
function _omz_setup_autoload {
function _omz_nvm_setup_autoload {
if ! zstyle -t ':omz:plugins:nvm' autoload; then
unfunction _omz_setup_autoload
unfunction _omz_nvm_setup_autoload
return
fi
@ -68,13 +68,13 @@ function _omz_setup_autoload {
add-zsh-hook chpwd load-nvmrc
load-nvmrc
unfunction _omz_setup_autoload
unfunction _omz_nvm_setup_autoload
}
if zstyle -t ':omz:plugins:nvm' lazy; then
# Call nvm when first using nvm, node, npm, pnpm, yarn, corepack or other commands in lazy-cmd
zstyle -a ':omz:plugins:nvm' lazy-cmd nvm_lazy_cmd
nvm_lazy_cmd=(nvm node npm npx pnpm pnpx yarn corepack $nvm_lazy_cmd) # default values
nvm_lazy_cmd=(_omz_nvm_load nvm node npm npx pnpm pnpx yarn corepack $nvm_lazy_cmd) # default values
eval "
function $nvm_lazy_cmd {
for func in $nvm_lazy_cmd; do
@ -84,14 +84,16 @@ if zstyle -t ':omz:plugins:nvm' lazy; then
done
# Load nvm if it exists in \$NVM_DIR
[[ -f \"\$NVM_DIR/nvm.sh\" ]] && source \"\$NVM_DIR/nvm.sh\"
_omz_load_nvm_completion
_omz_setup_autoload
_omz_nvm_setup_completion
_omz_nvm_setup_autoload
if [[ \"\$0\" != _omz_nvm_load ]]; then
\"\$0\" \"\$@\"
fi
}
"
unset nvm_lazy_cmd
else
source "$NVM_DIR/nvm.sh"
_omz_load_nvm_completion
_omz_setup_autoload
_omz_nvm_setup_completion
_omz_nvm_setup_autoload
fi

7
plugins/sanity/README.md Normal file
View file

@ -0,0 +1,7 @@
# sanity autocomplete plugin
* Adds autocomplete options for all Sanity commands.
## Requirements
In order to make this work, you will need to have Sanity set up in your path.

42
plugins/sanity/_sanity Normal file
View file

@ -0,0 +1,42 @@
#compdef sanity
#autoload
# In order to make this work, you will need to have Sanity installed.
# https://www.sanity.io/
local -a _1st_arguments
_1st_arguments=(
'build:Builds the current Sanity configuration to a static bundle.'
'check:Performs a Sanity check.'
'configcheck:Checks if the required configuration files for plugins exists and are up to date.'
'cors:Interact with CORS-entries for your project.'
'dataset:Interact with datasets in your project.'
'debug:Gathers information on Sanity environment.'
'deploy:Deploys a statically built Sanity studio.'
'docs:Opens the Sanity documentation.'
'documents:Interact with documents in your project.'
'exec:Runs a script in Sanity context.'
'graphql:Interact with GraphQL APIs.'
'help:Displays help information about Sanity.'
'hook:Interact with hooks in your project.'
'init:Initialize a new Sanity project or plugin.'
'install:Installs a Sanity plugin to the current Sanity configuration.'
'login:Authenticates against the Sanity.io API.'
'logout:Logs out of the Sanity.io session.'
'manage:Opens the Sanity project management UI.'
'projects:Interact with projects connected to your logged in user.'
'start:Starts a web server for the Content Studio.'
'undeploy:Removes the deployed studio from <hostname>.sanity.studio.'
'uninstall:Removes a Sanity plugin from the current Sanity configuration.'
'upgrade:Upgrades all (or some) Sanity modules to their latest versions.'
'users:Manage users of your project.'
'versions:Shows the installed versions of Sanity CLI and core components.'
)
_arguments -C '*:: :->subcmds' && return 0
if (( CURRENT == 1 )); then
_describe -t commands "sanity subcommand" _1st_arguments
return
fi