My list of must-have vim scripts

by Sander Marechal

I love (g)vim! I've been using a lot of different text and code editors over the years. When I started with Linux my first editor was Anjuta. After that I've tried BlueFish, Screem, SciTe, (X)Emacs, Gedit and many more until I stuck with Kate. But in the end, every Linux programmer eventually drops whatever editor or IDE that he or she uses and switch to either Vim or Emacs. I switched to Vim.

Vim is great all by itself, but there are a ton of scripts that you can use to expand vim make your life easier. Here are the vim scripts and settings that I use every day.

Bufkill

This handy little vim script allows you to unload, delete and wipe buffers but keep their windows open. My main use for this is so that I can close the last buffer without vim destroying the last window and exiting.

Netrw

I spend a lot of time programming PHP on other remote servers. Netrw, written bu Charles Campbell, allows me to transparently read and write over ftp, ssh, webdav and other protocols. On top of that it provides a great file explorer. This is script that I use most often in vim. I have set the g:netrw_liststyle variable to give me a tree view by default.

Decho

If you ever write your own vim scripts then you will love Decho. It’s a debugger for your vim scripts that puts debug information in a separate tab. You can also use it to implement function tracking in your scripts.

Loremipsum

When I am designing a new website I always use Lorem Ipsum as placeholder text in my templates. This little script makes it a breeze to quickly insert paragraphs or Lorem Ipsum.

Gvim with the desert256 color scheme
Gvim with the desert256 color scheme

Gvim with the Wombat color scheme
Gvim with the Wombat color scheme

VCSCommand

I store most of my code in my Subversion repository. With VCSCommand I can use Subversion from inside vim. No need to switch back-and-forth between vim and the terminal. It also integrates well with CVS, SVK and Git, if those are your cup of tea.

YankRing

By default, vim remembers multiple buffers of text that you have deleted but it does not do the same for multiple pieces of text that you yanked. Of course, you can use named buffers but this script makes it all a tad easier. It remembers all the text that you yanked and deleted and allows you to retrieve them all. It also offers an explorer to all the stored text.

PHP-Doc

This script can parse your PHP code and automatically generate PhpDocumentor docblocks for your functions and classes. This makes it very easy to write documented code from the beginning.

Desert256

This is the color scheme that I use when I run vim in a terminal. It's very friendly on the eyes and it's almost as nice as the wombat color scheme that I use in the GUI. Almost. Click on the top right thumbnail for a screenshot of gvim using desert256.

Wombat

The best looking color scheme I have ever used in any editor bar none. This is what I use when I run gvim. Click on the bottom right thumbnail for a screenshot of gvim using Wombat.

Taglist

Taglist uses exuberant ctags to parse your source code and give you a nice, structured source code browser. It works great, but unfortunately it does not allow sorting by scope (yet). Only sorting by source order and alphabet with functions, methods, classes and attributes grouped together. I have mapped my F8 key to open a window with the taglist browser.

Other options

Finally there are a few other options I set in my .vimrc file. I improve the Python highlighting by enabling python_highlight_numbers, python_highlight_builtins and python_highlight_exceptions. I do the same for PHP by disabling the highlighting of SQL keywords in strings (I find it annoying) and enabling PHP_vintage_case_default_indent because I prefer the extra indent on switch() statements.

All-in-all, that’s my vim set-up. What’s yours?

Digg this article: This article on Digg


Creative Commons Attribution-ShareAlike

Comments

#1 quelcom

Nice configuration. Which font are you using in there? Thanks!

#2 Sander Marechal (http://www.jejik.com)

That's "Bitstream Vera Sans Mono" at 10pt. It's included in nearly all Linux distributions. "Deja Vu Sans Mono" is pretty much identical (Deja Vu is a fork of Bitstream Vera that includes more unicode characters).

#3 quelcom

Thanks for sharing! ;)

#4 Anonymous Coward

in .vimrc add:
set abbr lorumipsum Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Post a new comment

Registration is not required to post comments, but cookies must be enabled. One of the advantages of registration is that you can edit your comments later on (editing not yet implemented). You can register or login here.




Your e-mail address will not be published, but your website URL will. All links that you post will tagged rel="nofollow" to throw off spammers. You are allowed to use the following XHTML tags in your comment: <em> <strong> <u> <b> <i> <strike> <blockquote> <big> <small> <ul> <ol> <li> <a href=""> <pre> <code> <tt> <br>. Please allow up to 60 second processing time after you post a comment. Our spam filters may take some time.