Episode: 1091
Title: HPR1091: Useful Vim Plugins
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr1091/hpr1091.mp3
Transcribed: 2025-10-17 18:46:46

---

...
Hi, my name is Dave Morris and this is my first podcast for HPR. I want to talk to you
on the subject of Vim Plugins. I started using VI a fair time ago when I was giving
the job of administering a bunch of multi-user, unique systems. I found that VI was available
on most of these systems. If it wasn't, then the alternative was a thing called Ed, which
was appalling. Anyway, whatever happened, EMAX was quite hard to combine. It certainly
wasn't available on the machines out of the box. I'm not quite sure when I moved from
to VI to Vim and GVim. It might even be as long as 15 years ago. But since then, that's
been my editor of choice. I've tended to use GVim and have it configured up as an IDE.
It's not quite as smooth as purpose-built IDE, but it's not bad, as long as you know,
it's a strangeness. Now, for this talk, I'm assuming you know the basics of Vim. If you don't
know how to install plugins, then I've pointed you to a very useful article in the show notes.
The show notes are also a tell you where to get each of the plugins, and you'll notice that
some of them have not been updated for a while. But my choices of plugins tend to have
quite high ratings, so hopefully they'll be useful to you. There are a few images in the notes,
all of which are set up using GVim, for example. You need to have a good read of the help test
text for each plugin if you decide to use them. So the first one I want to talk about is called
Nerd Tree. I'm not quite sure where they came up with that name, but certainly a tree, and it's
used by this nerd anyway. It's a file browser which, when you invoke it, tends to sit on the left
hand side of your window. I'm assuming you know a bit about Vim Windows, whatever it splits the
main window and drops itself on the left hand side. You invoke it with a colon command. The
colon commands open up the command line at the bottom of the window. You would type Nerd Tree,
and it's quite important to get the capitalization right, and it's capital NERDT,
lowercase RWE, and then you follow that with the directory name. I prefer to use Nerd Tree with
GVim, because it tends to be a generally more usable. You can use the mouse to click on things,
and scroll it, and so on and so forth, which I'd just generally find more usable. There are lots
of key mappings within Nerd Tree. There are too many to talk about here, but just to give you a
flavor, if you put your cursor on a directory in the Nerd Tree itself, then pressing T will open a
new tab with that tree in it, so you can be editing multiple files out of the same directory in
different tabs. If you're not up to speed with Vim tabs, then I'll leave you to do a bit of
investigation on that. It's a very, very powerful feature. I definitely recommend you use it.
The other one I use quite a lot is putting the cursor on a directory pressing lowercase R
will cause the directory to be refreshed. Nerd Tree also offers bookmarks, which you can create
through various commands or key sequences, which I won't go into. There are lots and lots of
configuration options that you can put in the .vim RC file, and I've given you some examples in
the show notes, where I make sure that Nerd Tree is only invoked when I'm in jivim mode and not in
standard Vim mode. I'll probably mention for every plugin actually the other way that you get help,
but mostly it's pretty much the same. You would type call on H or help if you wish. H is the abbreviation
followed by the name of the plugin. I didn't know myself actually, but I just discovered that
pretty much all of these plugins don't care about the case of the name that you type after the H.
And that's largely because the authors have made sure that the relevant tags are in the
in the help files that will get you to where you want to be, regardless of what case you give.
The other note I thought you might be interested in is if you put your cursor in the
Nerd Tree window and press the question mark, then you get a quick help, which is a quick
abbreviation, a list of abbreviations for how to use the plugin. Okay, so the next one, it's called
Bash Support. This offers a lot of facilities that you'd expect to find in an IDE, and as you can
guess, it's specifically designed for working with Bash Scripts. It adds a menu to GVIM called Bash,
not surprisingly. Now you can look at the show notes to get an image of what it what it looks
like with the menu open. I use it particularly to start each script with a standard header,
so that all of my scripts look pretty much the same, contain the same sort of comments,
and that type of thing. You can also do things like maintain a library of code snippets so you can
paste into your code, so thereby saving you from hunting about all over the place for ways to do
things that you might have forgotten. It can do stuff like check the syntax of a script, run it,
debug it, and as usual there's a whole bunch of keyboard shortcuts. These in general begin with
the backslash, so a backslash CT, a lowercase, inserts the current date and time at the cursor,
which is great for putting timestamps in your comments or anything of that sort. And not too
surprisingly, help for this is invoked with call on h bash hyphen support, or indeed bash without
the hyphen support, bash support just as one word. So this particular writer has made sure that lots
of tags in the file will get you to where you want to be in the help text. From the same stable as
bash support is another plugin called pearl support. You probably gather that I'm a bash and pull
scripter, spend a fair bit of time writing these things. This one gives you equivalent facilities
for editing pearl scripts and it adds a pearl menu to gvim. I say that way because there are no
menus in standard vim. It's another bunches of gvim of course. And again I use it to form standard
headers and I've got boilerplate which will create me a sort of standard empty script that I can
then populate. Again you can manage code snippets with it and it will check syntax, run on and
debug a script. One of the functions I use quite a lot and it's called pearl tidy. This is actually
a standalone utility that you can use with when building a pearl script. It's abbreviation is
backslash. What pearl tidy does is to reformat your code and it does that according to
its own built-in style but you can change that. You can adjust it. So you can set up your own
personal or house style. If you're part of a group doing collaborative programming it's amazingly
important to have similar style otherwise you find it difficult to read somebody else's code.
The way you configure it is through a dot pearl tidy RC file and there's loads of documentation
about this. I personally prefer to use it through gvim because it's a bit of a hassle to use
standalone I find, if to remember more. The other one I use, the other part of pearl
sport that I use is pearl critic. This is invoked with backslash rpc. This is a thing that does a
compliance check with the pearl best practices book written by Damian Conway who's a big name in
the pearl community. There's an image in the show notes that shows a script being subjected to this.
There's a certain sort of schoolmarmish feel to the way that it criticises your code.
It's times when you throw it out the window but on the whole it does some really useful things.
You can turn up and down its level of criticism. Again it's more community used through an
editor than it is to use the standalone version and finally you can invoke help for pearl support
by typing colon h pearl support with or out without the hyphen. Next I want to mention
plug-in called man page view. Not too surprisingly this allows you to view man pages from within
the editor. You invoke it by typing colon man with capital M, M-A-N space and then the topic
or you can position your cursor on an editing window and press capital K and it will invoke the
viewer. If it can if the keyword has a man page entry is relevant to a man page. Once you've got
your man page up you can search it and scroll it about cut and paste from it which is always
very useful. There'll be good examples often in a man page that you might want to try out.
I certainly find this amazing useful saves hopping out of the editor and going to look at
something on another window perhaps. It's help as usual is invoked with colon h man page view.
The next plug-in view is called surround. It allows you to add delete or change so-called
surroundings. By this I mean things like pairs of quotes, pairs of braces, parentheses and so forth.
This one is driven entirely by key sequences. The examples that I've given you some examples in
the show notes because it's it really needs something that you can look at to to fully appreciate
but I'll just see whether I can speak about a couple of them. If your cursor is in an editing window
inside a string enclosed in quotes then if you type ds both lowercase quote and then
that's it yeah that's all you type. If you type that then it just deletes the quote ds quote
deletes the quote. If you're inside a string in brackets square brackets then if you type
cs square bracket close that's close square bracket close parenthesis then it will delete
the square brackets and replace with parentheses. So you can see it's actually quite a powerful thing.
Little little hard to get your head round but personally I think well worth the trouble.
Again as always you can get lots of help about how to use this with call on h surround.
Next comes fugitive. This is an interface to the git version control system that you can use
within the editor and I've put an example of what what the screen looks like if you type the
command call on capital G status that's the equivalent of the command line git status that
shows you the current state of a repository. It gives access to pretty much all of the git
commands through one means or another either with direct commands or with commands to which you
can add arguments. Again it's help is invoked through call on h fugitive. Tag list is my next example.
This is a plugin that lets you help it gives you help with browsing source code. It creates a menu
within jivim the menu is called tags and when you when you're you're editing a piece of source code
then you'll find that the tags menu is populated with the functions classes and other major
elements of your source code. You simply need to go to the menu and click on a tag to position the
editor at that particular point. So if you're trying to find a the declaration of a subroutine
whatever language you're dealing with then clicking on it will take you take you there.
Under the hood it uses a package called exuberant c tags which is the most fantastic name
and its job is to build a list of tags so it has syntactic knowledge of a whole bunch of languages
which uses to build a tag file and this is then used by the tag list. There are other tag features
within built into vim which I won't go into now but this I believe gives you a quite easy
route to to using this particular feature. Anyway there's an image in the show notes that
that gives you some idea of what you can do with it and now this there is not been telling you
about how to get the help is that there are a few instances that don't conform to the normal
normal way of of doing it and in this this is one particular case. In this case you need to type
call on hspacetaglist.txt that's because tag list is already a name within the standard vim
help file so that particular command invokes the thing specifically for this plugin and my last
plugin is called supertab. I think this is slightly controversial, probably because I'm not sure
I like it. This provides word completion via the tab key and there's an example of it doing this
in the show notes so you type at least one character of the word that you're hoping to type
you've forgotten how to spell it or something and you press tab and pop up menu comes up with the
various options that this could be the various words that could match this. The thing that I'm not
sure I like about this is that it hijacks the tab key and this means that if you want to enter
a real tab for a new reason then you need to use control tab to do it which I'm not sure I want
I would like to be able to switch this on and off as I need it and I haven't yet found a way
of doing it. There are other tab completion plugins available which I have not tested yet. I think
I'm going to do that and see if there's something better than this. This seems to be the most popular
one judging by the rating though. So that's my list of plugins. This was quite a quick review.
There's a lot to be said about each one. Each could have a podcast to itself I guess if anybody
would ever listen. The other thing to tell you is there's a whole world of plugins available on
www.vim.org. Very very large number which you can browse through. So I hope you found that useful.
You have been listening to Hacker Public Radio at Hacker Public Radio does our
We are a community podcast network that releases shows every weekday on day through Friday.
Today's show, like all our shows, was contributed by a HBR listener by yourself. If you ever
consider recording a podcast then visit our website to find out how easy it really is.
Hacker Public Radio was founded by the Digital Dark Pound and the Infonomicum Computer Club.
HBR is funded by the Binary Revolution at binref.com or binref projects across
the sponsor by Lina Pages. From shared hosting to custom private clouds, go to LinaPages.com
for all your hosting needs. Unless otherwise stasis, today's show is released under a creative
commons, a tribute show, share a lot, lead us our license.
