3

While editing a simple text file where every line is nearly to the end of screen, I was expecting vim to retain the column position as I used j and k to move up and down.

Surprisingly, it does not happen. I am using a default install of vim on ubuntu 12.10 and a few plugins (unicycle, speeddating, tex, Align, Alignmaps, genutils, html, foldutil, scratch, surround).

The behaviour I am referring to is: I am in C57-L5. Line 6 is 80 characters long. I hit j, cursor jumps to C1-L6 instead of C57-L6.

What could be wrong? How can I set it right?

1 Answer 1

1

open ~/.vimrc and add these 2 lines

nnoremap j gj
nnoremap k gk

close and restart vim.

ps: it will still go to the first column on empty lines, and you might want to set nowrap.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .