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

Use Angle Bracket Notation (Fixes #64) #683

Merged
merged 2 commits into from
Sep 1, 2016
Merged

Use Angle Bracket Notation (Fixes #64) #683

merged 2 commits into from
Sep 1, 2016

Conversation

jpoon
Copy link
Member

@jpoon jpoon commented Aug 31, 2016

Easing myself back into the project after a short hiatus with this simple change.

Update: Translating key presses to Vim's angle bracket notation:

ctrl+* becomes <C-*>
escape becomes <Esc>
backspace becomes <BS>
delete becomes <Del>

@johnfn
Copy link
Member

johnfn commented Aug 31, 2016

Always nice to see you again 😄

Could you actually fix this in the more general way by obliterating ctrl+* from the codebase entirely and replacing all such instances with <c-*>?

It would fix our longest standing bug #64 :)

@jpoon jpoon changed the title Remove test hack Use Angle Bracket Notation (Fixes #64) Aug 31, 2016
@jpoon
Copy link
Member Author

jpoon commented Aug 31, 2016

Argh, just realized this will break backwards compatibility for those that have used a otherModesKeyBindings/insertModeKeyBindings settings.

I'm OK with having people needing to update their settings but open to alternatives.

@johnfn
Copy link
Member

johnfn commented Aug 31, 2016

True, but we don't actually document how to do that anywhere (intentionally, since I knew this was gonna happen eventually...)

Ideally we could just show an error to people who we detect have ctrl+* keybindings - say "you need to update your old keybindings to match the new format"

We could even handle both in the keybindings parser.

@jpoon
Copy link
Member Author

jpoon commented Sep 1, 2016

That should do it. Moved the angle bracket translation logic to util.ts where it is now called by:

  1. extension.ts where the vscode key presses come in
  2. remapper.ts to remap keys for insertModeKeyBindings and otherModesKeyBindings (ie. we have backwards compat)


1. Add the following to `settings.json` (open the Command Pallete and search for "User Settings"):

```
"vim.insertModeKeyBindings": [
{
"before": ["j", "j"],
"after": ["<escape>"]
"after": ["<Esc>"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this <esc> to stay in line with Vim?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you referring to the capitalization? VimDocs have it as a capital E so following suit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know that! Okay, that's fine.

@jpoon jpoon merged commit 73f4f6e into master Sep 1, 2016
@jpoon jpoon deleted the code-cleanup branch September 1, 2016 04:09
This pull request was closed.
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

Successfully merging this pull request may close these issues.

2 participants