667fdbf7746acc90aa29b316ef711180e7917aa2
- Author
- ohmyzsh[bot] <54982679+ohmyzsh[bot]@users.noreply.github.com>
- Committer
- GitHub <noreply@github.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/.github/dependencies.yml b/.github/dependencies.yml
2index 4d5a8fa802b101091c2a6b3c634b85eb1f9465aa..6d138736ca27afa27ec65c798ad90d0a86293b0d 100644
3--- a/.github/dependencies.yml
4+++ b/.github/dependencies.yml
5@@ -10,7 +10,7 @@ dependencies:
6 plugins/z:
7 branch: master
8 repo: agkozak/zsh-z
9- version: 6bfe418332866d15373392164df11b4fbec2083f
10+ version: afaf2965b41fdc6ca66066e09382726aa0b6aa04
11 precopy: |
12 set -e
13 test -e README.md && mv -f README.md MANUAL.md
14diff --git a/plugins/z/MANUAL.md b/plugins/z/MANUAL.md
15index d367c3026b7a06b0681ac963ac0e7c63cc027155..67a207dbb5977d1765cfda2b421a63d6fe7c9cb6 100644
16--- a/plugins/z/MANUAL.md
17+++ b/plugins/z/MANUAL.md
18@@ -4,6 +4,8 @@
19 
20 [](https://github.com/agkozak/zsh-z/stargazers)
21
22+
23+
24diff --git a/plugins/z/img/demo.gif b/plugins/z/img/demo.gif
25new file mode 100644
26index 0000000000000000000000000000000000000000..247f52f4d2667211f897fdbe2fb10d7b696b3e0a
27Binary files /dev/null and b/plugins/z/img/demo.gif differ
28diff --git a/plugins/z/z.plugin.zsh b/plugins/z/z.plugin.zsh
29index 60a630624d027593206376f38cded3ff98fb7531..a41a4ae25143cbef08ecd32f117b09fa225f2522 100644
30--- a/plugins/z/z.plugin.zsh
31+++ b/plugins/z/z.plugin.zsh
32@@ -100,20 +100,30 @@ With no ARGUMENT, list the directory history in ascending rank.
33 }
34
35 # Load zsh/datetime module, if necessary
36-(( $+EPOCHSECONDS )) || zmodload zsh/datetime
37-
38-# Load zsh/files, if necessary
39-[[ ${builtins[zf_chown]} == 'defined' &&
40- ${builtins[zf_mv]} == 'defined' &&
41- ${builtins[zf_rm]} == 'defined' ]] ||
42- zmodload -F zsh/files b:zf_chown b:zf_mv b:zf_rm
43-
44-# Load zsh/system, if necessary
45-[[ ${modules[zsh/system]} == 'loaded' ]] || zmodload zsh/system &> /dev/null
46+(( ${+EPOCHSECONDS} )) || zmodload zsh/datetime
47
48 # Global associative array for internal use
49 typeset -gA ZSHZ
50
51+# Fallback utilities in case Zsh lacks zsh/files (as is the case with MobaXterm)
52+ZSHZ[CHOWN]='chown'
53+ZSHZ[MV]='mv'
54+ZSHZ[RM]='rm'
55+# Try to load zsh/files utilities
56+if [[ ${builtins[zf_chown]-} != 'defined' ||
57+ ${builtins[zf_mv]-} != 'defined' ||
58+ ${builtins[zf_rm]-} != 'defined' ]]; then
59+ zmodload -F zsh/files b:zf_chown b:zf_mv b:zf_rm &> /dev/null
60+fi
61+# Use zsh/files, if it is available
62+[[ ${builtins[zf_chown]-} == 'defined' ]] && ZSHZ[CHOWN]='zf_chown'
63+[[ ${builtins[zf_mv]-} == 'defined' ]] && ZSHZ[MV]='zf_mv'
64+[[ ${builtins[zf_rm]-} == 'defined' ]] && ZSHZ[RM]='zf_rm'
65+
66+
67+# Load zsh/system, if necessary
68+[[ ${modules[zsh/system]-} == 'loaded' ]] || zmodload zsh/system &> /dev/null
69+
70 # Make sure ZSHZ_EXCLUDE_DIRS has been declared so that other scripts can
71 # simply append to it
72 (( ${+ZSHZ_EXCLUDE_DIRS} )) || typeset -gUa ZSHZ_EXCLUDE_DIRS
73@@ -145,7 +155,7 @@ is-at-least 5.3.0 && ZSHZ[PRINTV]=1
74 zshz() {
75
76 # Don't use `emulate -L zsh' - it breaks PUSHD_IGNORE_DUPS
77- setopt LOCAL_OPTIONS NO_KSH_ARRAYS NO_SH_WORD_SPLIT EXTENDED_GLOB
78+ setopt LOCAL_OPTIONS NO_KSH_ARRAYS NO_SH_WORD_SPLIT EXTENDED_GLOB UNSET
79 (( ZSHZ_DEBUG )) && setopt LOCAL_OPTIONS WARN_CREATE_GLOBAL
80
81 local REPLY
82@@ -277,7 +287,7 @@ zshz() {
83
84 if (( ret != 0 )); then
85 # Avoid clobbering the datafile if the write to tempfile failed
86- zf_rm -f "$tempfile"
87+ ${ZSHZ[RM]} -f "$tempfile"
88 return $ret
89 fi
90
91@@ -285,16 +295,17 @@ zshz() {
92 owner=${ZSHZ_OWNER:-${_Z_OWNER}}
93
94 if (( ZSHZ[USE_FLOCK] )); then
95- zf_mv "$tempfile" "$datafile" 2> /dev/null || zf_rm -f "$tempfile"
96+ ${ZSHZ[MV]} "$tempfile" "$datafile" 2> /dev/null || ${ZSHZ[RM]} -f "$tempfile"
97
98 if [[ -n $owner ]]; then
99- zf_chown ${owner}:"$(id -ng ${owner})" "$datafile"
100+ ${ZSHZ[CHOWN]} ${owner}:"$(id -ng ${owner})" "$datafile"
101 fi
102 else
103 if [[ -n $owner ]]; then
104- zf_chown "${owner}":"$(id -ng "${owner}")" "$tempfile"
105+ ${ZSHZ[CHOWN]} "${owner}":"$(id -ng "${owner}")" "$tempfile"
106 fi
107- zf_mv -f "$tempfile" "$datafile" 2> /dev/null || zf_rm -f "$tempfile"
108+ ${ZSHZ[MV]} -f "$tempfile" "$datafile" 2> /dev/null ||
109+ ${ZSHZ[RM]} -f "$tempfile"
110 fi
111
112 # In order to make z -x work, we have to disable zsh-z's adding
113@@ -306,7 +317,7 @@ zshz() {
114 }
115
116 ############################################################
117- # Read the curent datafile contents, update them, "age" them
118+ # Read the current datafile contents, update them, "age" them
119 # when the total rank gets high enough, and print the new
120 # contents to STDOUT.
121 #
122@@ -884,6 +895,9 @@ alias ${ZSHZ_CMD:-${_Z_CMD:-z}}='zshz 2>&1'
123 # ZSHZ
124 ############################################################
125 _zshz_precmd() {
126+ # Protect against `setopt NO_UNSET'
127+ setopt LOCAL_OPTIONS UNSET
128+
129 # Do not add PWD to datafile when in HOME directory, or
130 # if `z -x' has just been run
131 [[ $PWD == "$HOME" ]] || (( ZSHZ[DIRECTORY_REMOVED] )) && return