Out of Hanwell

May 28, 2008

Using vim for Word Processing

Filed under: Linux, Software, Tools — Matthias Miller @ 11:24 pm

I’ve recently been using vim for word processing. However, it’s very cumbersome to edit long lines of text because the up/down/home/end keys do not respect wrapping.

Of course, vimrc comes to the rescue:

imap <up> <C-O>gk
imap <down> <C-O>gj
nmap <up> gk
nmap <down> gj
vmap <up> gk
vmap <down> gj
imap <home> <C-O>g^
imap <end> <C-O>g$
nmap <home> g^
nmap <end> g$
vmap <home> g^
vmap <end> g$

And once again, I’m a happy vim user.

Update: And to get soft word wrapping, I added:

set formatoptions=l
set lbr

Now I’m really happy.

Advertisements

Create a free website or blog at WordPress.com.