Saturday, February 2, 2013

Re: nnoremap j gj not working from vimrc

On 02/02/13 21:07, Jarom Jackson wrote:
> I've tried placing the following:
>
> nnoremap j gj
> nnoremap k gk
>
> in the vimrc, but is causes some funny behaviour.
> I'm using gvim, and when I issue the commands above manually, they do what I expect, the cursor moves up/down one visual line at a time.
>
> When placed in the vimrc, though, when I start up gvim and try navigating, it does some unexpected stuff. j moves down 1 and over 1, but skips empty lines. k moves the cursor up one and over 1, but gets stuck on empty lines.
>
Strange. My vimrc includes the following:


" Up, Down move up/down by "screen lines"
" j k (default) move down/up by "file lines"
map <Down> gj
map <Up> gk


and it does what I expect: I normally use 'wrap' on, and this makes jk
move by "file" lines while <Up> <Down> move by "screen" lines, as
mentioned in the comments. Nothing unexpected.

Try the following (after starting gvim with the mappings you listed
above, defined only in the vimrc):

:verbose map j
:verbose map k

Maybe it can help you track down the cause of the trouble.


Best regards,
Tony.
--
Whistler's Law:
You never know who is right, but you always know who is in
charge.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: