Open unphased opened 8 years ago
Are you loading only C++ files? My hunch is that some rogue runtime file is mucking with the global value, and the session is only relevant because that triggers it at startup.
Well, I'm still confused, but I can verify that it happens with vim as well as nvim so that means something specific and potentially tractable is likely at the root of this.
I'm working on reproducing this with a more "minimal" Session.vim
file.
OK I found what I believe is the culprit. Whenever the session I'm restoring includes both C++ and JS files, this happens, because my ~/.vim/after/ftplugin/javascript.js
contains the line set iskeyword+=-
.
For whatever reason (maybe the cause are the argglobal
or some other such thing strewn about these Session.vim files), that appears to be getting run on the filetypes that it isn't intended for.
I have also tested that if I replace my after/ftplugin
tweaks to iskeyword using setlocal
that this solves the problem!
I don't know enough about setlocal
or ftplugin
or Vim and Vim best practices in general to say whether this is a problem with Vim's mksession stuff, this plugin, or whatever else. All I can tell is that iskeyword
is supposedly local to a buffer (that's what help says), therefore the use of setlocal
theoretically is redundant, but clearly is not in this scenario.
For now I will be changing all these type of tweaks to setlocal and I can happily resume using sessions again.
@unphased (Buffer-)Local options are only changed locally when using setlocal
; otherwise, they are set globally. It is generally good practice to prefer setlocal
(and *map <local>
, &c.) in ftplugin
files for this reason.
This can probably be closed.
My C++ files end up loading up (when restoring with
vim -S
ornvim -S
) withiskeyword
having gained a-
which causes problems for various reasons.What's confusing to me is that the Session.vim file has no mention of
iskeyword
inside of it. And usingverbose set iskeyword?
does NOT show me where it got set/changed.I also acknowledge that this is likely not an error with or caused by obsession... but hopefully someone has a clue for me.