vim-projectionist
vim-projectionist copied to clipboard
Global settings via projectionist_heuristics
I am wondering if and how global settings are supported.
The following seems to work, but it is unclear if that's the way to go:
let g:projectionist_heuristics = {
…
\ "*": {
\ "*.c": { "alternate": "{}.h" },
\ },
\ }
It would be nice to have this documented (in case it is supported). I can prepare a PR in that case.
That eliminates the ability to tell where the root of your project is so I don't recommend it. I think the solution in this case would be to install a.vim or whatever. Other than alternates I don't think any features make sense to enable globally?
(Arriving here years later via a Google search...)
@blueyed: I used the '*' trick for a long time and it worked for me for years. Then one day, I did some profiling with --startuptime and realized that ProjectionistDetect() was adding 80ms to my startup time (teh horror!). Turns out I have a lot of projections, and if I opened Vim in a directory like /a/b/c/d/e it was adding the projections for every level: /a/b/c/d/e, /a/b/c/d, /a/b/c, /a/b, /a, and even /. Basically a combinatorial explosion.
Whoops!
So I switched to defining real root markers (not *) and that got the startup cost down to around 16ms in a typical case (less when none of the markers match), which is quite reasonable given the number of projections I have. So I think the "real" solution here is to just be very disciplined and come up with real root markers even if you have to be creative about it in some cases. If you have a fast enough machine you might not care, but I like to make startup feel as "instant" as possible.
to solve for the "root" of the project, why not borrow ctrlp's solution to look for standard vcs metadata dirs?
I have always found that approach to be naive and limiting. Not all projects use vcs, and not all vcs repositories are projects. But if you're okay with that limitation, you can use a key like .git/|.hg/|... to match ctrp's root behavior.
what is .projections.json but yet another project metadata system? :)