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

How can I bind ; to :? #492

Closed
ScenK opened this issue Jul 21, 2016 · 7 comments
Closed

How can I bind ; to :? #492

ScenK opened this issue Jul 21, 2016 · 7 comments

Comments

@ScenK
Copy link

ScenK commented Jul 21, 2016

Is that a configuration for binding ; to :?

@rebornix
Copy link
Member

I think it's a remapping feature @johnfn is working on or already finished?

@jkurei
Copy link

jkurei commented Jul 21, 2016

You can add this to your settings.json:

"vim.otherModesKeyBindings": [
        { "before": [";"], "after": [":"]}
]

I have just checked it works, although...

A problem with this is ; will also be replaced with in vim searches (/); I think that's a bug (#495). Of course, searching ; isn't very common, but I actually have done it recently, so may be that bug is a deal breaker for you.

@rebornix
Copy link
Member

@jkurei it's a little bit out of my Vim knowledge, does Vim have this feature as well and should it only work on Normal Mode?

@jkurei
Copy link

jkurei commented Jul 21, 2016

@rebornix yeah. In Vim you can map anything and specify in which modes you want it to work, but they don't work in the ex-commands line nor searches (unless, may be, you specify so? idk).

I have several of such bindings (in real Vim) and they never apply in searching. I have just tested out that the same goes for the remap @ScenK wants to do, just to be sure.

If you don't know the ex menu, It's kind of the grandfather of the Cmd+Shift+P menu that Sublime/Atom/VSCode use today, and it's usually accessed with the : key.

If you wanna check this out, just add map ; : to ~/.vimrc, and then run (or restart if already running) Vim. Now whenever you press ;, it'll open the ex menu, just as : usually does.

@rebornix
Copy link
Member

@jkurei yup I know ex menu and I'm implementing it, part of #463 . Now I'm clear enough with the binding scope. It is straight forward to stop key mapping in Search Mode but if we want to speciy mode, we need the same logic as VS Code does keybindings.

This bug is on my list :)

@johnfn johnfn closed this as completed Jul 25, 2016
@johnfn
Copy link
Member

johnfn commented Jul 25, 2016

As @jkurei pointed out, this does in fact already work. I suspect our README does not go into enough detail with key remappings, which is confusing people.

The search remapping bug is tracked in #495, and it should be a quick fix. 😃

@jima80525
Copy link

Just in case someone else finds this bug and tries to fix it, the solution shown above doesn't work (anymore?). Here's what worked as of July 2019:

"vim.normalModeKeyBindings": [
    { "before": [";"], "after": [":"]}
],

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

5 participants