Nippysaurus
Nippysaurus

Reputation: 20378

Using Vi, Vim, or GVim as an IDE

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.

Upvotes: 51

Views: 51450

Answers (11)

xtofl
xtofl

Reputation: 41519

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.

Upvotes: 16

icc97
icc97

Reputation: 12863

Also these comments are quite dependent on the year that they were written. So these are my thoughts for Vim as an IDE in 2018.

The Language Server Protocol has been growing in importance and Sourcegraph have been popularising it through their master plan.

This is the major reason why ALE (Asynchronous Linting Engine) is so important because it implements the LSP. So it also offers Go-to-definition, code completion and hover information. I have only just started using it for linting and I haven't delved into the other features but I think it has massive promise to offer a lot of what is expected from an IDE.

But pretty much everything generic from Tim Pope + FZF + Ripgrep + ALE will get you a very powerful editor.

Frankly an 'Everything Tim Pope' editor is one of the best starting points you can have for a Vim IDE (I even created vim-tim just for that).

The only places I differ slightly from David Terei's excellent answer:

You should be careful in installing IDE plugins they can very easily impact Vim's performance.

Potential benefits over other IDEs

It's worth noting how flexible Vim allows you to be with setting up your code base. Where as many IDEs only work on the project level, you can create a parent folder across many Git repos, FZF and Ripgrep are so powerful that they'll consume huge code bases and hardly slow down when searching across them. With Ctags you can build up the index across repo boundaries. This is actually fills a couple of uncommon points in Sourcegraph's checklist for intelligent editors (I think Vim is able to fulfil all points that most current IDEs do beyond these):

  • Does your jump-to-def work across repository boundaries?

  • Can you search over all of your code and dependencies in one place?

Using Vim's buffers allows you to have 100s of buffers open with no cluttering of the UI or reduction in performance. Typing :b some-buffer-text and then Tab allows you to autocomplete buffer names easily. I also use the following line taken from another answer which allows listing all buffers and printing the buffer command to allow you to quickly switch to another via its number:

nnoremap <leader>bb :buffers<cr>:b<space>

Tim Pope has a novel recent database dadbod plugin, that gives you similar powers that you have in Microsoft's Database Management Studio.

Upvotes: 2

David Terei
David Terei

Reputation: 2035

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.

Upvotes: 53

tonkla
tonkla

Reputation: 329

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.

Upvotes: 6

Ian Kelling
Ian Kelling

Reputation: 10051

VIM has first-class support for C and C++ as an IDE. You even have a visual debugger with clewn and gdb. Other languages, you will have to do some tweaking and fiddling and the result might not get to what you want. Worth trying for an hour and seeing how it goes.

I get the impression that emacs does a better job as IDE for more languages.

Upvotes: 3

rektide
rektide

Reputation: 1584

I ran into gvide today while looking at O.T. Android NDK stuff— long time user of vim, have used eclim in eclipse, but frankly my vim environment is for writing code, not developing code. It was really interesting reading about different twists to make vim a development env, and gvide has some compelling stuff—

http://www.crystax.net/en/gvide

Upvotes: 0

Freeman
Freeman

Reputation:

try exVim in http://code.google.com/p/exvim This project make vim as a IDE for multi-language developing.

Upvotes: 2

daotoad
daotoad

Reputation: 27234

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.

Upvotes: 7

Jeremy Cantrell
Jeremy Cantrell

Reputation: 27424

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

Upvotes: 8

Jon
Jon

Reputation: 354

I use Vim alone - it has some basic ability to autocomplete via ^X then various options (^P for Keyword, ^O for omnicomplete (good for switching between HTML, CSS, and so on in web files).

It also has the ability to launch commands via :!(compiler or other commands).

Fairly simple, painless integration with basic development with no need for workspaces or similar - and modelines for file settings if desired.

Edit: As far as modules are concerned, there are usually modules to embed relevant scripting languages inside or beside the Vim enviroment - I don't know about similar .NET framework modules, however.

Upvotes: 1

Alan Haggai Alavi
Alan Haggai Alavi

Reputation: 74272

I sometimes use Vim as an IDE within Kate when I otherwise would have had several tabs open in Vim, which are hard to change to.

Else, I stick with plain ordinary Vim.

KDE for Windows will allow you to install Kate in Windows.

Upvotes: 1

Related Questions