Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to ‘map g’ #252

Closed
mina86 opened this issue Aug 7, 2015 · 7 comments
Closed

Unable to ‘map g’ #252

mina86 opened this issue Aug 7, 2015 · 7 comments

Comments

@mina86
Copy link

mina86 commented Aug 7, 2015

I’m trying to use ‘g’ to switch to the next tab. In desperation, this is what I used:

noremap g :tn<CR>
nnoremap g :tn<CR>
vnoremap g :tn<CR>

Unfortunately, ‘g’ is still recognized as a prefix only so on its own it does nothing, but ‘gg’ scrolls to the top. The same issue is with ‘z’ which is also a prefix key.

@gkatsev
Copy link
Member

gkatsev commented Aug 7, 2015

This is also an issue in vim itself. I think the only way to map just g is to basically map all the other things to <Nop>.

@mina86
Copy link
Author

mina86 commented Aug 7, 2015 via email

@gkatsev
Copy link
Member

gkatsev commented Aug 7, 2015

:usage mappings

@mina86
Copy link
Author

mina86 commented Aug 7, 2015

No cigar:

map g$ <Nop>
map g0 <Nop>
map g<C-g> <Nop>
map g<lt> <Nop>
map g@ <Nop>
map gB <Nop>
map gF <Nop>
map gH <Nop>
map gP <Nop>
map gT <Nop>
map gU <Nop>
map gb <Nop>
map gf <Nop>
map gg <Nop>
map gh <Nop>
map gi <Nop>
map gn <Nop>
map go <Nop>
map gt <Nop>
map gu <Nop>
map zI <Nop>
map zM <Nop>
map zO <Nop>
map zR <Nop>
map zZ <Nop>
map zi <Nop>
map zm <Nop>
map zo <Nop>
map zr <Nop>
map zz <Nop>
noremap z :undo<CR>
noremap g :tn<CR>

still doesn’t work.

@gkatsev
Copy link
Member

gkatsev commented Aug 7, 2015

Thanks for trying. It's possible that it's mapping specially. In which case a change to the code would be necessary beforehand.

@timss
Copy link
Member

timss commented Mar 1, 2016

As a reference of sorts:

If a map is not executed, chances are that longer maps starting with the same key sequence still exist.

Take a look at events.js' onKeyPress logic.

Using explicit internal functions:

:js mappings.add([modes.NORMAL], ["g"], "foobar", function() { alert("foobar") });

If a simple g is used, nothing happens, however g<Esc> will execute the function.

Same goes for mappings with keys that are not used anywhere else, such as |:

:js mappings.add([modes.NORMAL], ["|"], "foobar", function() { alert("foobar") });

Now | will execute immediately because there is no other mappings to be resolved.


I don't think adding lots of maps to <Nop> will not help. Nor does unm[ap] seem to do the trick.

If you really want to use g for anything, you may have to remove mappings from the code itself. And there's lots of them, and they come in many shapes.

tl;dr bad idea.


Closing, as this issue doesn't have a "solution" with the current design.

@timss timss closed this as completed Mar 1, 2016
@gkatsev
Copy link
Member

gkatsev commented Mar 14, 2016

If someone can go through and figure out how to make vimperator actually acknowledge a full set of <Nop> so that the key could be mapped without waiting for the timeout to trigger, we would happily merge such a PR but it is unlikely that any of the "core" developers are going to take any of this on because of our limited constraints on just trying to keep vimperator afloat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants