Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Standard vim <Esc> alternative is not set by default #124

Closed
4 tasks
jjvliu opened this issue Mar 30, 2018 · 1 comment
Closed
4 tasks

Standard vim <Esc> alternative is not set by default #124

jjvliu opened this issue Mar 30, 2018 · 1 comment

Comments

@jjvliu
Copy link

jjvliu commented Mar 30, 2018

Summary

Most terminals interpret 'Ctrl-[' as 'Esc'. This is a popular way to exit from insert mode to normal mode, since you don't have to move your hand nearly as far from home row. I never have to press the physical Esc button in my workflow.

This mapping doesn't work by default for jupyter-vim-binding (at least for my browser). But it is easy to fix by explicitly defining extra keybinds for 'Ctrl-[' and 'Shift-Ctrl-['.

Environment

  • Operating system : Ubuntu 16.04 LTS
  • Web browser : Firefox 59.0.2
  • Version or revision of Jupyter Notebook : 4.3.1
  • Revision of jupyter-vim-binding : c9822c7

Behavior

In insert mode, press Ctrl-[. This should be interpreted as Esc and cause you to enter normal mode, but instead nothing happens.

Or in normal mode, press Shift-Ctrl-[. This should be interpreted as Shift-Esc and cause you to enter jupyter mode, but instead nothing happens.

What you have done to solve the issue

In vim_binding.js, copy line 71 (begins with 'Esc') and replace 'Esc' with 'Ctrl-['.
Copy line 72 (begins with 'Shift-Esc') and replace 'Shift-Esc' with 'Shift-Ctrl-['.

Remarks

This keybind conflicts with a Firefox default keybind for "Go back." So we have to choose between a standard Firefox keybind and a standard vim keybind. I found another project where this issue is being talked about, and that developer decided it would be worth adopting this mapping. What do you think: should it only be mentioned as a customization option, or should it be default behavior?

@jjvliu
Copy link
Author

jjvliu commented May 31, 2018

I found a better place to define these shortcuts according to the preferred customization method (custom.js rather than vim_binding.js). I added my solution to the wiki, so this can be closed. =)

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

No branches or pull requests

1 participant