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

Windows dead keys problem #4864

Closed
lesleyrs opened this issue Nov 23, 2022 · 10 comments · Fixed by #4961
Closed

Windows dead keys problem #4864

lesleyrs opened this issue Nov 23, 2022 · 10 comments · Fixed by #4961
Labels
A-documentation Area: Documentation improvements

Comments

@lesleyrs
Copy link
Contributor

Some problems I came across when going through the tutorial:

Ctrl+i does not seem to work at all on windows 10 in cmd/powershell/windows terminal (Ctrl+o works), but it does work on linux.

Alt-( and Alt-) are confusing to use, maybe an example on how you would use this?

~ and Alt-` or without Alt work first try on linux, but on windows you have to press them twice for it to work most of the time.

@the-mikedavis the-mikedavis added the A-documentation Area: Documentation improvements label Nov 23, 2022
@the-mikedavis
Copy link
Member

The tutor file is here if you would like to contribute: https:/helix-editor/helix/blob/master/runtime/tutor

Whichever terminal emulator you are using on Windows is most likely stealing the C-i, ~ and A-` keypresses. You may need to configure your terminal emulator or try another one (like WezTerm).

I use A-(/A-) pretty frequently. There's a common scenario where you want to swap the order of arguments in a function call:

foo(baz, bar)

If your cursor is on the a in baz, you can do:

  • mi( to select within the parentheses
  • S, <ret> to split that selection on the ", " part. You end up with a selection on baz and one on bar
  • A-) to rotate the selections so you end up with foo(bar, baz)

@lesleyrs
Copy link
Contributor Author

Thx for the response, but regarding the terminal I believe it would be a great thing if helix just works out of the box on default windows cmd/powershell.

I believe ~ and the backticks not working is related to the fact that on linux you can just press those keys and it appears on screen. While on windows to make them appear on screen you have to press space (doesn't work on helix) or press the key twice. So this makes it actually a helix bug as it's probably checking for it to receive the ` ~ keys and not the key press itself.

Not sure why Ctrl+i doesn't work though, can't find any keybinds connected to it. Would be helpful if anyone knows.

@CptPotato
Copy link
Contributor

CptPotato commented Nov 23, 2022

Not sure why Ctrl+i doesn't work though, can't find any keybinds connected to it. Would be helpful if anyone knows.

Huh that's interesting, I've had the same issue on Windows with WezTerm. I think the terminal ended up eating the command. The way I fixed it is by adding this to my WezTerm keybinds:

{ key="i", mods="CTRL", action=wezterm.action.SendKey { key="i", mods="CTRL" } },

Maybe there's something similar for the specific terminal emulator you're using.

I believe ~ and the backticks not working is related to the fact that on linux you can just press those keys and it appears on screen. While on windows to make them appear on screen you have to press space (doesn't work on helix) or press the key twice. So this makes it actually a helix bug as it's probably checking for it to receive the ` ~ keys and not the key press itself.

I don't think it's possible for terminal apps like helix to directly listen to key scan codes, though I might be mistaken. You can check if you can disable "dead keys" in your terminal emulator (use_dead_keys = false in WezTerm for example). That should send keys like ` directly to the terminal.

@ElectricCoffee
Copy link

There's also numerous spelling errors and missing stuff in the tutor file.
Things that come to mind:

Chapter 8.2 Macros comes to mind: says "it's" when it should say "its" for example.

Chapter 6.3 Repetition is missing a line marked with -->, so the instructions don't actually make any sense

@archseer
Copy link
Member

archseer commented Dec 1, 2022

@ElectricCoffee PRs with tutor improvements are appreciated

@lesleyrs
Copy link
Contributor Author

lesleyrs commented Dec 1, 2022

@CptPotato Turns out C-i was just helix lacking the keybind that works for Windows.

To avoid the dead keys problem I just added a US keyboard layout (not international) and it seems to work fine.

I do respect that WezTerm went all the way for having a way to disable dead keys as it seems quite complex and Windows Terminal definitely can't do that.

@CptPotato
Copy link
Contributor

@lesleyrs did you take a look at this microsoft/terminal#5784? It looks like you should be able to get around that with one key bind per dead key. I'm not familiar with Windows Terminal though, so I can't exactly tell how you set this up correctly.

@lesleyrs
Copy link
Contributor Author

lesleyrs commented Dec 2, 2022

@CptPotato Yea I saw that, surprisingly there is no general preset as far as I know. I don't mind what I'm using right now though.

For future people: after adding a new keyboard layout, delete the old one and re-add it to switch the default. Also remove the ctrl+shift and alt+shift keybinds in settings and just use winkey+space for switching.

@the-mikedavis
Copy link
Member

I'll re-open this since I think there are still some tutor problems to resolve

@the-mikedavis the-mikedavis reopened this Dec 2, 2022
@lesleyrs lesleyrs changed the title Helix --tutor problems Windows dead keys problem Dec 3, 2022
@lesleyrs
Copy link
Contributor Author

lesleyrs commented Dec 3, 2022

I think there was a misunderstanding with the tutor change in the PR like I said, but if @archseer doesn't want them I'll close this now.

Also changed the title so the remaining useful information is easier to find.

@lesleyrs lesleyrs closed this as completed Dec 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-documentation Area: Documentation improvements
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants