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

In a vim session, pressing 'Ctrl + [' key combination does not work as expected (i.e. does not exit insert mode) #213

Closed
krishnakumarg1984 opened this issue Jun 10, 2020 · 10 comments
Labels
bug Something isn't working

Comments

@krishnakumarg1984
Copy link

krishnakumarg1984 commented Jun 10, 2020

Bug description

Inside vim, the Ctrl + [ sequence is used to exit insert mode, which doesn't work on the current version of wezterm.

Why bother?

This is a much better default choice for exiting insert mode (compared to Esc which is located far-away from the home row), or remapping caps to Esc etc (i.e. not applicable on other user's machines etc., not portable since OS-specific remapping software needed etc.). Also, while Ctrl + c is a valid choice, it sometimes breaks the flow of using certain plugins etc. In short, at least personally, I find Ctrl + [ to be my preferred option for exiting insert mode, and since this is built into default vim, this is anyway considered to be a bug if the terminal doesn't support a standard functionality like this.

Environment

  • OS: macOS
  • Version: wezterm 20200608-110940-3fb3a61
  • Vim: 8.2.0539

To Reproduce

  1. Fire up vim without any plugins or startup file like so: vim -u NONE
  2. In insert mode, enter some text eg: Mary had a little lamb
  3. Now, press Ctrl + [ to try and exit vim
  4. vim stays in insert mode and the character [ is literally entered into the buffer

Configuration

Problem occurs with default install of wezterm. No specific configuration file was created.

Expected behavior

vim should exit insert mode and come back to normal mode when Ctrl + [ is pressed.

Additional context

The same issue occurs in neovim (v0.4.3) as well.

@krishnakumarg1984 krishnakumarg1984 added the bug Something isn't working label Jun 10, 2020
@krishnakumarg1984 krishnakumarg1984 changed the title Within, Ctrl + [ does not work as expected (i.e. does not exit insert mode) In a vim session, pressing Ctrl + [ does not work as expected (i.e. does not exit insert mode) Jun 10, 2020
@krishnakumarg1984 krishnakumarg1984 changed the title In a vim session, pressing Ctrl + [ does not work as expected (i.e. does not exit insert mode) In a vim session, pressing 'Ctrl + [' key combination does not work as expected (i.e. does not exit insert mode) Jun 10, 2020
wez added a commit that referenced this issue Jun 11, 2020
This was originally intended to be swept in and dealt with as part of
adopting CSI-u (refs: #63) but the
default shift-space mapping is super irritating in vim (refs:
#126) so it got partially walked
back, but as a consequence we accidentally dropped the modifiers from
those keys (refs: #213 refs:
#214).

This commit restores the modifiers for that case.

In addition, since we now have a way to plumb configuration directly
into the term crate, this adds a config option to enable CSI-u for those
that want to use it.
@krishnakumarg1984
Copy link
Author

Thanks for the fix!

@wez
Copy link
Owner

wez commented Jun 11, 2020

Thanks for reporting this!

This issue affected each of the ctrl key combinations that have ambiguous representations (i, m, [, { and @), effectively dropping their modifiers.

This should now be fixed in master and you'll be able to download a build for macos from https://github.com/wez/wezterm/runs/759932214 once it is finished building, or from the nightly download in about an hour or so.

@krishnakumarg1984
Copy link
Author

krishnakumarg1984 commented Jun 11, 2020

@wez Thanks Wez! This may finally bring my quest for a terminal emulator to an end. I have raised a PR to add this project to the list of cool rust applications at the awesome-rust github repo.

I am finally looking to having the same experience on a truly cross-platform terminal emulator. I have a macbook as my work/travel laptop, a linux workstation for heavy-duty computations, and have to use Windows when logged into campus-wide common-room machines. The portable app setup makes it all the more great. A unified terminal experience and a single config file - a dream, if everything just works as expected.

Alacritty came close, but it doesn't support font ligatures.

@krishnakumarg1984
Copy link
Author

Thanks. I'll probably wait for the updated version to get to homebrew before checking it out.

@wez
Copy link
Owner

wez commented Jun 11, 2020

Hopefully wezterm helps you to realize your dream!
Please don't hesitate to raise issues/questions or give other feedback!

@prabirshrestha
Copy link

@wez Would it be possible to release this to aur?

@wez
Copy link
Owner

wez commented Jun 17, 2020

I'm warming up to making a new release, but would like to let my most recent couple of commits bake for a bit first. You can run with https://aur.archlinux.org/packages/wezterm-nightly-bin/ in the meantime!

@prabirshrestha
Copy link

Wasn't aware of wezterm-nightly-bin thought only wezterm-git existed and that requires running full build. It seems to work so I'm good now.

@wez wez closed this as completed Jun 20, 2020
@krishnakumarg1984
Copy link
Author

Thanks a lot for the fix. I can confirm that this issue is now resolved.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2023

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants