Who said that VIM cannot compete with IDEs?
Tags: vim, ide, c, texteditor
Published: 2017-12-29 22:35:49

---
title: Who said that VIM cannot compete with IDEs?
published: true
description: Preparing vim for IDE like experience
tags: vim, ide, c++,text editor
---
![main](https://bezirganyan.github.io/img/2017/12/vim_main.jpg)

Every developer has a favorite text editor or an IDE, and as long as developers exist, Text Editor wars are not going anywhere. The two main forces of the so called "Editor War" are Vim and Emacs. They are both great and can do a lot, but... but they are not an IDE.

I've heard many developers, who are in love with vim or Emacs, but use IDEs like clion, CodeBlocks, VisualStudio, etc., because of certain features.

But wait! What if I tell you that you can turn your vim or Emacs into an IDE? Yes, it will work, and in majority of cases it will work better and faster than your traditional IDE, at least for C/C++ it does.

## Configuring vim to become an IDE

Well, the main basic features of an IDE are

* Code completion
* Error detection
* Debugging

Of course there are many more features that IDEs have, and it is possible to configure vim to do most of them, but in this post I will only speak about these main three.

So let's look at each feature and try to make it work in vim

_Note:_ The configuration is for C/C++, but with light modifications and right plugins it is possible to make them work for your desired language.

### Code completion

Vim already has a built in code completion and all you have to do is type the starting letters and press `crtl + n`, and it will bring suggestions from your code. But that's not enough. All IDEs have smarter code completion, which will bring suggestions not only from the code you've already written, but from the libraries you use.

You can achieve such feature with a vim plugin called [__YouCompleteMe__](https://valloric.github.io/YouCompleteMe/).

All you have to do is install the plugin and configure for your desired language and libraries.

![Vim code completion](https://bezirganyan.github.io/img/2017/12/vim_code_completion.png)

### Error Detection

One of the things I like in Vim is when you use `make` command from it, in case of errors it brings the cursor on the line, where the first compile error occurred. However, the IDEs do a lot more than that. They detect the errors, right after you type
them.

For vim, the same functionality provides the [__YouCompleteMe__](https://valloric.github.io/YouCompleteMe/) plugin, which we've already discussed above. After typing, when you press the `Esc` key, in case of compile errors, it will highlight the code parts causing the errors.

![Vim error](https://bezirganyan.github.io/img/2017/12/vim_error.png)

### Debugging

When I was just starting to use Vim, for debugging my programs I had to open another terminal, run `gdb`, type `ref` and try to use not so user friendly interface, without syntax highlighting. When writing command I couldn't even use my arrow keys. Well, that sucked.

Then I discovered the [__Conque-GDB__](https://github.com/vim-scripts/Conque-GDB)

Conque-GDB is a vim script that integrated GDB into your vim. Cool right? What's more cool, is that it shows the breakpoints or segmentation fault location right on your code in vim. You can even use your arrow keys moving your cursor!

I will be honest, I hated GDB even after using this plugin, until, one day, during a Programming Olympiad I had to use Visual Studio's debugger. Well I couldn't even find where my program threw a SegFault. So what I did (I don't even know if I had the right to do so) was to boot Linux from my USB and use Conque-GDB.

![Vim gdb](https://bezirganyan.github.io/img/2017/12/vim_gdb.png)

### Other plugins?

There is a very awesome website full of various vim plugins, called [__vimawesome.com__](vimawesome.com). You can find many many more plugins there and make your vim much closer to an actual IDE.

You can comment about your vim configuration below. By the way this is my first blog post, so I am waiting for your positive criticism in the comment section.

[_source_](https://bezirganyan.github.io/blog/vim_ide/)