vim-obsession
vim-obsession copied to clipboard
Suggestion: Capture at least some options
Hi Tim:
Don't capture options and maps. Options are sometimes mutilated and maps just interfere with updating plugins.
I agree about mappings, but I think It would be pretty useful to save path
and tags
, and even allow to pass them as options to :Obsession, that way every session could be more like an IDE project, but ala Vim. What do you think?
The initial reason for disabling options was because path
and tags
were getting truncated to 4096 characters. That's what I mean by "mangling."
Beyond that, I don't understand your use case. Are you setting 'path'
and 'tags'
interactively? Mine are just set from autocommands so they're always correct.
Usually I create a session by project, so I set path
to its root, and tags
to tag files only related to that project, and save the session. That way, I can open a "project" and :find
will look recursively only among its files, same thing for Ctrl+]
...
Do you use autocommands by file type or something similar?
I do, with a lot of help from plugins. In JVM projects I use classpath.vim, for example, while Ruby projects get handled by some combination of vim-ruby, rails.vim, and bundler.vim.
I do think using the project root is a good fallback for miscellaneous projects. And I have some ideas for how to achieve that automatically. But it'll probably be a few months before I have anything to show.
CtrlP (which is over kill for me) uses directories like .git or .svn to determine the project's root. I think that is a nice solution for options like path
or tags
. What do you think?
I think that's a pretty good heuristic, and probably not too hard to automate. One place this doesn't work so well is libraries installed by a package manager. CtrlP has burned me on Ruby Gems a lot.
The vim-session plugin has an option g:session_persist_globals
to define a list of globals that should get persisted (FWIW, it also executes sessionoptions-=options
unconditionally).
One other "set" of options to consider are those relevant to :compiler
(makeprg
and errorformat
). I recently noticed this was not being unsaved and it slows me down to have to remember to invoked compiler
when I restore the session.
I don't want to run compiler
in ftplugins/autocommands for various reasons, as I think it should be determined per-project, not per filetype, so I'd love to see Obsession support this use-case.
I also have the need to persist makeprg
.