Skip to content

Commit

Permalink
Avoid triggering WARN_CREATE_GLOBAL
Browse files Browse the repository at this point in the history
  • Loading branch information
marlonrichert committed Aug 11, 2023
1 parent 6d059a3 commit 620ffca
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Completions/_autocomplete__is_glob
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ zmodload -F zsh/parameter p:patchars
local word=$PREFIX$SUFFIX
if [[ $word == ${~${(q)word}} &&
$word == (*(${(~j:|:)patchars[@]:#\~}})*|?*(${(~j:|:)patchars})*) ]]; then
reply=( yes )
typeset -ga reply=( yes )
true
else
reply=( no )
typeset -ga reply=( no )
false
fi
14 changes: 7 additions & 7 deletions Functions/Init/.autocomplete:config
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ typeset -g ZLE_SPACE_SUFFIX_CHARS='|&<>-+'
builtin zstyle ':completion:*' use-cache yes
builtin zstyle -e ':completion:*' cache-path autocomplete:config:cache-path
autocomplete:config:cache-path() {
reply=( "${XDG_CACHE_HOME:-$HOME/.cache}/zsh/compcache" )
typeset -ga reply=( "${XDG_CACHE_HOME:-$HOME/.cache}/zsh/compcache" )
}

builtin zstyle ':completion:*' completer _expand _complete _prefix _ignored _correct _approximate
Expand All @@ -21,19 +21,19 @@ builtin zstyle -e ':completion:*:expand:*' substitute autocomplete:config:substi
autocomplete:config:substitute:expand() {
local -P __word__=$PREFIX$SUFFIX
if [[ ${(Q)__word__} == *(\`*\`|\$\(*\))* ]]; then
reply=( false )
typeset -ga reply=( false )
else
reply=( true )
typeset -ga reply=( true )
fi
}


builtin zstyle -e ':completion:*:-command-:*' tag-order autocomplete:config:tag-order:command
autocomplete:config:tag-order:command() {
if [[ $PREFIX == (|.|*/*) ]]; then
reply=( 'suffix-aliases (|*-)directories executables (|*-)files' - )
typeset -ga reply=( 'suffix-aliases (|*-)directories executables (|*-)files' - )
else
reply=( aliases suffix-aliases functions 'reserved-words builtins' )
typeset -ga reply=( aliases suffix-aliases functions 'reserved-words builtins' )
if [[ -n $path[(r).] ]]; then
reply+=( '(|*-)directories executables (|*-)files' commands )
else
Expand Down Expand Up @@ -91,7 +91,7 @@ builtin zstyle ':completion:*' file-patterns '*(-/):directories
builtin zstyle -e ':completion:*:-command-:*' file-patterns autocomplete:config:file-patterns:command
autocomplete:config:file-patterns:command() {
[[ $PREFIX$SUFFIX != */* ]] &&
reply=( '*(-/):directories:directory ./*(-*^/):executables:"executable file"' )
typeset -ga reply=( '*(-/):directories:directory ./*(-*^/):executables:"executable file"' )
}
builtin zstyle ':completion:*:(.|source):*' file-patterns \
'%p(#q-/):directories:directory %p~*.zwc(-.^*):globbed-files' '%p~*.zwc(-^/):globbed-files'
Expand All @@ -103,7 +103,7 @@ builtin zstyle ':completion:*:descriptions' format $'%{\e[0;1;2m%}%d%{\e[0m%}'
builtin zstyle -e ':completion:*:warnings' format autocomplete:config:format:warnings
autocomplete:config:format:warnings() {
[[ $CURRENT == 1 && -z $PREFIX$SUFFIX ]] ||
reply=( $'%{\e[0;2m%}'"no matching %d completions"$'%{\e[0m%}' )
typeset -ga reply=( $'%{\e[0;2m%}'"no matching %d completions"$'%{\e[0m%}' )
}
builtin zstyle ':completion:*:messages' format '%F{9}%d%f'
builtin zstyle ':completion:*:history-lines' format ''
Expand Down
2 changes: 1 addition & 1 deletion Functions/Init/.autocomplete:recent-dirs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ zmodload -F zsh/parameter p:commands p:dirstack p:functions
add-zsh-hook chpwd +autocomplete:recent-directories:save

+autocomplete:recent-directories() {
reply=( ${^dirstack[@]:#$PWD(|/[^/]#)}(N) )
typeset -ga reply=( ${^dirstack[@]:#$PWD(|/[^/]#)}(N) )

local -P ancestor=$PWD:h
while [[ $ancestor != / ]]; do
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ recent directories from any source that you like. To do so, define a function
like this:
```zsh
+autocomplete:recent-directories() {
reply=( [code that generates an array of absolute paths] )
typeset -ga reply=( [code that generates an array of absolute paths] )
}
```

Expand All @@ -226,7 +226,7 @@ Out of the box, Autocomplete doesn't track or offer recent files. However, it
will do so if you add a backend for it:
```zsh
+autocomplete:recent-files() {
reply=( [code that generates an array of absolute paths] )
typeset -ga reply=( [code that generates an array of absolute paths] )
}
```
Expand Down

0 comments on commit 620ffca

Please sign in to comment.