summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMonson Shao <holymonson@gmail.com>2020-07-03 12:16:58 +0800
committerMarc Cornellà <hello@mcornella.com>2021-10-04 16:24:05 +0200
commitbe4a952972de03d501fbff79435ae41594f06bac (patch)
tree7c4889006414d4d26433284c7d0f07b8971dede0 /lib
parent56ab66b19429e5609e4331a987368ce2c844c7be (diff)
downloadzsh-be4a952972de03d501fbff79435ae41594f06bac.tar.gz
zsh-be4a952972de03d501fbff79435ae41594f06bac.tar.bz2
zsh-be4a952972de03d501fbff79435ae41594f06bac.zip
feat(cli)!: add `omz reload` command and deprecate `zsh_reload` plugin (#9078)
BREAKING CHANGE: the `zsh_reload` plugin is deprecated. Instead of using its `src` function, use `omz reload` or `exec zsh` to reload zsh after making changes to your `.zshrc` file. Closes #9078
Diffstat (limited to 'lib')
-rw-r--r--lib/cli.zsh12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/cli.zsh b/lib/cli.zsh
index cadc82e27..773891fce 100644
--- a/lib/cli.zsh
+++ b/lib/cli.zsh
@@ -26,6 +26,7 @@ function _omz {
'help:Usage information'
'plugin:Manage plugins'
'pr:Manage Oh My Zsh Pull Requests'
+ 'reload:Reload the current zsh session'
'theme:Manage themes'
'update:Update Oh My Zsh'
)
@@ -159,6 +160,7 @@ Available commands:
changelog Print the changelog
plugin <command> Manage plugins
pr <command> Manage Oh My Zsh Pull Requests
+ reload Reload the current zsh session
theme <command> Manage themes
update Update Oh My Zsh
@@ -598,6 +600,16 @@ function _omz::pr::test {
)
}
+function _omz::reload {
+ # Delete current completion cache
+ command rm -f $_comp_dumpfile $ZSH_COMPDUMP
+
+ # Old zsh versions don't have ZSH_ARGZERO
+ local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}"
+ # Check whether to run a login shell
+ [[ "$zsh" = -* || -o login ]] && exec -l "${zsh#-}" || exec "$zsh"
+}
+
function _omz::theme {
(( $# > 0 && $+functions[_omz::theme::$1] )) || {
cat >&2 <<EOF