Writing with Vim

PUBLISHED ON 2016-09-09

Recently I have gotten back into writing lots of material, from short stories to poems, and came to realize just how effortless and distraction free Vim can be as a writing tool.

Not My Story

Too shy to share my own work (yet?) despite having just finished a story before writing this article, I downloaded a short story by someone else for it. You get The Hanging Stranger by Philip K. Dick in the screenshot. :)

Why Vim?

Vim is ingrained into my muscle memory. However, lots of people tend to shy away from it for creative writing. I think it has all the hipster qualities of a distraction free editor and all the Vim qualities of being a great editor.

So many splits, why?

They actually function as one large document. If you look at the line numbers carefully in the screenshot, you will notice that each column starts where the prior one left off. This takes advantage of Vim’s scroll-binding but I don’t set it up manually, I just do :MPage 5 and the MPage plugin does the hard work.

Multiple search highlights?

I use a plugin called MultipleSearch that allows highlighting of multiple words. This is great for me as once I use a word sometimes I beat it to death, and having a way to actively track overused words once I notice them is wonderful.

How do you do search and replace?

Using vim-abolish is amazing for a variety of reasons, but the feature I use the most is the smart substitution. Decided that facility is too fancy a word and want to go with building? :%Subvert/facilit{y,ies}/building{,s}/g – also amazing for renaming characters in short stories.

How do you move around?

I hop around using vim’s built in motions of course. But I also lean very heavily on vim-sneak, which allows you to jump around the document in a couple of keypresses. sjo jumps to the first place it finds jo and then hitting ; goes to the next, makes getting where you are trying to go in a few keypresses the norm.

How do you restructure the text?

One amazing thing about using Vim as a simple prose editor is that it understands sentences and paragraphs, which makes restructuring a breeze. Want to delete a sentence das – and to delete a paragraph dap. Learn more about Vim’s text objects.

I also use hard line endings, so I use :set textwidth=50 and gqgq reformats and reflows paragraphs making them the width you specify in textwidth, great for cleaning up width after you do a lot of quick writing.

How do you deal with quotes and dialog?

A lot of my material recently (as short stories tend to) contain a lot of dialog, and working with dialog, vim-surround has been very helpful. Easily add and remove quotes around blocks of text, etc.

Does Vim have Spellcheck?

Vim has a great spellcheck built in.

Anything else?

Yep! The first is that Vim’s insert mode completion can be awesome for writing. The second is that if you have annoying character names or words you have to use repeatedly, take advantage of Vim’s abbreviation features. And last but not least, there are a lot of plugins to make Vim “good for prose” like vim-pencil but I find them unnecessary.

Some other interesting links: reddit: Vim for prose tips, Vim as a writing environment, Using Vim for writing Prose and Writing Prose with Vim.

Anything missing?

I am just getting back into writing, so I am looking around for a couple more plugins to increase my writing productivity. I am currently testing a grammar plugin and a thesaurus plugin, but I am not ready to recommend either yet.

Update: Since this I have switched out MultipleSearch with QuickHighlight.

comments powered by Disqus