I have been using Vim for about 2 years on my personal C++ project on Ubuntu with great success. I build using g++ and make, as my build system. In vim, I can build the project without problem using :make. My personal project has about 200 files.
In my job, the project I'm working on has 7 millions C++ files (over 35k files) and has been, from day one, a project build for Microsoft Windows, using Visual Studio. I have installed vim at my job, trying to use it to code. So far, I have not been able to "integrate" it successfully to my workflow for two main reasons:
Finding files is ridiculously slow: on my personal project, using
:findis instantaneous. I can use wildcard without problems, I get nice fuzzy file search right out of the box. For finding expressions, I can usegreporvimgrepand results come out fast. On my job's code base, finding a file or an expression can take from couple seconds to 30+ seconds. We have "a lot" of nested directories.I'm unable to make
:makework appropriately: I have tried usingmakeprganddenvenvandmsbuild(see here for example), with no success. Building a single file (asCtrl+F7does within Visual Studio) would suffice, but I can't seem to make it work.
If I could make work both 1. and 2., I would be satisfied. I could do about 90% of my editing/compiling from vim. Is there a way to achieve this?
Notes:
- I have used
VsVimfor some time. It is not so bad (in fact it's pretty great) but is not enough for me. Some options are missing (the vim help, for instance). - We work on Windows 10/11 and use Visual Studio 2022.
- For the 2. I have tried a lot of things. The last thing I tried is this:
The command works in the terminal (it builds the solution and I see the output). Fromau FileType cpp set makeprg=devenv\ MySolution.sln\ /build\ "Debug|x64" au FileType cpp set errorformat=\ %#%f(%l)\ :\ %#%t%[A-z]%#\ %mvim. When I type:makenothing seems to happen and I get the following output in the terminal:
Then vim "hangs" and if I go check the specifiedC:\WINDOWS\system32\cmd.exe /c (devenv MySolution.sln /build ^>C:\Users\johndoe\AppData\Local\Temp\VIe1D01.tmp 2^>^&1)tmpfile, I see the build output. In my personal project, I see the build output directly in Vim.
devenvand/ormsbuildwork for you outside of Vim? – romainl May 08 '23 at 06:55:setlocal path?for a file from which:findis slow; it wasn't designed to be used for fuzzy-finding, so if you have lots of files andpath=**/*, it can be slow. – D. Ben Knoble May 08 '23 at 14:47:makedoesn't work? Are you getting an error message? What happens if you exeucte it? – TornaxO7 May 08 '23 at 15:56make.bat) does it work better. The command line parsing when the command contains quotes is tricky? Did you make sure the shell from which you start vim has all the environment variables need to use msbuilt (vsvars32.bathas been called)? – Vivian De Smedt May 12 '23 at 12:27makeexcept say that the only time I used VS is for compiling neovim and I used cmake to generate the VS project then used:let &mp = "cmake --build build/debug"and it integrated with quickfix without issue. About the first requirement though, this is what I do. For stable codebases, you don't create new source/header files often. Mostly you need to search+open git-tracked files. What I do is have a text file populated with the output ofgit ls-files, which I can pull up with a keymap, then I/for the file I'm looking for, andgfon it. – 3N4N May 26 '23 at 22:04