Using Vi, Vim, or GVim as an IDE

Vim is an amazing piece of software, but pretty messy too due to it's age. Vi was released in 1976 and Vim was released in 1991. For example, Vim offers quite a few different ways to do text-completion, from simple keyword to its "omni" completion system. On top of that, some plugins choose to work with the inbuilt functionality, while others just replace it wholesale. Hopefully the following suggestions get you started though.

IDE with Vim

You may want to try this new patch for Vim which allows Vim to be used inside Visual Studio as the editor:

  • ViVim

Vundle

Firstly, install the Vundle plugin manager plugin for Vim! It works very well and makes managing Vim plugins easy. Handles installation, updates and removal.

For example, your .vimrc now just contains:

" === Plugins! ===
Plugin 'junegunn/fzf'
Plugin 'scrooloose/nerdtree'
Plugin 'w0rp/ale'
...

And a PluginUpdate command will install them or update them.

Plugins for a Vim-IDE

The following vim scripts give Vim more of an IDE feel. Keep in mind that Vim has a huge number of features built in, so take time to learn those (which is an ongoing journey) before loading up 20 plugins.

Highest impact plugins for me are fzf and ALE. You'll want to install fzf and ripgrep.

Navigation:

  • FZF - Favorite plugin, awesome filesystem navigation and text-search
  • Nerd Tree - Filesystem navigation
  • Command-T - Search a project by filename to open, would recommend FZF instead
  • CtrlP - An alternative to Command-T, fuzzy file and buffer searching. Generally slower, but doesn't require compilation
  • Tag Bar - Code navigation by functions
  • Bookmarking - Bookmarks for vim (my own plugin :))

Text Completion:

  • delimitMate - Automatic closing of parentheses, braces.. etc
  • tcomment - Easy comment/uncomment source code commands
  • Ultisnips - Great Vim snippets system
  • YouCompleteMe - Code completion, lots of features
  • neocomplete - Slightly simpler code completion than YCM

I personally find code-completion too much and just rely on Vim's builtin CTRL-N text-completion feature, up to you, but remember CTRL-N! Vim's built-in completion system extends beyond that, with different completion modes such as filename completion with CTRL-X CTRL-F or "omni-completion", which tries to offer file-type specific context dependent completion through CTRL-X CTRL-O. Omni-completion requires file-type specific plugins, the vim-go package for Golang supports it.

Formatting:

  • tabular - Align text easily
  • vim-surround - Quickly surround some text (i.e., brackets, tags...)

Just awesome:

  • ALE - Live syntax checking for many languages, supports Vim 8's new features such as asynchronous jobs to ensure it doesn't freeze up Vim while running.
  • fugitive - Git within vim, diffs, blame... etc
  • gitgutter - Live diff from git committed version of file
  • YankRing - Easy access to previously copied or deleted text objects

Better GUI:

  • Airline - Easier to read status line with more useful information
  • Gundo - Visualize vim undo history as a tree (my favorite, make sure you turn on persistent undo in Vim)

Color schemes:

  • solarized - Great color scheme

Vim Distributions

Rather than go through the setup and configuration yourself, you can use the following projects to get going quickly with a more IDE like Vim. The two projects below include many of the plugins I mention above:

  • Janus
  • spf13

I recommend you don't use them though. You'll learn much more if you take the time to configure vim yourself and install plugins in a staggered process to learn each one well.

Vim Plugin Guides

VimAwesome can be a good place to browse for Vim plugins and find useful and popular ones.

Vim Patches

In addition to those scripts you may want to look at some of the following patches for Vim. I haven't used them so not sure of the quality but most of them look quite promising. You can view all the patches here, the ones that make vim more of an IDE are:

  • Code Check - On-the-fly code checking (note: Syntastic is a better choice these days).
  • Clewn - Allows debugging and stepping through the code in Vim using GDB.

With those scripts and patches installed, you should have something in Vim pretty close in features to Visual Studio or Eclipse.


I'm not trying to be inflammatory with this response, but I want to save you some headache. This is the same answer I give to all the people that ask similar questions in #vim.

Vim is not an IDE. It's an editor. It was never intended to be an IDE, and any attempts to make it conform to this will only cause you problems. There are some plugins that try to provide an IDE-like feel to Vim, but these are horrible.

I do, on the other hand, recommend some plugins that will help you get some extended functionality from Vim. These might suit your needs.

  • taglist - Great for navigating your code by function/method/class
  • NERDTree - A wonderful filesystem navigation plugin

Taglist is a wonderful plugin--don't leave home without it.

You can also set up tab completion.

Omnicompletion is a great thing if your language is supported.

And VIM tip 1439 has a roundup of IDE-ification tips.


You can also go the other way around and use a plugin called viemu. This one gives you vi-mode within the VS IDE, which makes it easier for colleagues to co-drive on your system.

Tags:

Vim

Ide