Super User is a question and answer site for computer enthusiasts and power users. 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

I just bought a new Macbook Air and my up and down arrows don't work in vim. They work in the bash shell however. But if I try to use them in Vim, I just get the bell.

After more experimentation, I think some vim ruby plugin is messing up my arrow keys.

share|improve this question

migrated from stackoverflow.com Nov 5 '10 at 14:16

This question came from our site for professional and enthusiast programmers.

    
@Paul, @Ben: meta.stackoverflow.com/questions/25925/vim-questions-so-or-su – Randy Morris Nov 5 '10 at 13:53
1  
@Randy, by that logic "how to adjust my Aeron chair" is a programming question because most Aeron chairs are used by programmers. This question isn't about setting up macros or fixing the language specific configuration, it's about basic vim setup. – Paul Tomblin Nov 5 '10 at 14:11
up vote 2 down vote accepted

I've notice that you said: (before you edit the question in Stackoverflow)

I need the arrows for FuzzyFinder and for going back in my Vim command search history.

You can achieve the same with the <C-n> and <C-p> key combinations, but you probably need also these in your .vimrc:

cnoremap <C-b> <Left>
cnoremap <C-f> <Right>
cnoremap <M-b> <S-Left>
cnoremap <M-f> <S-Right>

so you can have the arrows emulation in command mode (search included).

share|improve this answer

You are likely running Vim in vi compatible mode, which uses h, j, k and l for cursor navigation. Try typing the following command in Vim's command mode:

:set nocompatible

If this fixes your problem, you can create a file called .vimrc in your home directory (if it doesn't exist already) and add this line to the file:

set nocompatible

share|improve this answer

You could always use j to move down and k to move up...

share|improve this answer
    
can you use j and k to go back in your vim command history? – dan Nov 5 '10 at 13:37
    
@dan: You can if you use q: to bring up the command-line window. – Chris Johnsen Nov 6 '10 at 2:14

Try running vim as:

vim -u NONE --noplugin

to prevent any scripts or plugins changing anything, then see if your cursor keys work.
If there's still a problem, it's not caused by your Vim setup.

share|improve this answer

Look in the Vim FAQ for "mapping".

share|improve this answer

You must log in to answer this question.

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