0

So I have this in my .vimrc file:

nnoremap <A-j> 5j
nnoremap <A-k> 5k

What I expected this to do was allow me to press Alt+j / Alt+k in order to move up and down 5 lines at a time, or use 5<A-j> to move 25 lines down (5 * 5 = 25). Instead, it does nothing at all. Could anyone let me know what I've done wrong here?

EDIT: I've solved this by using the code from: https://stackoverflow.com/a/10216459/2061838

Community
  • 1
  • 1
Feles
  • 155
  • 1
  • 10
  • Check this out: http://stackoverflow.com/a/7501242/778118. Your commands work for me, so it might have something to do with your terminal settings (like some of these answers/comments mention). – jahroy Feb 14 '13 at 23:03
  • I've tried disabling alt activating menu items in my terminal, with no luck. I don't exactly understand what the answer involving "C-V" in that question is asking me to do, although it seems relevant. – Feles Feb 14 '13 at 23:08
  • You can press `CTRL-V` to indicate that the next character you enter will be a _control sequence_. For example, if you want to search for all the `CTRL-M` characters in a file (newline characters from a PC) you would enter `/` (to search) followed by `CTRL-V` `CTRL-M`. When you do this, you'll see a little `^M` character appear as your search phrase. That answer is saying that you should go to your .vimrc file and type `CTRL-V` `ALT-j` to see what the output is. – jahroy Feb 14 '13 at 23:15
  • in termial or gvim? I guess terminal right? – Kent Feb 14 '13 at 23:16
  • Either or... Try opening your `.vimrc` file with either and entering the map command while using `CTRL-V` `ALT-j`. – jahroy Feb 14 '13 at 23:17
  • Actually, I've found that adding the code in http://stackoverflow.com/a/10216459/2061838 solved the problem entirely. Thanks for the info though, I wasn't aware of those things. – Feles Feb 14 '13 at 23:21
  • Excellent. Make sure you upvoted that answer if it helped. It looks like a good one! I'll also just throw in that `CTRL-U` and `CTRL-D` are _page up_ and _page down_ in vim, respectively. – jahroy Feb 14 '13 at 23:27

0 Answers0