Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

A tip: a technique to limit the # of global variables

when writing a plugin one often needs to keep a state during the Zsh
session. To do this it is natural to use global parameters. However,
when the number of the parameters grows one might want to limit it.

I've discovered a way to do this. Only a single global parameter per
plugin might be needed with it:

typeset -A PLGMAP
typeset -A some_map
typeset -a some_array

# Use

can be converted into:

typeset -A PLGMAP

# Use

i've did this in Zplugin reducing the # of global parameters by 21.
It's really unproblematic, I was using vim patterns with back
references to do the conversion without any back firing.

Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org

Messages sorted by: Reverse Date, Date, Thread, Author