Using Vi, Vim, or GVim as an IDE

47,920

Solution 1

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:

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:

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:

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.

Solution 2

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.

Solution 3

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.

Solution 4

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

Solution 5

If you use Linux, just try Pida. You can embed Vim or Emacs into it. A lot of integrations such as file browser, project structure, and console, make Vim look like Eclipse. IMHO, this is an easy way to use Vim as an IDE.

Share:
47,920

Related videos on Youtube

Nippysaurus
Author by

Nippysaurus

I'm a geek :)

Updated on June 20, 2020

Comments

  • Nippysaurus
    Nippysaurus almost 4 years

    I am forced to use VS2008 for the bulk of my projects at work, but whenever the odd text file needs editing I use Vim.

    Now I know that there are plugins and whatnot that can make VIM work like an IDE, so I am wondering if anyone actually uses it as an IDE?

    EDIT:

    For those of you who think you speak for the masses in saying that Vim should not be used as an IDE, please consider that IDE features are the number one feature request on the official feature request list on vim.org.

    • skaffman
      skaffman almost 15 years
      I use VIM as an IDE in between sticking rusty forks in my leg
    • M.Sworna Vidhya
      M.Sworna Vidhya almost 15 years
      won't somebody please remove those cutleries from skaffman's knees
    • puk
      puk about 12 years
      It boggles my mind that vim is lacking some very basic functions, like correctly indenting my wrapped lines. Until they fix that, I doubt they will be giving you any IDEs.
    • Greg Nisbet
      Greg Nisbet over 6 years
      @puk : try set showbreak=.... or some variation thereof
    • puk
      puk over 6 years
      @GregoryNisbet I believe VIM has updated it such that word wrapping adheres to line indenting
  • Andy White
    Andy White almost 15 years
    +1 ViEmu is the best vi plugin for Visual Studio that I've seen
  • Nippysaurus
    Nippysaurus almost 15 years
    There is also a VS plugin that comes with GVIM, but it launches the editor in its own windows and doesn't actually integrate with the VS editor like viemu does.
  • xtofl
    xtofl almost 15 years
    Viemu is just a little less vi-like than GVIM; when I need do large edits, I launch GVIM with an "external command".
  • Nippysaurus
    Nippysaurus almost 15 years
    Microsoft Windows is not an image editor but it provides interfaces which allow you to write image editing applications. Much the same way that VIM (or VI) provide scripting interfaces which allow you to change the way the application behaves. I know what you mean though ... its not scriptable to the extent that it could make a viable IDE alternative, and thats ok :) I mean as long as it can group files into a project type structure I guess it could be called an IDE :)
  • Dykam
    Dykam almost 15 years
    Note MonoDevelop includes a quite full fledged Vi mode. And it is starting to run on Windows.
  • Nippysaurus
    Nippysaurus about 14 years
    ViVim looks very interesting :)
  • Elazar Leibovich
    Elazar Leibovich almost 14 years
    taglist+project management+debugger, are the IDE of the old days. Eclipse simply is a bundled Java implementation of ctags+vim+plugins. I really don't see the difference.
  • UnixShadow
    UnixShadow almost 12 years
    ExVim is actually very good, it is a compilation of different vim plugins.
  • nuala
    nuala almost 10 years
    "the code in the google svn repos is outdated " and it seems the website is so as well. Wikipedia notes latest stable release from 2010 :(
  • icc97
    icc97 over 5 years
    I would say one of the plus points of Vim is that you can use it exactly as you want it, if you want to keep it as a strict light weight editor and nothing else you can do that. However if you want some of the extra features of an IDE you can install many of those. Although I agree there are some plugins that try to do too much to copy all the features of an IDE, there are some great tools such as fzf and ripgrep that add very powerful code searching features. NERDTree is actually one of the plugins I think does too much - you can use vim-vinegar + fzf which are more lightweight.
  • icc97
    icc97 over 5 years
    You recommend Syntastic over Code Check, but you also recommended Ale, which is preferable over Syntastic and I don't think you want to mix the two. Ale is both async and is also implements the Language Server Protocol which is becoming more important. Recently Sourcegraph have been talking about it and I recently came across ReasonML which leverages the LSP.
  • icc97
    icc97 about 5 years
    @nuala it gets worse, the apt install pida that used to work doesn't any more, The application site is dead too
  • dedObed
    dedObed about 5 years
    These days, Ale may be yet a better choice over Syntastic.