views:

189

answers:

6

As a programmer by heart, if not by profession, I increasingly rely on, nay live in VIM for most editing-related tasks. What tips can you offer for using (almost) everyone's favorite editor for editing general-purpose text, say, an article? I mean plain text, with minimal markup using Markdown or RST; I'm not looking for support for LaTeX or for entering mathematical formulae.

+4  A: 

Spell checking:

:setlocal spell spelllang=en_us
" ]s moves to the next mispelled word
" [s moves to the previous mispelled word
sleepynate
A: 

Use insert abbreviations:

iabbr teh the
iabbr i I
iabbr definately definitely

Edit, another tip:

set wrap nolist linebreak

This tells vim to wrap lines that are too long with "visual" newlines rather than adding an actual newline character to the file. The 'list' option must be off because it automatically disables the 'linebreak' option.

Randy Morris
+3  A: 

Set a thesuarus for Vim

Use par to format text

michaelmichael
Thesauruses can be evil. They lead the unwary to eschew the simple and easily understandable words and blithely utilize sesquipedalian words.
David Thornley
+3  A: 

I enable soft-wrapping when I'm editing most text files:

:set wrap

If you decide to do the same, then you'll want to know about gj and gk in normal mode, to move by screen lines instead of physical lines. I use them so often I remapped the up and down arrow keys to them instead of k and j.

Whether you're editing hard- or soft-wrapped files, you'll get a lot of mileage out of gqap (or its cousin gwap) to re-wrap a single paragraph with hard newlines, and vipJ to join all the lines of a hard-wrapped paragraph back into a single line.

You might also want to consider including a in formatoptions, to enable automatic paragraph formatting:

:set formatoptions+=a

When you're doing all this wrapping and unwrapping, it's nice to keep Vim from mangling numbered lists:

:set formatoptions+=n

In fact, I'd suggest reviewing all the formatoptions and adjusting them to your particular preferences:

:help fo-table

More info:

:help gj
:help gk
:help gqap
:help auto-format
:help formatoptions
Bill Odom
+1  A: 

It's not very well maintained, but the Vim-Outliner project makes Vim into a killer outliner for plain text writing. You can download v0.34 here (there's a more recent version, I think, but I'm not sure where to get it):

http://www.vimoutliner.org/postnuke-phoenix-0.7.2.3/html/modules.php?op=modload&name=Downloads&file=index&req=viewdownload&cid=4

Herbert Sitz
A: 

I really enjoyed this blogpost about writing better with latex. You could use vim-latex :) It's more about writing better, than just editing english text though.

http://matt.might.net/articles/shell-scripts-for-passive-voice-weasel-words-duplicates/

Espen Schulstad