📜 ⬆️ ⬇️

Vim and Visual Studio

For a long time, I used only one text editor - Vim. But here I came to a new job and the situation has changed. I was offered to work on a relatively large (> 300,000 lines) collective project. The project is written in Visual Studio, MS Source Safe is used as a version control system. I didn’t like to write VS at once, but since all the other conditions were more than satisfactory, I agreed.

For several days I worked in the “empty” VS and realized that this could not last long. After several years of regular use of Vim, the studio editor seemed too inconvenient. And I began to look for a way to continue working on the project and at the same time use my favorite editor.

A short search gave the following options for a partial solution to the problem.

Option 1: ViEmu


viemu.com
')
The first thing that occurred to me was to find a plugin that would change the interface of the studio's test editor to Vim-like. Such a plugin exists and is called ViEmu. Immediately, I note that it does not support all the possibilities of Vim.

ViEmu Pros

Cons ViEmu

In short, ViEmu implements the basic functionality of Vim, without interfering with the use of all VS functionality. But what is most important to me, ViEmu is not Vim . Having played with ViEmu for several days, I refused it. It annoyed me too much when I entered the Vim commands on the machine or clicked hot keys that ViEmu does not support and every time I wondered why nothing worked. Thus, ViEmu is not the best solution for a Vim user with a lot of experience. It should be well suited to people who want to learn how to use Vim, while not abandoning the usual development environment, as well as people who in daily work use only the basic Vim functionality.

Option 2: ViVim


code.google.com/p/vivim

ViVim is another VS plugin that uses a fundamentally different approach compared to ViEmu. It just lets you run GVim inside the Visual Studio window. After its installation, the “Vim Editor” item appears in the “Open with” dialog of the studio. You can also set Vim as your default editor. In my opinion, this is the most simple and correct solution to the problem, but its implementation is far from ideal. On my computer, ViVim has repeatedly crashed and even crashed VS. If ViVim is modified a bit, I will definitely use it. In the meantime, I decided to look for other options.

Pluses of ViVim

Cons ViVim

Thus, ViVim is based on the right idea, but it’s still raw.

Option 3: script visual_studio.vim


www.vim.org/scripts/script.php?script_id=864
If the previous two methods were implemented as additions to VS, then this is an addition to Vim. It works as follows: you need to start Visual Studio, open a project in it, then start Vim, execute a special command in it, the script will find the running studio and access it to compile the project.

Pros visual_studio.vim

Cons visual_studio.vim

It may be worth trying to use ViVim with visual_studio.vim.

Option 4: Compiler files


www.vim.org/scripts/script.php?script_id=524
www.vim.org/scripts/script.php?script_id=1437

The last option is the most radical. You can simply edit the files in Vim and run VS instead of make only to compile the project.

pros

Minuses


So, there are several ways to work with VS projects with Vim. None of them is perfect. For myself, I have not yet chosen which method to use. If you know other ways - please write in the comments.

UPD: With this post I did not want to show that Visual Studio is worse than Vim or vice versa. I just wanted to show how you can use the familiar interface where it was not originally provided.

Source: https://habr.com/ru/post/67151/


All Articles