Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

This is my .vimrc

set mouse=a
set ttymouse=xterm2
set number
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab
inoremap {      {}<Left>
inoremap {<CR>  {<CR>}<Esc>O
inoremap {{     {
inoremap {}     {}
inoremap (      ()<Left>
inoremap [      []<Left>
noremap ; l 
noremap l k 
noremap k j 
noremap j h 
set nocompatible
filetype plugin on

I've tried to remap hjkl to jkl; because that made more sense to me (I wouldn't have to take my hands off the home row to move). But it seems that the old mappings are still there. So now hjkl and jkl; will move the cursor in a direction, creating diagonal cursor movement when trying to go up or down.

What am I doing wrong? noremap should remove the old mappings, correct?

EDIT: I'm an idiot, there were spaces in the vimrc that screwed it up.

share|improve this question
4  
Would you consider writing your answer below as an "answer"? May have been a simple solution, but I guarantee someone else, someday, will have a similar problem :) After a bit of time, you can actually "accept" the answer. – JoshP Oct 3 '12 at 13:05
1  
Also, it's unrelated to your question...but set nocompatible really ought to come before everything else. That option resets a lot of other options. – Ben Sep 9 '13 at 5:11

Trailing spaces at the end of lines that specify new key bindings cause additional space keystrokes to be included as well. This is why OP was getting diagonal cursor movement when they remapped hjkl to jkl;. This goes for any remapping as well.

For example, if I have the following in my .vimrc file:

noremap a ik

a will be mapped to the keystrokes ik in sequence (i.e. pressing i and then pressing k).

share|improve this answer

Your Answer

 
discard

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.