VIM: is there an easy way to manage Visual Studio solutions / makefile projects from Vim? [closed]

↘锁芯ラ 提交于 2019-12-20 09:38:10

问题


I tried using Visual Studio instead of VIM(+plugins), but to be honest - the only advantage of VS over VIM is it's ability to automatically manage my project.

I know of existence of ViEmu for VS, but I would like to do the opposite - is there any way to manage projects from within VIM?

I tried both c.vim plugin and Project plugins, but:

  • I have a problem while using c.vim on windows (from what I remember, there is an error with "slashes" in filepath ).
  • Project allows to organize projects, but it lacks features for generating makefiles / msbuild files (or am I wrong?).

Are there any tips / solutions / hacks, which would allow me to use VIM to manage my projects? (ideally, using both makefiles and MSBuild files, but just one type of build files would be enough.)


回答1:


Maybe I don't understand the question.

VS is full features IDE - you edit, compile and debug without leaving it.

vim in contrast is not IDE - its very powerful text editor. Yet vim has some build-in functionality oriented for programmers (e.g. :make command, compilation, automatic indentation etc.). vim is coming from Unix world where there several build tools (make, scons, cmake etc.). As you know you can "integrete" them using plugins which mostly very far from to be complete.

I think what you tried to do in the beginning is the right thing - bring vim editing power to VS world.




回答2:


To integrate vim with devenv, you can use devenv from Visual Studio to complie the project in vim. The command as follows:

Devenv SolutionName /build SolnConfigName [/project ProjName [/projectconfig ProjConfigName]]

Typicatlly, the devenv should located in C:\Program Files\Microsoft Visual Studio 8\Common7\IDE. Set it to the path of environment to make it callable from vim. We also need to make vim recognize the error messages thrown by the commandline build tool devenv. Just put the following lines in your vimrc:

" Quickfix mode: command line devenv error format
au FileType cpp set makeprg=devenv.com\ /Build\ Debug\ *[SolutionName]*
au FileType cpp set errorformat=\ %#%f(%l)\ :\ %#%t%[A-z]%#\ %m

Then You can use :make to compile and build the program from vim.




回答3:


My immediate thought was of the Eclim project which brings Eclipse functionality to Vim. Then you maybe able to manage your VS projects from Eclipse, I don't know any projects to do this, but I suspect some exist.




回答4:


Have you looked at other build tools (nant is the most popular for .net)?

Nant is far simpler than msbuild, you can create a simple build file in a few lines and easily integrate with vims makeprg.




回答5:


You don't have to maintain visual studio project files to manage your source code. There is a lot of pre generation tools to use to generate your visual studio project files. Such as CMake, Premake and more. This way you won't be driven crazy by the complicated VC projects settings, and it also bring the positibility to be cross-platform.

So in vim, you can split your project by physical folder, then use Cmake script to define the rule to generate projects.

When there is file added/removed, you re-generate your VC project, then call Cmake which will invoke msbuild to compile your projects.

You can use vim plugin YouCompleteMe for intelligence on compiler level.

You can write simple vim script to launch your compiled executable.

What else are you expecting for? :)



来源:https://stackoverflow.com/questions/1119585/vim-is-there-an-easy-way-to-manage-visual-studio-solutions-makefile-projects

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!