Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option values with a : aren't handled propely #9

Open
jamessan opened this issue Dec 15, 2011 · 3 comments
Open

Option values with a : aren't handled propely #9

jamessan opened this issue Dec 15, 2011 · 3 comments

Comments

@jamessan
Copy link
Contributor

Currently, securemodelines parses : as a delimiter (either for the end of the modeline or for the end of an option) and doesn't handle a : being used as part of the option's value. Vim also handles the escaping of : in a modeline different than escaping in a normal set command. vim:set isk+=\:: and vim:set isk+=\\:: both do the same thing, when the former is what's documented to work and the latter is what one would expect when escaping something in a normal set command.

@ciaranm
Copy link
Owner

ciaranm commented Dec 15, 2011

This is one of those things where I'm inclined to say "we just shouldn't support it". I'd rather have the code be simple and obviously correct than able to support every oddity that Vim accepts. Is this really something useful enough that it's worth adding complexity?

@jamessan
Copy link
Contributor Author

For my particular usage, there's a workaround--vim: set isk+=58: but that's likely the only option where you can use some other value to represent the :. cinkeys, comments, errorformat, formatlistpat, formatexpr, include, includeexpr, indentexpr, indentkeys, iskeyword, and matchpairs seem to be most of the options which can be buffer-local, set in the modeline, and could likely have a : in them.

Most of those would likely be better served by an ftplugin, but in one-off cases like what I ran into it's easier to just add the modeline. Although, of those options, iskeyword seems to me like the one that would most often fall into this one-off situation, so I'd be fine with the support not being added.

@lucianposton
Copy link

# is another character in an option value that'll cause securemodelines to skip that item e.g. indentkeys-=0#.

fwiw, you can fix this locally by adding the characters to the character class near the end of this regex.

let l:matches = matchlist(a:item, '^\([a-z]\+\)\%([-+^]\?=[a-zA-Z0-9_\-,.]\+\)\?$')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants