Hi, On Fri, Jan 19, 2024 at 1:04 PM Timothy Madden <[email protected]> wrote:
> Many list options in Vim, like 'path' and 'tags', are difficult to parse > correctly from a string, because of the escapes that need to be applied > (for the comma ',' and backslash '' characters). Also for the generating a > :set command, there is a second level of escapes that needs to be > applied... While the complexity can still be dealt with if carefully > reading the help text, and experimenting for a while, the process remains > very much prone to errors. > > Maybe some new interface can be added to access such options as a list > value instead of a string, so no parsing or escaping will be needed for > vimscript authors. > > For example maybe v:tags (and v:path and similar ...) can be a list of tag > files, the same as given in the 'tags' option, but already parsed into a > list. > > Programatically modifying v:tags would also modify the 'tags' option as > well, while taking care of properly escape any special characters that > should be escaped. > > Otherwise the alternative for manually parsing the string value into the > list remains to: > > - manually split the string value on comma characters ',' that are not > preceeded by an odd number of backslashes... > - escape the remaining backslashes by replacing every '\' sequence > with '' > > Surely every vimscript author out there would like an easier way to deal > with this ... > > While on this topic, maybe it is possible for fnameescape() function to > implement a new flag for escaping a comma ',' character in the file name, > for use with :set path command for example. > > Maybe I can even make a patch for this if I get enough time to see how the > v: dictionary works in Vim source code, and the options themseves ... would > that help ? Though I fear the new bytecode engine could make this difficult > :( > Some time ago I proposed a patch for accessing the Vim options as a Dict: https://groups.google.com/g/vim_dev/c/sCINiwbbs3c/m/mR-jf5HfAgAJ With this approach, it is possible to export the option value string list as a List. Bram didn't see any advantages in this approach compared to the existing method of accessing options. Regards, Yegappan -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/CAAW7x7%3DnUV5-Rmk9VWtS2Uxr_z3yYUCEMstUS7hQ9a0_ezhoYg%40mail.gmail.com.
