Saturday, February 2, 2013

Re: nnoremap j gj not working from vimrc

On 2013-02-02, 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.

Your mapping is behaving as though you left a space at the end.
Open your vimrc and execute

:set list

I expect that your mappings will look like this:

nnoremap j gj $
nnoremap k gk $

Delete that trailing space and your mappings should work as
intended.

Regards,
Gary

--
--
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: