VIM Revisited

summary:I got a notice in the mail yesterday that Drew Neil has a new book available, Practical VIM. The Pragmatic Bookshelf folks have great stuff, and I use Vim frequently.

I got a notice in the mail yesterday that Drew Neil has a new book available, Practical VIM. The Pragmatic Bookshelf folks have great stuff, and I use Vim frequently.

Why? Why do I insist on doing these things to myself?

Text editors are fun! And a text editor with the maturity of vi can’t be beat.

The first section talks about the dot command to quickly repeat the last action. Great stuff, and a command I do not take advantage of enough.

Right now I’m working through the Manage Multiple Files section. I’ve never had a clear understanding of the buffers and how they work. I also get stump working in splits.

It’s nice to get out of XCode and BBEdit for a while and do some fun Vim reading.

The :args {argument list} command makes a lot more sense now. Practically speaking, it’s an easy way to open files.

:args testfile1.md testfile2.md
<pre><code>:args testfile1.md testfile2.md



The above opens the two test files.

:ls
<pre><code>:ls



The :ls command lists the current buffers. That makes for some pretty easy switching.

And, to make it more interesting and confusing (read flexible), the argument list and buffer list don’t have to be the same. The buffer list is all the open buffers, but the args list can be changed at any time. It’s there to represent what was open on the command line when Vim was started, but it can be changed to include whatever grouping is needed.

On to splits!

C-w  s
<pre><code>C-w  s



and

C-w  v
<pre><code>C-w  v



create splits, and

C-w  w
<pre><code>C-w  w



moves between them.

Huh. That’s pretty easy.

Here’s another gem:

 :only
<pre><code> :only



Only keeps the active window open and closes the rest. Nice!

It’s things like this, that can be done on virtually any machine, that set Vim apart. Good stuff.

Get the book. It’s fun reading and a great addition to the existing Vim documentation.

Enjoy!

Return to blog