How to use a different key for Vimperator's hint function (remap)

3

I'm wanting to change the key from f to something else for Vimperator's key function. I'm guessing I use a similar code to this one:

:map <whateverkeyiwant> <hint>

But the thing is, <hint> doesn't work for the hint function as I've already tried it. So what would I place in those brackets to get this to work? And if I'm completely wrong about this, what different code should I use?

Thanks.

monkish

Posted 2011-12-27T06:49:01.653

Reputation: 31

I don't know if it would make any difference, but did you try this on pentadactyl? It's the "successor" of vimperator, as it is a fork of the project, where most of the developpers went to, so if there's a bug in :map, it might have been corrected there. – Dalker – 2011-12-27T08:15:18.357

Actually I did try pentadactyl but it seemed pretty buggy and much slower than Vimperator. So I switched back. – monkish – 2011-12-28T14:23:54.877

Anyways, I got this to work. I just mapped a new key that uses the 'f' key. – monkish – 2011-12-28T14:25:40.223

Answers

2

Vimperator, like Vim, refers to functions by the keys they are bound to by default. Thus, you don't map keys to functions like hint, but to other keys that serve as names for those functions:

:nnoremap j f    ;maps j to what f does, so maps j to show hints

To explain, nmap defines a mapping in normal mode, which tells vimperator to perform f's function when you type j EXCEPT when you are inserting text. You want this mapping to occur in normal mode only, because otherwise you'll try to type jumping jellybeans and get fumping fellybeans.

nnoremap does the same thing, except it ensures that anything you map to j later on gets mapped to j's old function (move page down) instead of j's new function (show hints). Here's the difference:

nmap j f
nmap k j   ;k now activates hints, because that's what j currently does

VS.

nnoremap j f
nnoremap k j   ;k now moves the page down, because that's what j NORMALLY does

I strongly suggest tht you use nnoremap until you have a compelling reason not to since it can save you a lot of trouble trying to figure out why nothing's working the way you think it should.

If you want to save these maps to use forever instead of just having them for one session, type :mkvimperatorrc. This will put all of your Vimperatormappings and other settings active in the current session into a file called _vimperatorrc in your home directory. That file then becomes a list of commands that Vimperator executes on startup to change your settings to how you want them. :)

Gordon Gustafson

Posted 2011-12-27T06:49:01.653

Reputation: 1 767

Should be the accepted answer! Good stuff, thank you. – atripes – 2015-03-13T12:18:42.103