Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.