#vim: going plug-in free

I once read an article titled Stop the Vim Configuration Madness , where the user advocates avoiding plugins. I have read a number of similar articles.

Since then, I have disabled syntax highlighting, backing-up of files, and a couple of other tweaks. Actually, the suggestion of turning off syntax highlighting turned out to be a good one. I have always felt discontent with highlighting schemes. There is always something wrong with them. Usually is is comments or strings that are bad.

Having disabled syntax highlighting for over a year now, I can honestly say that I I prefer non-highlighting.

The only plug-in I had installed is “emmet”, which does some html insertions. I have recently written a script that obviates the need for it.

I basically do two things when I am writing html: have a nice layout for header level two, and creating links in lists.

Here’s what I do now:

In .vimrc, add the line:

command H :r! hh

The H is just my mnemonic for “html”, which I can call up by tyong


What his does is call a script that I’ve written called “hh”, which does the donkey-work. Here’s the script:

#!/usr/bin/env bash

# helper for the H vim command
read cmd
case “$cmd” in
2) read title ; echo -e “<hr><h2>$title</h2>\n” ;;
lia) read link ; read desc ; echo -e “<li><a href=\”$link\”>$desc</a></li>” ;;

So, you call up H, and then enter a command. I chose “2” to represent a heading of level 2., and “lia” to create a link. “lia” is the most complicated one, so I’ll describe how it works:

  1. You type in “lia”, then return
  2. Type in the link, then return
  3. Type in a description, then return

The script then echos an appropriate <li> <a> combo. The “:r!” command in vi takes the output from the script and places it in the buffer. Fantastic.

No doubt the script will grow as I place more demands on it.

The reason that I want to get rid of all plugins is that I often work on different machines and experiment with different Linux setups. I am growing tired of having to install plugins. So now I am determined to go plugin-free.

I’d like to share one final great little mapping that I have:

map <F7> mzgg=G`z

This reformats the whole of the file with proper indentation for the file type.

I think that we should remind ourselves that vim is not emacs, and they have, or ought to have, different philosophies. Emacs is “maximal”, where you set things up your own way. Vim ought to be “minimal”, where you don’t do things your way, you do them the vim way.



About mcturra2000

Computer programmer living in Scotland.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s