1 # Copy this file into /usr/share/zsh/site-functions/
2 # and add 'autoload n-functions` to .zshrc
4 # This function allows to choose a function for edition with vared
12 zmodload zsh/parameter
17 unset NLIST_COLORING_PATTERN
19 [ -f ~/.config/znt/n-list.conf ] && builtin source ~/.config/znt/n-list.conf
20 [ -f ~/.config/znt/n-functions.conf ] && builtin source ~/.config/znt/n-functions.conf
25 NLIST_REMEMBER_STATE=0
27 list=( "${(@k)functions}" )
28 list=( "${(@M)list:#(#i)*$1*}" )
30 local NLIST_GREP_STRING="$1"
32 if [ "$#list" -eq 0 ]; then
33 echo "No matching functions"
37 list=( "${(@i)list}" )
40 if [ "$REPLY" -gt 0 ]; then
41 selected="$reply[REPLY]"
42 if [ "$feditor" = "zed" ]; then
43 echo "Editing \`$selected' (ESC ZZ or Ctrl-x-w to finish):"
45 print -rs "zed -f -- \"$selected\""
48 echo "Editing \`$selected':"
49 print -rs "vared functions\\[$selected\\]"
50 vared functions\[$selected\]
54 # vim: set filetype=zsh: