g:obsession_append
mg979 opened this issue · 6 comments
Hi,
I'm using this variable in a plugin I'm working on, I wonder if there can be side-effects in using it. Because if I set it to a value and another script does the same, only the last one would matter. Would it be possible to turn its content to a list, and then append all the contents of the list to the session? So I would retrieve the index of my append and replace it, instead of replacing the whole variable.
Thanks
Whoops, looks like I pushed a private experiment by accident. I guess it can stay. Lists are already supported but if this is to become an official API, dropping string support would make sense.
Well that's a good accident :). At this point, could it be turned into a dictionary (of lists)? It would be much easier for users to add/update stuff to the session.
Only if you can convince me that filter(g:obsession_append, 'v:val !~# "^let g:xtab_cwds"')
is completely inadequate.
Ok, I would have never thought about that (I'm new to vim and I avoid its regexes when I can). But from an usability perspective, a dict of lists would make sense, in my opinion. You set your key, then you always replace that. What if a plugin adds filenames and stuff for whatever reason, then the regex matches something bad?
Instead you set your key (like the name of the plugin), then obsession iterates all keys and lists inside them. It seems a bit safer to me. For now I'll use your suggestion though. Thanks :)
That regex is anchored to the start of the string so it's never going to match an embedded filename or anything like that. The interface has been public (if unofficial) for a while now so I don't want to change it without a really good reason.
Ok I'll follow your advice then. Thanks