vimspector icon indicating copy to clipboard operation
vimspector copied to clipboard

[Feature Request]: Allow arbitrary dir for per-project vimspector config.

Open TryerGit opened this issue 5 years ago • 8 comments

Hello,

At present, I have a project structure which looks like so:

--myproject\
    ----src\
        main.cpp (includes maininclude in include folder)
    ----include\
        maininclude.h (included in main in src folder)
    ----.vscode\ (all vscode .json files reside inside this folder)
        tasks.json
        launch.json
        Makefile
        Makefile-Debug
        Makefile-impl
        Makefile-variables
    ----.vim\ (all vim ide related files ideally should reside here)
        .ycm_extra_conf.py
        Makefile
        Makefile-Debug
        Makefile-impl
        Makefile-variables
    .vimspector.json

I would like to alternate between using VSCode to debug my project or else fire up VIM. Starting VSCode can be done by typing "code ." directly in the project folder itself and it accesses project and VSCode specific configuration files from within .vscode\ subfolder.

Is something similar possible in vimspector? That is, can vimspector refer to the .vimspector.json file from within the .vim\ folder so that the project folder myproject\ is clean of files? I would like to open this project by starting vim from the myproject\ folder. As of now, from the documentation I have read, it appears that .vimspector.json necessarily has to be placed in the myproject\ folder.

PS: I asked this also in SO.

TryerGit avatar Oct 09 '20 11:10 TryerGit

PS: I asked this also in SO.

I do not monitor stack overflow.

Is something similar possible in vimspector?

no, sorry and I'm not likely to change it. there are already many ways to configure this stuff and adding more is a bit painful to maintain and test.

FWIW, .ycm_extra_conf.py will not work in .vim folder either.

puremourning avatar Oct 09 '20 11:10 puremourning

Thanks for the quick response!

Hmm...so I think I will place the .vimspector.json file within .vim\ folder and start vim from within .vim\ folder. That way my project folder remains clean.

Regarding ycm, it works in my case placing it inside a .vim\ folder. When I fired up vim from within the project folder (so that src\ , include\ , .vim\ and .vimspector.json are at the same level), I had

let g:ycm_global_ycm_extra_conf = './.vim/.ycm_extra_conf.py' and this .py file had as contents

def Settings( **kwargs): return { 'flags': [ '-I./include' ], }

and ycm was able to "find" maininclude.h from within src/main.cpp

TryerGit avatar Oct 09 '20 11:10 TryerGit

let g:ycm_global_ycm_extra_conf = './.vim/.ycm_extra_conf.py' and this .py file had as contents

Oh boy. I don't think we intended for that to work, but I guess it does.

Perhaps vimspector could have a similar option? I dunno really. seems hacky.

If you were to make a proposal and send a PR to do this, add tests and documentation, I would probably still come down on the side of this is too niche a use-case to warrant the complexity :/

But if others would like this then they can vote on this issue by +1'ing it.

puremourning avatar Oct 09 '20 12:10 puremourning

Hmm...what I did was certainly not my own hacking. It seems to be well-supported by ycm itself.

Please see "Configuring through Vim options" section of https://github.com/ycm-core/YouCompleteMe

TryerGit avatar Oct 09 '20 12:10 TryerGit

Please see "Configuring through Vim options" section of https://github.com/ycm-core/YouCompleteMe

That's using a single global path, which is the intention of the g:ycm_global_extra_conf option. Trust me I'm the primary maintainer of YCM

puremourning avatar Oct 09 '20 12:10 puremourning

Fair enough puremourning :-)

TryerGit avatar Oct 09 '20 12:10 TryerGit

Apologies if this already exists, but I think a related feature would be the ability to provide an arbitrary directory for filetype specific configs outside of the vimspector installation directory. I think most of us don't version control our plugins, so I would have to duplicate this filetype specific config each time I install vimspector. If I could provide something like let g:vimspector_filetype_specific_config_dir='expand(~/.vim/.vimspector/filetypeconfigs)' I could version control these filetype directories and .json files separately from the plugin itself.

Lmk if this is already available, infeasible, or different enough to warrant another issue.

andwilley avatar Nov 29 '20 01:11 andwilley

Use g:vimspector_base_dir for that. My configs here for example https://github.com/puremourning/.vim-mac/tree/master/vimspector-conf

puremourning avatar Nov 29 '20 07:11 puremourning