Comments (4)
Are you sourcing it multiple times? or were using a distro-specific command-not-found handler before?
from zinsults.
I was using sheldon to install the plugin, and I switched to antidote which seemed to fix it (both use zsh-defer).
Interestingly, when I was using sheldon without using Nix to install my zsh config it was working fine.
(On macos btw)
from zinsults.
@danielyrovas can you try again with this patch?
diff --git a/zinsults.plugin.zsh b/zinsults.plugin.zsh
index ced50b1..6a8c6f3 100644
--- a/zinsults.plugin.zsh
+++ b/zinsults.plugin.zsh
@@ -21,8 +21,7 @@ fi
# in functions builtin for sticky shell emulation
# Details: http://ix.io/3ZMR/irc - 2022-06-09 - irc://libera.chat/#zsh
# Fixed in zsh-5.9-20-gd4955bc0f
-if ((${+functions[command_not_found_handler]}))
-then () {
+if () {
setopt localoptions extendedglob noksharrays
local -a match
local -i 10 major minor patch
@@ -36,14 +35,23 @@ then () {
version = ${match[1]}.${match[2]}
))
declare -r major minor patchrev version
- if (("$1"))
- then builtin functions -c "$2" "$3"
- else builtin declare -g "functions[$3]=$functions[$2]"
- fi
-} \
- 'version > 5.9 || version == 5.9 && (patch >= 20 || rev == 16#d4955bc)' \
+ (("$1"))
+ return
+} 'version > 5.9 || version == 5.9 && (patch >= 20 || rev == 16#d4955bc)'; then
+ function →zinsults/mv {
+ builtin functions -c "$1" "$2"
+ }
+else
+ function →zinsults/mv {
+ builtin declare -g "functions[$2]=$functions[$1]"
+ }
+fi
+
+if ((${+functions[command_not_found_handler]}))
+then
+ →zinsults/mv \
command_not_found_handler \
- __zinsult_try_find_command
+ →zinsults/cnf/old
fi
function command_not_found_handler {
@@ -59,15 +67,26 @@ function command_not_found_handler {
else msgs=( "${CMD_NOT_FOUND_MSGS[@]}" )
fi
- if ((${+functions[__zinsult_try_find_command]}))
- then __zinsult_try_find_command "$@"
- else builtin print -Pnf '%szsh:%s command not found: %s%s\n' '%B%F{red}' '%F{cyan}' "$1" '%f%b'
- fi
-
if (($#msgs>0));then
RANDOM=$(od -vAn -N4 -tu < /dev/urandom)
builtin print -Pnf '%szsh:%s %s%s\n' '%B%F{red}' '%F{cyan}' "$msgs[RANDOM % $#msgs + 1]" '%f%b'
unset msgs
fi
+
+ if ((${+functions[→zinsults/cnf]}))
+ then
+ →zinsults/mv →zinsults/cnf \
+ command_not_found_handler
+ command_not_found_handler "$@"
+ else
+ builtin print -Pnf \
+ '%szsh:%s command not found: %s%s\n' \
+ '%B%F{red}' '%F{cyan}' "$1" '%f%b'
+ fi
}
+
+((${+functions[→zinsults/cnf/old]})) || return
+[[ $functions[command_not_found_handler] == $functions[→zinsults/cnf/old] ]] \
+|| →zinsults/mv →zinsults/cnf/old →zinsults/cnf
+builtin unfunction →zinsults/cnf/old
# vim: ft=zsh ts=4 noet
from zinsults.
I switched back to sheldon, but the issue no longer occurs :( unsure what would've changed it lol.
Anyway, I applied your patch, and it also still worked.
from zinsults.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zinsults.