Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Vi, Vim, or GVim as an IDE

Tags:

vim

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.

like image 934
Nippysaurus Avatar asked Jun 23 '09 07:06

Nippysaurus


1 Answers

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.

like image 57
David Terei Avatar answered Sep 27 '22 16:09

David Terei