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.



  1. http://vim.sourceforge.net/scripts/script.php?script_id=2352

    I used the information on this link to make my own settings. This is what I added to my /etc/vim/vimrc file.

    “F7 WordProcessorOn
    :map :set linebreak :set display+=lastline :set wrap :setlocal spell spelllang=en_gb :nmap j gj:nmap k gk
    “F8 WordProcessorOff
    :map :set wrap :set nospell

    Comment by uri — July 15, 2009 @ 5:38 am

  2. Thank you!

    Comment by Mirai — December 23, 2009 @ 2:38 am

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: