Vim for Writers

Revision as of 06:17, 13 October 2013 by NewMexicoKid (talk | contribs) (Useful information for writers on how to use vim for novel planning and writing)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Starting a new thread on vim because just today I discovered some power plugins and tools that I hadn't been aware of before; and that makes me think that there must be other vim users out there who have still other vim-related tips and tricks to share.

I had been trying out Kabikaboo but was discomfited by stability issues it had (someday I want to write an application to do that kind of GUI-driven reorganization of text blocks that can be edited in vim...), so I wondered whether I should take another look at vim folding. Lo and behold, I found a video that made vim folding look utterly simple (previously, I had tried vim outliner but it somehow never stuck with me, even though I've been a vim user since the 1990's).

The vimcast video was good; however, it took a little work to get my environment to where I was opening folds with a simple spacebar press; and to where my markdown file (for later transformation via pandoc) was automatically folded.

  1. installed vundle, a vim bundle manager that lets you EASILY install other vim plugins/bundles.
  2. used vundle to install vim-markdown (better markdown syntax highlighting) and vim-markdown-folding
  3. added the spacebar mapping to my .vimrc:
    nnoremap <Space> za

Then I discovered the beauty of vim-colors-solarized that "is a sixteen color palette (eight monotones, eight accent colors) designed for use with terminal and gui applications. It has several unique properties. I designed this colorscheme with both precise CIELAB lightness relationships and a refined set of hues based on fixed color wheel relationships. It has been tested extensively in real world use on color calibrated displays (as well as uncalibrated/intentionally miscalibrated displays) and in a variety of lighting conditions." (

Vim is, basically, my goto editor for just about anything (I'm a programmer by trade, so it's perhaps unsurprising).

Personally, I use vim script called nvim to build my piles of random little notes during planning - it works well for me, but then again it ought to given I wrote it!

Vim can be more or less as powerful as you want it. It's really worth the time spent learning how to jump around ( using '(' and ')' to jump to the start of the previous / next sentence in particular).

You can get help on just about any vim feature by entering the command ':help SOMETHING', e.g. ':help spell'

Useful .vimrc options for beginners:

'set autowriteall' - autosave your current document whenever you change away from the current buffer. You can just do 'set autowrite', which will save in *most* situations (the main exemption being quitting).

'set spell spelllang=en_gb' - enable (in this case British) spell checking - see the help page for details of the commands to jump to mistakes and pick / learn corrections.

Found some more documentation on the built-in support for spell checking (as of vim 7).

  • it supports a personal word list (very useful for fantasy authors ;-) )
  • some useful keys for spellchecking:
    • ]s - forward to misspelled/rare/wrong cap word
    • [s - backwards ]
    • S - only stop at misspellings
    • [S - in other direction
    • zG - accept spelling for this session
    • zg - accept spelling and add to personal dictionary
    • zW - treat as misspelling for this session
    • zw - treat as misspelling and add to personal dictionary
    • z= - show spelling suggestions
    •  :spellr - repeat last spell replacement for all words in window

If you *do* happen to use vim, this might be useful:

Here are a few more vim novel writing resources that have caught my eye:

Found and installed this vim plugin today:

It apparently turns on auto save and saves every time a buffer is modified.

Considering two of the plugins mentioned in this blog article suggesting nine:

  • Showmarks
    Marks are bookmarks within a Vim document. You can set a mark by pressing m followed by another letter that designates the mark. To jump to a mark, enter ' followed by the mark's letter.
    The great weakness of marks is that they are invisible. This limits the number you can use to however many you can remember, and you can easily accidentally overwrite an existing mark by creating another with the same name.
    Showmarks allows you to toggle the visibility of marks off and on – and that tiny functionality is enough to increase the usefulness of marks several times over.
  • Vim-abolish
    Vim-abolish is so elegant that you wonder why no one thought of it before, but it's hard to describe. It has aspects of a word processor's spell checker or autocorrect, but might best be described as a configurable search and replace tool. What makes Vim-abolish so powerful is that it allows you not only to search and replace one word or spelling for another, but also to include all instances of a word. Upper case, lower case, noun and adverb, past and present tense, participles – all can be added to the search and replaced with a few dozen characters.
    Admittedly, you might take a while to learn how to think in the terms necessary to set up a Vim-abolish command, and learning how to construct a command may take some time too. However, once you understand how Vim-abolish works, you will probably find it an invaluable proofreading tool.

Next, I think I will buff up my perl script that I used for word wars (incremental wordcounts by saving my current word count in a file along with the current date and time; then doing a little math). It might also help me keep track of my writing progress as Rachel Aaron advised in this excellent blog article (on how to increase ones writing productivity).

I was looking into software for novel writing and there's surprisingly little that's free, 64 bit and doesn't require mono. I'm pretty particular about my working environment so I refuse to mess it up with 32bit compatibility libraries.

Probably better this way, in the long run I'll be much happier with vim. I use it together with git (flashbake), vimroom, onlinethesaurus, vim-abolish, vim-repeat and vim-outline.Vimroom does not always work as well, and there's little support for it, but it's still usable with a bit of tinkering.

Of all the plugins vim-outline is the most usefull. I'd reccomend it to everyone planning to use vim. It allows you to easily structure your text, and makes for easy folding/expanding.

Spookje, can you give the URL for vim-outline? Are you referring to vim-outliner?

vim-repeat looks interesting...

Seth Brown has two blog articles that also look interesting:

Also, one redditor has plans to write a book on Vim for Writers; there are some interesting chapter titles in this reddit.

This year, I am planning on writing my novel in Markdown using Vim.  As has already been suggested, I will be using Pandoc to convert to PDF and HTML for convenience.  I found a great post about using 'gnu make' to automatically generate everything:

Finally, I will be using git as revision control and a form of backup to a central bitbucket repository.

I'm curious whether anyone has used the vim wiki plugin. I've noticed quite a few people advocating the use of the zim desktop wiki tool (but, of course, it isn't edited in vim, even though there is a vim zim syntax support); I regularly use Mediawiki instances (and once played with tiddlywiki). The vim wiki plugin looks interesting; and, since I now use the vundle plugin manager, I may give it a try.

Some reviews I've seen for vim wiki:

I think I am wandering down a different internet trail at this point ;-) ; found a nifty Google tech talk by vim creator Bram Moolenaar with useful tips for productive vim; and a blog post about how to use vim and ack for notetaking. But vim wiki looks very interesting...