mirror of
https://github.com/zdharma-continuum/zinit.git
synced 2026-09-10 07:36:38 -04:00
feat: refactor debug commands
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
This commit is contained in:
parent
322253cd7b
commit
930b25ee3c
54
_zinit
54
_zinit
|
|
@ -26,17 +26,12 @@ __zinit_commands(){
|
||||||
'compiled:List of compiled plugins'
|
'compiled:List of compiled plugins'
|
||||||
'compinit:Refresh installed completions'
|
'compinit:Refresh installed completions'
|
||||||
'completions:List status of all installed completions'
|
'completions:List status of all installed completions'
|
||||||
'create:Create plugin (also together with Github repository)'
|
'create:Generate Zsh plugin boilerplate'
|
||||||
'creinstall:Install completions for plugin'
|
'creinstall:Install completions for plugin'
|
||||||
'csearch:Search for available completions from any plugin'
|
'csearch:Search for available completions from any plugin'
|
||||||
'cuninstall:Uninstall completions for plugin'
|
'cuninstall:Uninstall completions for plugin'
|
||||||
'dclear:Clear report of what was going on in session'
|
'debug:Functions for debugging Zinit'
|
||||||
'delete:Uninstall a plugin or snippet'
|
'delete:Uninstall a plugin or snippet'
|
||||||
'dreport:Report what was going on in session'
|
|
||||||
'dstart:Start tracking whats going on in session'
|
|
||||||
'dstop:Stop tracking whats going on in session'
|
|
||||||
'dtrace:Start tracking whats going on in session'
|
|
||||||
'dunload:Revert changes recorded between dstart and dstop'
|
|
||||||
'edit:Edit a plugins or snippet with \$EDITOR'
|
'edit:Edit a plugins or snippet with \$EDITOR'
|
||||||
'env-whitelist:Specify names (also patterns) of parameters to be left unchanged during an unload'
|
'env-whitelist:Specify names (also patterns) of parameters to be left unchanged during an unload'
|
||||||
'glance:Look at plugins source'
|
'glance:Look at plugins source'
|
||||||
|
|
@ -65,6 +60,17 @@ __zinit_commands(){
|
||||||
)
|
)
|
||||||
_describe -t commands 'zinit commands' commands
|
_describe -t commands 'zinit commands' commands
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
###
|
||||||
|
# Commands in the debug context
|
||||||
|
###
|
||||||
|
_zinit_debug_commands=(
|
||||||
|
'clear:Clear report of debug tracing session'
|
||||||
|
'report:Show report of debug tracing session'
|
||||||
|
'revert:Revert changes detected during debug tracing session'
|
||||||
|
'start:Start debug tracing session'
|
||||||
|
'status:Show current state of debug mode'
|
||||||
|
'stop:Stop debug tracing session'
|
||||||
|
)
|
||||||
# FUNCTION: __zinit_completion_caching_policy [[[
|
# FUNCTION: __zinit_completion_caching_policy [[[
|
||||||
__zinit_completion_caching_policy(){
|
__zinit_completion_caching_policy(){
|
||||||
local -a tmp
|
local -a tmp
|
||||||
|
|
@ -105,7 +111,7 @@ __zinit_installed_snippets(){
|
||||||
__zinit_list_aliases(){
|
__zinit_list_aliases(){
|
||||||
local -a aliases
|
local -a aliases
|
||||||
aliases=( ls list uninstall delete )
|
aliases=( ls list uninstall delete )
|
||||||
echo "${aliases}"
|
builtin print -- "$aliases"
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: _zinit_add_fpath [[[
|
# FUNCTION: _zinit_add_fpath [[[
|
||||||
|
|
@ -184,7 +190,7 @@ _zinit_compile(){
|
||||||
# FUNCTION: _zinit_create [[[
|
# FUNCTION: _zinit_create [[[
|
||||||
_zinit_create(){
|
_zinit_create(){
|
||||||
_arguments \
|
_arguments \
|
||||||
'1:name:[Name of plugin]' && ret=0
|
'1:Plugin Name' && ret=0
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: _zinit_creinstall [[[
|
# FUNCTION: _zinit_creinstall [[[
|
||||||
_zinit_creinstall(){
|
_zinit_creinstall(){
|
||||||
|
|
@ -198,10 +204,6 @@ _zinit_csearch(){
|
||||||
_zinit_cunistall(){
|
_zinit_cunistall(){
|
||||||
_arguments - installed '*::installed:__zinit_installed' && ret=0
|
_arguments - installed '*::installed:__zinit_installed' && ret=0
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: _zinit_dclear [[[
|
|
||||||
_zinit_dclear(){
|
|
||||||
ret=0
|
|
||||||
} # ]]]
|
|
||||||
# FUNCTION: _zinit_delete [[[
|
# FUNCTION: _zinit_delete [[[
|
||||||
_zinit_delete(){
|
_zinit_delete(){
|
||||||
_arguments \
|
_arguments \
|
||||||
|
|
@ -213,25 +215,9 @@ _zinit_delete(){
|
||||||
{-a,--all}'[Delete all plugins and snippets]' \
|
{-a,--all}'[Delete all plugins and snippets]' \
|
||||||
{-c,--clean}'[Delete only the currently-not loaded plugins and snippets]'
|
{-c,--clean}'[Delete only the currently-not loaded plugins and snippets]'
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: _zinit_dreport [[[
|
_zinit_debug(){
|
||||||
_zinit_dreport(){
|
_arguments \
|
||||||
ret=0
|
'1: :_zinit_debug_cmds'
|
||||||
} # ]]]
|
|
||||||
# FUNCTION: _zinit_dstart [[[
|
|
||||||
_zinit_dstart(){
|
|
||||||
ret=0
|
|
||||||
} # ]]]
|
|
||||||
# FUNCTION: _zinit_dstop [[[
|
|
||||||
_zinit_dstop(){
|
|
||||||
ret=0
|
|
||||||
} # ]]]
|
|
||||||
# FUNCTION: _zinit_dtrace [[[
|
|
||||||
_zinit_dtrace(){
|
|
||||||
ret=0
|
|
||||||
} # ]]]
|
|
||||||
# FUNCTION: _zinit_dunload [[[
|
|
||||||
_zinit_dunload(){
|
|
||||||
ret=0
|
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: _zinit_edit [[[
|
# FUNCTION: _zinit_edit [[[
|
||||||
_zinit_edit(){
|
_zinit_edit(){
|
||||||
|
|
@ -371,6 +357,10 @@ _zinit(){
|
||||||
esac
|
esac
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
|
(( $+functions[_zinit_debug_cmds] )) || _zinit_debug_cmds() {
|
||||||
|
_describe -t commands 'commands' _zinit_debug_commands "$@"
|
||||||
|
}
|
||||||
|
|
||||||
_zinit "$@"
|
_zinit "$@"
|
||||||
|
|
||||||
#vim: filetype=zsh foldmarker=[[[,]]] foldmethod=marker shiftwidth=2 softtabstop=2 tabstop=2:
|
#vim: filetype=zsh foldmarker=[[[,]]] foldmethod=marker shiftwidth=2 softtabstop=2 tabstop=2:
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
# Load the plugin
|
# Load the plugin
|
||||||
if [[ ! -r $1 ]] {
|
if [[ ! -r $1 ]] {
|
||||||
+zinit-message "{error}source: Couldn't read the script {obj}${1}{error}" \
|
+zi-log "{error}source: Couldn't read the script {obj}${1}{error}" \
|
||||||
", cannot substitute {data}${ICE[subst]}{error}.{rst}"
|
", cannot substitute {data}${ICE[subst]}{error}.{rst}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -76,7 +76,6 @@
|
||||||
builtin read -t 1 ___tmp <>"${___fle:r}.fifo2"
|
builtin read -t 1 ___tmp <>"${___fle:r}.fifo2"
|
||||||
done >>! "$ZSRV_WORK_DIR/$ZSRV_ID".log 2>&1
|
done >>! "$ZSRV_WORK_DIR/$ZSRV_ID".log 2>&1
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: .zinit-wrap-track-functions [[[
|
# FUNCTION: .zinit-wrap-track-functions [[[
|
||||||
.zinit-wrap-track-functions() {
|
.zinit-wrap-track-functions() {
|
||||||
local user="$1" plugin="$2" id_as="$3" f
|
local user="$1" plugin="$2" id_as="$3" f
|
||||||
|
|
@ -101,55 +100,120 @@ function $f {
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
#
|
#
|
||||||
# Dtrace
|
# debug command
|
||||||
#
|
#
|
||||||
|
|
||||||
# FUNCTION: .zinit-debug-start [[[
|
# FUNCTION: .zinit-debug-clear [[[
|
||||||
# Starts Dtrace, i.e. session tracking for changes in Zsh state.
|
# Clear latest debug report
|
||||||
.zinit-debug-start() {
|
.zinit-debug-clear() {
|
||||||
|
{
|
||||||
|
.zinit-clear-report-for _dtrace/_dtrace
|
||||||
|
+zi-log '{m} Cleared debug report'
|
||||||
|
} || {
|
||||||
|
+zi-log '{e} Failed to clear debug report'
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
} # ]]]
|
||||||
|
# FUNCTION: .zinit-debug-report [[[
|
||||||
|
# Displays debug report (data recorded in interactive session).
|
||||||
|
.zinit-debug-report() {
|
||||||
if [[ ${ZINIT[DTRACE]} = 1 ]]; then
|
if [[ ${ZINIT[DTRACE]} = 1 ]]; then
|
||||||
+zinit-message "{error}Dtrace is already active, stop it first with \`dstop'{rst}"
|
+zi-log "{e} Debug mode active, stop it first via {cmd}zinit debug stop{rst}"
|
||||||
|
else
|
||||||
|
(( ${+functions[.zinit-unload]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-autoload.zsh" || return 1
|
||||||
|
.zinit-show-report "_dtrace/_dtrace"
|
||||||
|
fi
|
||||||
|
} # ]]]
|
||||||
|
# FUNCTION: .zinit-debug-revert [[[
|
||||||
|
# Revert changes made during debug mode
|
||||||
|
.zinit-debug-revert() {
|
||||||
|
if [[ ${ZINIT[DTRACE]} = 1 ]]; then
|
||||||
|
+zi-log "{e} Debug mode is active. To stop, run {cmd}zinit debug stop{rst}"
|
||||||
|
else
|
||||||
|
(( ${+functions[.zinit-unload]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-autoload.zsh" || return 1
|
||||||
|
.zinit-unload _dtrace _dtrace
|
||||||
|
+zi-log "{m} Reverted changes detected during debug mode"
|
||||||
|
fi
|
||||||
|
} # ]]]
|
||||||
|
# FUNCTION: .zinit-debug-start [[[
|
||||||
|
# Start debug mode
|
||||||
|
.zinit-debug-start() {
|
||||||
|
if [[ $ZINIT[DTRACE] = 1 ]]; then
|
||||||
|
+zi-log "{e} Debug mode currently active"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
(){
|
||||||
ZINIT[DTRACE]=1
|
ZINIT[DTRACE]=1
|
||||||
|
.zinit-diff _dtrace/_dtrace begin
|
||||||
.zinit-diff _dtrace/_dtrace begin
|
.zinit-tmp-subst-on dtrace
|
||||||
|
}
|
||||||
# Full shadeing on
|
if (( $? == 0 )); then
|
||||||
.zinit-tmp-subst-on dtrace
|
+zi-log "{i} Started debug mode"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
} # ]]]
|
||||||
|
# FUNCTION: .zinit-debug-status [[[
|
||||||
|
# Revert changes made during debug mode
|
||||||
|
.zinit-debug-status() {
|
||||||
|
+zi-log -n '{m} Debug mode: '
|
||||||
|
(( ZINIT[DTRACE] )) && +zi-log 'running' || +zi-log 'stopped'
|
||||||
} # ]]]
|
} # ]]]
|
||||||
# FUNCTION: .zinit-debug-stop [[[
|
# FUNCTION: .zinit-debug-stop [[[
|
||||||
# Stops Dtrace (i.e., session tracking for changes in Zsh state).
|
# Stop debug mode
|
||||||
.zinit-debug-stop() {
|
.zinit-debug-stop() {
|
||||||
ZINIT[DTRACE]=0
|
if [[ $ZINIT[DTRACE] = 0 ]]; then
|
||||||
|
+zi-log '{e} Debug mode not active'
|
||||||
# Shadowing fully off
|
return 0
|
||||||
.zinit-tmp-subst-off dtrace
|
|
||||||
|
|
||||||
# Gather end data now, for diffing later
|
|
||||||
.zinit-diff _dtrace/_dtrace end
|
|
||||||
} # ]]]
|
|
||||||
# FUNCTION: .zinit-clear-debug-report [[[
|
|
||||||
# Forgets dtrace repport gathered up to this moment.
|
|
||||||
.zinit-clear-debug-report() {
|
|
||||||
.zinit-clear-report-for _dtrace/_dtrace
|
|
||||||
} # ]]]
|
|
||||||
# FUNCTION: .zinit-debug-unload [[[
|
|
||||||
# Reverts changes detected by dtrace run.
|
|
||||||
.zinit-debug-unload() {
|
|
||||||
(( ${+functions[.zinit-unload]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-autoload.zsh" || return 1
|
|
||||||
if [[ ${ZINIT[DTRACE]} = 1 ]]; then
|
|
||||||
+zinit-message "{error}Dtrace is still active, stop it first with \`dstop'{rst}"
|
|
||||||
else
|
else
|
||||||
.zinit-unload _dtrace _dtrace
|
ZINIT[DTRACE]=0
|
||||||
|
(){
|
||||||
|
.zinit-tmp-subst-off dtrace # turn of shadowing
|
||||||
|
.zinit-diff _dtrace/_dtrace end # get end data to diff later
|
||||||
|
}
|
||||||
|
if (( $? == 0 )); then
|
||||||
|
+zi-log '{i} Stopped debug mode'
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
} # ]]]
|
||||||
|
# FUNCTION: +zinit-debug [[[
|
||||||
|
# Debug command entry point
|
||||||
|
+zinit-debug(){
|
||||||
|
emulate -LR zsh ${=${options[xtrace]:#off}:+-o xtrace}
|
||||||
|
setopt extendedglob noksharrays nokshglob nullglob typesetsilent warncreateglobal
|
||||||
|
local o_help cmd
|
||||||
|
local -a usage=(
|
||||||
|
'Usage:'
|
||||||
|
' zinit debug [options] [command]'
|
||||||
|
' '
|
||||||
|
'Options:'
|
||||||
|
' -h, --help Show list of command-line options'
|
||||||
|
' '
|
||||||
|
'Commands:'
|
||||||
|
' clear Clear debug report'
|
||||||
|
' report Show debug report'
|
||||||
|
' revert Revert changes made during debug mode'
|
||||||
|
' start Start debug mode'
|
||||||
|
' status Current debug status'
|
||||||
|
' stop Stop debug mode'
|
||||||
|
)
|
||||||
|
zmodload zsh/zutil
|
||||||
|
zparseopts -D -F -K -- \
|
||||||
|
{h,-help}=o_help \
|
||||||
|
|| return 1
|
||||||
|
|
||||||
|
(( $#o_help )) && {
|
||||||
|
print -l -- $usage
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd="$1"
|
||||||
|
if (( ! $+functions[.zinit-debug-${cmd}] )); then
|
||||||
|
print -l -- $usage
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
.zinit-debug-${cmd} "${(@)@:2}"
|
||||||
fi
|
fi
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# Local Variables:
|
# vim: ft=zsh sw=4 ts=4 et foldmarker=[[[,]]] foldmethod=marker
|
||||||
# mode: Shell-Script
|
|
||||||
# sh-indentation: 2
|
|
||||||
# indent-tabs-mode: nil
|
|
||||||
# sh-basic-offset: 2
|
|
||||||
# End:
|
|
||||||
# vim: ft=zsh sw=2 ts=2 et foldmarker=[[[,]]] foldmethod=marker
|
|
||||||
|
|
|
||||||
|
|
@ -1414,52 +1414,49 @@ EOF
|
||||||
# User-action entry point.
|
# User-action entry point.
|
||||||
.zinit-help() {
|
.zinit-help() {
|
||||||
builtin print -r -- "${ZINIT[col-p]}Usage${ZINIT[col-rst]}:
|
builtin print -r -- "${ZINIT[col-p]}Usage${ZINIT[col-rst]}:
|
||||||
—— -h|--help|help – usage information
|
—— help – usage information
|
||||||
—— man – manual
|
—— bindkeys – lists bindkeys set up by each plugin
|
||||||
—— version – display zinit version
|
|
||||||
—— self-update – updates and compiles Zinit
|
|
||||||
—— zstatus – overall Zinit statu—— times [-s] [-m] [-a] – statistics on plugin load times, sorted in order of loading; -s – use seconds instead of milliseconds, -m – show plugin loading moments, -a – show both load times and loading moments
|
|
||||||
—— load ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – load plugin, can also receive absolute local path
|
|
||||||
—— light [-b] ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – light plugin load, without reporting/tracking (-b – do track but bindkey-calls only)
|
|
||||||
—— unload ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – unload plugin loaded with \`zinit load ...', -q – quiet
|
|
||||||
—— snippet [-f] ${ZINIT[col-pname]}{url}${ZINIT[col-rst]} – source local or remote file (by direct URL), -f: force – don't use cache
|
|
||||||
—— ls – list snippets in formatted and colorized manner
|
|
||||||
—— ice <ice specification> – add ICE to next command, argument is e.g. from\"gitlab\"
|
|
||||||
—— update [-q] ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]}|URL – Git update plugin or snippet (or all plugins and snippets if ——all passed); besides -q accepts also ——quiet, and also -r/--reset – this option causes to run git reset --hard / svn revert before pulling changes
|
|
||||||
—— status ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]}|URL – Git status for plugin or svn status for snippet (or for all those if ——all passed)
|
|
||||||
—— report ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – show plugin's report (or all plugins' if ——all passed)
|
|
||||||
—— delete [--all|--clean] ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]}|URL – remove plugin or snippet from disk (good to forget wrongly passed ice-mods); --all – purge, --clean – delete plugins and snippets that are not loaded
|
|
||||||
—— loaded|list {keyword} – show what plugins are loaded (filter with \'keyword')
|
|
||||||
—— cd ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – cd into plugin's directory; also support snippets, if feed with URL
|
—— cd ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – cd into plugin's directory; also support snippets, if feed with URL
|
||||||
—— create ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – create plugin (also together with Github repository)
|
—— cdclear [-q] – clear compdef replay list, -q – quiet
|
||||||
—— edit ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – edit plugin's file with \$EDITOR
|
|
||||||
—— glance ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – look at plugin's source (pygmentize, {,source-}highlight)
|
|
||||||
—— stress ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – test plugin for compatibility with set of options
|
|
||||||
—— changes ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – view plugin's git log
|
|
||||||
—— recently ${ZINIT[col-info]}[time-spec]${ZINIT[col-rst]} – show plugins that changed recently, argument is e.g. 1 month 2 days
|
|
||||||
—— clist|completions – list completions in use
|
|
||||||
—— cdisable ${ZINIT[col-info]}cname${ZINIT[col-rst]} – disable completion \`cname'
|
—— cdisable ${ZINIT[col-info]}cname${ZINIT[col-rst]} – disable completion \`cname'
|
||||||
—— cenable ${ZINIT[col-info]}cname${ZINIT[col-rst]} – enable completion \`cname'
|
|
||||||
—— creinstall ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – install completions for plugin, can also receive absolute local path; -q – quiet
|
|
||||||
—— cuninstall ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – uninstall completions for plugin
|
|
||||||
—— csearch – search for available completions from any plugin
|
|
||||||
—— compinit – refresh installed completions
|
|
||||||
—— dtrace|dstart – start tracking what's going on in session
|
|
||||||
—— dstop – stop tracking what's going on in session
|
|
||||||
—— dunload – revert changes recorded between dstart and dstop
|
|
||||||
—— dreport – report what was going on in session
|
|
||||||
—— dclear – clear report of what was going on in session
|
|
||||||
—— compile ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – compile plugin (or all plugins if ——all passed)
|
|
||||||
—— uncompile ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – remove compiled version of plugin (or of all plugins if ——all passed)
|
|
||||||
—— compiled – list plugins that are compiled
|
|
||||||
—— cdlist – show compdef replay list
|
—— cdlist – show compdef replay list
|
||||||
—— cdreplay [-q] – replay compdefs (to be done after compinit), -q – quiet
|
—— cdreplay [-q] – replay compdefs (to be done after compinit), -q – quiet
|
||||||
—— cdclear [-q] – clear compdef replay list, -q – quiet
|
—— cenable ${ZINIT[col-info]}cname${ZINIT[col-rst]} – enable completion \`cname'
|
||||||
—— srv {service-id} [cmd] – control a service, command can be: stop,start,restart,next,quit; \`next' moves the service to another Zshell
|
—— changes ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – view plugin's git log
|
||||||
—— recall ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]}|URL – fetch saved ice modifiers and construct \`zinit ice ...' command
|
—— clist|completions – list completions in use
|
||||||
|
—— compile ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – compile plugin (or all plugins if ——all passed)
|
||||||
|
—— compiled – list plugins that are compiled
|
||||||
|
—— compinit – refresh installed completions
|
||||||
|
—— create ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – create plugin (also together with Github repository)
|
||||||
|
—— creinstall ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – install completions for plugin, can also receive absolute local path; -q – quiet
|
||||||
|
—— csearch – search for available completions from any plugin
|
||||||
|
—— cuninstall ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – uninstall completions for plugin
|
||||||
|
—— debug – manage debug mode
|
||||||
|
—— delete – delete a plugin or snippet
|
||||||
|
—— edit ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – edit plugin's file with \$EDITOR
|
||||||
—— env-whitelist [-v|-h] {env..} – allows to specify names (also patterns) of variables left unchanged during an unload. -v – verbose
|
—— env-whitelist [-v|-h] {env..} – allows to specify names (also patterns) of variables left unchanged during an unload. -v – verbose
|
||||||
—— bindkeys – lists bindkeys set up by each plugin
|
—— glance ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – look at plugin's source (pygmentize, {,source-}highlight)
|
||||||
|
—— ice <ice specification> – add ICE to next command, argument is e.g. from\"gitlab\"
|
||||||
|
—— light [-b] ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – light plugin load, without reporting/tracking (-b – do track but bindkey-calls only)
|
||||||
|
—— load ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – load plugin, can also receive absolute local path
|
||||||
|
—— loaded|list {keyword} – show what plugins are loaded (filter with \'keyword')
|
||||||
|
—— ls – list snippets in formatted and colorized manner
|
||||||
|
—— man – manual
|
||||||
—— module – manage binary Zsh module shipped with Zinit, see \`zinit module help'
|
—— module – manage binary Zsh module shipped with Zinit, see \`zinit module help'
|
||||||
|
—— recall ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]}|URL – fetch saved ice modifiers and construct \`zinit ice ...' command
|
||||||
|
—— recently ${ZINIT[col-info]}[time-spec]${ZINIT[col-rst]} – show plugins that changed recently, argument is e.g. 1 month 2 days
|
||||||
|
—— report ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – show plugin's report (or all plugins' if ——all passed)
|
||||||
|
—— self-update – updates and compiles Zinit
|
||||||
|
—— snippet [-f] ${ZINIT[col-pname]}{url}${ZINIT[col-rst]} – source local or remote file (by direct URL), -f: force – don't use cache
|
||||||
|
—— srv {service-id} [cmd] – control a service, command can be: stop,start,restart,next,quit; \`next' moves the service to another Zshell
|
||||||
|
—— status ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]}|URL – Git status for plugin or svn status for snippet (or for all those if ——all passed)
|
||||||
|
—— stress ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – test plugin for compatibility with set of options
|
||||||
|
—— times [-s] [-m] [-a] – statistics on plugin load times, sorted in order of loading; -s – use seconds instead of milliseconds, -m – show plugin loading moments, -a – show both load times and loading moments
|
||||||
|
—— uncompile ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – remove compiled version of plugin (or of all plugins if ——all passed)
|
||||||
|
—— unload ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} – unload plugin loaded with \`zinit load ...', -q – quiet
|
||||||
|
—— update [-q] ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]}|URL – Git update plugin or snippet (or all plugins and snippets if ——all passed); besides -q accepts also ——quiet, and also -r/--reset – this option causes to run git reset --hard / svn revert before pulling changes
|
||||||
|
—— version – display zinit version
|
||||||
|
—— zstatus – overall Zinit statu
|
||||||
—— add-fpath|fpath ${ZINIT[col-info]}[-f|--front]${ZINIT[col-rst]} \\
|
—— add-fpath|fpath ${ZINIT[col-info]}[-f|--front]${ZINIT[col-rst]} \\
|
||||||
${ZINIT[col-pname]}plg-spec ${ZINIT[col-info]}[subdirectory]${ZINIT[col-rst]} – adds given plugin directory to \$fpath; if the second argument is given, it is appended to the directory path; if the option -f/--front is given, the directory path is prepended instead of appended to \$fpath. The ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} can be absolute path
|
${ZINIT[col-pname]}plg-spec ${ZINIT[col-info]}[subdirectory]${ZINIT[col-rst]} – adds given plugin directory to \$fpath; if the second argument is given, it is appended to the directory path; if the option -f/--front is given, the directory path is prepended instead of appended to \$fpath. The ${ZINIT[col-pname]}plg-spec${ZINIT[col-rst]} can be absolute path
|
||||||
—— run [-l] [plugin] {command} – runs the given command in the given plugin's directory; if the option -l will be given then the plugin should be skipped – the option will cause the previous plugin to be reused"
|
—— run [-l] [plugin] {command} – runs the given command in the given plugin's directory; if the option -l will be given then the plugin should be skipped – the option will cause the previous plugin to be reused"
|
||||||
|
|
@ -2298,7 +2295,7 @@ print -- "\nAvailable ice-modifiers:\n\n${ice_order[*]}"
|
||||||
local k
|
local k
|
||||||
|
|
||||||
.zinit-any-colorify-as-uspl2 "$uspl2"
|
.zinit-any-colorify-as-uspl2 "$uspl2"
|
||||||
(( quiet )) || builtin print -r -- "${ZINIT[col-bar]}---${ZINIT[col-rst]} Unloading plugin: $REPLY ${ZINIT[col-bar]}---${ZINIT[col-rst]}"
|
(( quiet )) || +zi-log "{i} Unloading $REPLY"
|
||||||
|
|
||||||
local ___dir
|
local ___dir
|
||||||
[[ "$user" = "%" ]] && ___dir="$plugin" || ___dir="${ZINIT[PLUGINS_DIR]}/${user:+${user}---}${plugin//\//---}"
|
[[ "$user" = "%" ]] && ___dir="$plugin" || ___dir="${ZINIT[PLUGINS_DIR]}/${user:+${user}---}${plugin//\//---}"
|
||||||
|
|
@ -2734,8 +2731,7 @@ print -- "\nAvailable ice-modifiers:\n\n${ice_order[*]}"
|
||||||
|
|
||||||
# 9. Forget the plugin
|
# 9. Forget the plugin
|
||||||
if [[ "$uspl2" = "_dtrace/_dtrace" ]]; then
|
if [[ "$uspl2" = "_dtrace/_dtrace" ]]; then
|
||||||
.zinit-clear-debug-report
|
.zinit-debug-clear
|
||||||
(( quiet )) || builtin print "dtrace report saved to \$LASTREPORT"
|
|
||||||
else
|
else
|
||||||
(( quiet )) || builtin print "Unregistering plugin $uspl2col"
|
(( quiet )) || builtin print "Unregistering plugin $uspl2col"
|
||||||
.zinit-unregister-plugin "$user" "$plugin" "${sice[teleid]}"
|
.zinit-unregister-plugin "$user" "$plugin" "${sice[teleid]}"
|
||||||
|
|
@ -3435,4 +3431,4 @@ zi::version() {
|
||||||
return $?
|
return $?
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# vim: set fenc=utf8 ffs=unix foldmarker=[[[,]]] foldmethod=marker ft=zsh list et sts=2 sw=2 ts=2 tw=100:
|
# vim: set fenc=utf8 ffs=unix foldmarker=[[[,]]] foldmethod=marker ft=zsh list et sts=4 sw=4 ts=4 tw=100:
|
||||||
|
|
|
||||||
41
zinit.zsh
41
zinit.zsh
|
|
@ -115,7 +115,7 @@ ZINIT[cmds]="\
|
||||||
add-fpath|\
|
add-fpath|\
|
||||||
bindkeys|\
|
bindkeys|\
|
||||||
cclear|cd|cdclear|cdisable|cdlist|cdreplay|cenable|changes|clist|compile|compiled|compinit|completions|create|creinstall|csearch|cuninstall|\
|
cclear|cd|cdclear|cdisable|cdlist|cdreplay|cenable|changes|clist|compile|compiled|compinit|completions|create|creinstall|csearch|cuninstall|\
|
||||||
dclear|delete|dreport|dstart|dstop|dtrace|dunload|\
|
delete|debug|\
|
||||||
edit|env-whitelist|\
|
edit|env-whitelist|\
|
||||||
fpath|\
|
fpath|\
|
||||||
glance|\
|
glance|\
|
||||||
|
|
@ -2157,6 +2157,7 @@ builtin setopt noaliases
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: +zinit-message [[[
|
# FUNCTION: +zinit-message [[[
|
||||||
|
# Logging function
|
||||||
+zinit-message() {
|
+zinit-message() {
|
||||||
builtin emulate -LR zsh -o extendedglob ${=${options[xtrace]:#off}:+-o xtrace}
|
builtin emulate -LR zsh -o extendedglob ${=${options[xtrace]:#off}:+-o xtrace}
|
||||||
local opt msg
|
local opt msg
|
||||||
|
|
@ -2188,6 +2189,11 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
|
||||||
print -n $'\015'
|
print -n $'\015'
|
||||||
fi
|
fi
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
# FUNCTION: +zi-log [[[
|
||||||
|
# Wrapper function for +zinit-message until migrated to +zi-log
|
||||||
|
+zi-log(){
|
||||||
|
+zinit-message $@
|
||||||
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: +zinit-prehelp-usage-message [[[
|
# FUNCTION: +zinit-prehelp-usage-message [[[
|
||||||
+zinit-prehelp-usage-message() {
|
+zinit-prehelp-usage-message() {
|
||||||
|
|
@ -2261,7 +2267,6 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
|
||||||
[[ -n ${ZINIT_ICES[pick]} ]] && ZINIT_ICES[pick]="${ZINIT_ICES[pick]//\$ZPFX/${ZPFX%/}}"
|
[[ -n ${ZINIT_ICES[pick]} ]] && ZINIT_ICES[pick]="${ZINIT_ICES[pick]//\$ZPFX/${ZPFX%/}}"
|
||||||
return retval
|
return retval
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: .zinit-pack-ice [[[
|
# FUNCTION: .zinit-pack-ice [[[
|
||||||
# Remembers all ice-mods, assigns them to concrete plugin. Ice spec
|
# Remembers all ice-mods, assigns them to concrete plugin. Ice spec
|
||||||
# is in general forgotten for second-next command (i.e., ice melts quickly), however they
|
# is in general forgotten for second-next command (i.e., ice melts quickly), however they
|
||||||
|
|
@ -2271,7 +2276,6 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
|
||||||
ZINIT_SICE[$1${1:+${2:+/}}$2]="${ZINIT_SICE[$1${1:+${2:+/}}$2]# }"
|
ZINIT_SICE[$1${1:+${2:+/}}$2]="${ZINIT_SICE[$1${1:+${2:+/}}$2]# }"
|
||||||
return 0
|
return 0
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: .zinit-load-ices [[[
|
# FUNCTION: .zinit-load-ices [[[
|
||||||
.zinit-load-ices() {
|
.zinit-load-ices() {
|
||||||
local id_as="$1" ___key ___path
|
local id_as="$1" ___key ___path
|
||||||
|
|
@ -2298,7 +2302,6 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: .zinit-setup-params [[[
|
# FUNCTION: .zinit-setup-params [[[
|
||||||
.zinit-setup-params() {
|
.zinit-setup-params() {
|
||||||
builtin emulate -LR zsh -o extendedglob ${=${options[xtrace]:#off}:+-o xtrace}
|
builtin emulate -LR zsh -o extendedglob ${=${options[xtrace]:#off}:+-o xtrace}
|
||||||
|
|
@ -2371,7 +2374,6 @@ $match[7]}:-${ZINIT[__last-formatter-code]}}}:+}}}//←→}
|
||||||
|
|
||||||
return ___s
|
return ___s
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: .zinit-submit-turbo [[[
|
# FUNCTION: .zinit-submit-turbo [[[
|
||||||
# If `zinit load`, `zinit light` or `zinit snippet` will be
|
# If `zinit load`, `zinit light` or `zinit snippet` will be
|
||||||
# preceded with 'wait', 'load', 'unload' or 'on-update-of'/'subscribe'
|
# preceded with 'wait', 'load', 'unload' or 'on-update-of'/'subscribe'
|
||||||
|
|
@ -2882,14 +2884,7 @@ You can try to prepend {apo}${___q}{lhi}@{apo}'{error} to the ID if the last ice
|
||||||
(run)
|
(run)
|
||||||
.zinit-run "${@[2-correct,-1]}"
|
.zinit-run "${@[2-correct,-1]}"
|
||||||
;;
|
;;
|
||||||
(dstart|dtrace)
|
|
||||||
(( ${+functions[.zinit-service]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-additional.zsh"
|
|
||||||
.zinit-debug-start
|
|
||||||
;;
|
|
||||||
(dstop)
|
|
||||||
(( ${+functions[.zinit-service]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-additional.zsh"
|
|
||||||
.zinit-debug-stop
|
|
||||||
;;
|
|
||||||
(man)
|
(man)
|
||||||
man "${ZINIT[BIN_DIR]}/doc/zinit.1"
|
man "${ZINIT[BIN_DIR]}/doc/zinit.1"
|
||||||
;;
|
;;
|
||||||
|
|
@ -3057,17 +3052,6 @@ You can try to prepend {apo}${___q}{lhi}@{apo}'{error} to the ID if the last ice
|
||||||
(( ${+functions[.zinit-forget-completion]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-install.zsh" || return 1
|
(( ${+functions[.zinit-forget-completion]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-install.zsh" || return 1
|
||||||
.zinit-compinit; ___retval=$?
|
.zinit-compinit; ___retval=$?
|
||||||
;;
|
;;
|
||||||
(dreport)
|
|
||||||
.zinit-show-debug-report
|
|
||||||
;;
|
|
||||||
(dclear)
|
|
||||||
(( ${+functions[.zinit-service]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-additional.zsh"
|
|
||||||
.zinit-clear-debug-report
|
|
||||||
;;
|
|
||||||
(dunload)
|
|
||||||
(( ${+functions[.zinit-service]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-additional.zsh"
|
|
||||||
.zinit-debug-unload
|
|
||||||
;;
|
|
||||||
(compile)
|
(compile)
|
||||||
(( ${+functions[.zinit-compile-plugin]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-install.zsh" || return 1
|
(( ${+functions[.zinit-compile-plugin]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-install.zsh" || return 1
|
||||||
if [[ $2 = --all || ( -z $2 && -z $3 ) ]]; then
|
if [[ $2 = --all || ( -z $2 && -z $3 ) ]]; then
|
||||||
|
|
@ -3077,6 +3061,11 @@ You can try to prepend {apo}${___q}{lhi}@{apo}'{error} to the ID if the last ice
|
||||||
.zinit-compile-plugin "${2%%(///|//|/)}" "${3%%(///|//|/)}"; ___retval=$?
|
.zinit-compile-plugin "${2%%(///|//|/)}" "${3%%(///|//|/)}"; ___retval=$?
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
(debug)
|
||||||
|
shift;
|
||||||
|
(( ${+functions[+zinit-debug]} )) || builtin source "${ZINIT[BIN_DIR]}/zinit-additional.zsh"
|
||||||
|
+zinit-debug $@
|
||||||
|
;;
|
||||||
(uncompile)
|
(uncompile)
|
||||||
if [[ $2 = --all || ( -z $2 && -z $3 ) ]]; then
|
if [[ $2 = --all || ( -z $2 && -z $3 ) ]]; then
|
||||||
[[ -z $2 ]] && { builtin print -r -- "Assuming --all is passed"; sleep 3; }
|
[[ -z $2 ]] && { builtin print -r -- "Assuming --all is passed"; sleep 3; }
|
||||||
|
|
@ -3179,23 +3168,19 @@ zicompdef() {
|
||||||
zplugin() {
|
zplugin() {
|
||||||
zinit "$@"
|
zinit "$@"
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: zpcdreplay [[[
|
# FUNCTION: zpcdreplay [[[
|
||||||
zpcdreplay() {
|
zpcdreplay() {
|
||||||
.zinit-compdef-replay -q
|
.zinit-compdef-replay -q
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: zpcdclear [[[
|
# FUNCTION: zpcdclear [[[
|
||||||
zpcdclear() {
|
zpcdclear() {
|
||||||
.zinit-compdef-clear -q
|
.zinit-compdef-clear -q
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: zpcompinit [[[
|
# FUNCTION: zpcompinit [[[
|
||||||
zpcompinit() {
|
zpcompinit() {
|
||||||
autoload -Uz compinit
|
autoload -Uz compinit
|
||||||
compinit -d ${ZINIT[ZCOMPDUMP_PATH]:-${ZDOTDIR:-$HOME}/.zcompdump} "${(Q@)${(z@)ZINIT[COMPINIT_OPTS]}}"
|
compinit -d ${ZINIT[ZCOMPDUMP_PATH]:-${ZDOTDIR:-$HOME}/.zcompdump} "${(Q@)${(z@)ZINIT[COMPINIT_OPTS]}}"
|
||||||
} # ]]]
|
} # ]]]
|
||||||
|
|
||||||
# FUNCTION: zpcompdef [[[
|
# FUNCTION: zpcompdef [[[
|
||||||
zpcompdef() {
|
zpcompdef() {
|
||||||
ZINIT_COMPDEF_REPLAY+=( "${(j: :)${(q)@}}" )
|
ZINIT_COMPDEF_REPLAY+=( "${(j: :)${(q)@}}" )
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue