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

WSL: Home, End, Ctrl+Space keys in Emacs #1009

Closed
kirillkh opened this issue Jan 8, 2017 · 40 comments
Closed

WSL: Home, End, Ctrl+Space keys in Emacs #1009

kirillkh opened this issue Jan 8, 2017 · 40 comments
Labels

Comments

@kirillkh
Copy link

@kirillkh kirillkh commented Jan 8, 2017

Using WSL on Windows 10 14393.576, ConEmu 161206.

Pressing Home in Emacs gives status: "M-[ h is undefined". For End it's "M-[ f is undefined". Ctrl+Space just inserts space. I tried mapping those to 'beginning-of-line, 'move-beginning-of-line, etc as per solution suggested here, now Home and End work, but for some reason it results in mark being set, so it selects all text to beginning/end of the line.

Home and End do work on the command line.

@hsab
Copy link

@hsab hsab commented Jan 17, 2017

I actually have this problem. Especially with any process that requires a combination of Ctrl + something else. I was wondering if there is any way to generally bypass key interception wholly for WSL similat to that of mintty and just limit to changing focus between conemu and wsl-bash?

ps. thank you for the wonderful software. it has really changed my windows workflow

@kirillkh
Copy link
Author

@kirillkh kirillkh commented Jan 17, 2017

@hsab I tried several workarounds, none worked satisfactorily except the following:

  1. download and install wsltty, a special mintty build https://github.com/mintty/wsltty
  2. setup the "wsltty" task as follows: %LOCALAPPDATA%\wsltty\bin\mintty.exe --wsl -o Locale=C -o Charset=UTF-8 /bin/wslbridge -t /bin/bash -l
  3. enable the "Install keyboard hooks" option in Settings -> Keys & Macro -> Keyboard
  4. change the keyboard shortcuts for "Switch next console" and "Switch previous console" to Win+PgUp and Win+PgDown (or Win+other keys that you prefer).

Basically, this embeds mintty into ConEmu. The disadvantage is that you cannot use the tab switching shortcut that you're used to, but are forced to use Win+PgUp/Down and similarly with other ConEmu shortcuts (which I don't use). But it's okay-ish for me as a temporary solution until Windows fixes their console.

@Maximus5
Copy link
Owner

@Maximus5 Maximus5 commented Jan 17, 2017

I tried several workarounds

Which exactly?

@kirillkh
Copy link
Author

@kirillkh kirillkh commented Jan 17, 2017

Which exactly?

I don't remember all the details, but here's what I tried for sure:

  1. cmder+wslbridge: doesn't fix ctrl+space
  2. msys2+ssh: programs (such as less, emacs, etc) start crashing after a while, I believe it might be about this (yes, it also happens in cygwin): http://cygwin.1069669.n5.nabble.com/Some-programs-vi-ssh-crash-when-screen-buffer-height-is-big-td109852.html Besides, you have to set up the ssh server and make it start up upon Windows login
@Maximus5
Copy link
Owner

@Maximus5 Maximus5 commented Jan 17, 2017

So, you haven't even read ConEmu docs?

BashOnWindows in ConEmu

@kirillkh
Copy link
Author

@kirillkh kirillkh commented Jan 17, 2017

Yes I have. Tried to follow it, something didn't work. And then I found cmder, which I assumed did the same, but without the need to tinker manually, so I tried that instead.

Edit:
Specifically, here is the screenshot of the error. https://snag.gy/wbEjs2.jpg
Command used: conemu-cyg-32.exe ./wslbridge.exe -t "-new_console:D:H:\devel\MinGW\cygwin-connector" -new_console:np

@hsab
Copy link

@hsab hsab commented Jan 17, 2017

@kirillkh thank you kirill. this solution worked nicely.

@ghost
Copy link

@ghost ghost commented Feb 13, 2017

I cant get my enter key to work in conemu with emacs. it works in vi. I've used WSL bridge, msys2 and cygwin connectors, spent hours and hours trying to fix it :(

I fix one problem and another one shows up

well "zile", not emacs technically

everything works fine if I use mintty.exe directly

@cartel0x27
Copy link

@cartel0x27 cartel0x27 commented Jun 28, 2017

Is there a way to fix ctrl-space without using mintty? It works in conhost now (RS2), but not in conemu.

@kirillkh
Copy link
Author

@kirillkh kirillkh commented Jun 28, 2017

Ditto, ctrl-space now works in plain bash.exe, but not in conemu.

@kirillkh
Copy link
Author

@kirillkh kirillkh commented Jun 28, 2017

By the way, I figured out the reason I was getting the error when running conemu-cyg-32.exe ./wslbridge.exe -t "-new_console:D:H:\devel\MinGW\cygwin-connector" -new_console:np: the "-new_console:D" part is actually wrong, it needs to be the lower-case "d" as per ConEmu's docs. Please fix this command line here: http://conemu.github.io/en/BashOnWindows.html

Now I am able to run that command successfully, however, Ctrl-space doesn't work. Using ConEmu 161206.

@BladeMF
Copy link

@BladeMF BladeMF commented Jul 26, 2017

I have installed the latest alpha version which contains the commit above, but it still doesn't work. Am I missing something?

@Maximus5
Copy link
Owner

@Maximus5 Maximus5 commented Jul 26, 2017

What exactly doesn't work? What do you press and what do you expect?

@BladeMF
Copy link

@BladeMF BladeMF commented Jul 26, 2017

When I press Ctrl+space, it inserts spaces. Midnight commander has this shortcut which calculates folder sizes. It works in both putty and windows bash client.

I can do specific tests if you need me to.

@Maximus5
Copy link
Owner

@Maximus5 Maximus5 commented Jul 26, 2017

Do you use cygwin/msys connector?

@BladeMF
Copy link

@BladeMF BladeMF commented Jul 26, 2017

No, I use it as it came from the download page. Should I be?

@BladeMF
Copy link

@BladeMF BladeMF commented Jul 26, 2017

What does it do?

@BladeMF
Copy link

@BladeMF BladeMF commented Jul 26, 2017

The default bash console does not have the same problem with Ctrl+Space, so the problem does not seem to be on the Ubuntu side.

@Maximus5
Copy link
Owner

@Maximus5 Maximus5 commented Jul 26, 2017

The page https://conemu.github.io/en/BashOnWindows.html contains all information you interested in.

@BladeMF
Copy link

@BladeMF BladeMF commented Jul 26, 2017

I read it, but I don't understand it. Do I need it for Ctrl+Space to work?

@Maximus5
Copy link
Owner

@Maximus5 Maximus5 commented Jul 26, 2017

As I said above. You need connector+wslbridge to give ConEmu ability to bypass Microsoft's conhost bugs.

@BladeMF
Copy link

@BladeMF BladeMF commented Jul 26, 2017

Just tried it, downloaded wsl-con.cmd, let it downlad (being Administrator), then ran it as a normal user. it showed some color cubes and displayed a command prompt. When I ran MC from there, I had the same problem. I may be doing something wrong...

@BladeMF
Copy link

@BladeMF BladeMF commented Jul 26, 2017

Furthermore, mouse events are not sent to MC too. Maybe there is a setting for this?

@Maximus5
Copy link
Owner

@Maximus5 Maximus5 commented Jul 27, 2017

What is the version of the connector you are trying?

@Maximus5
Copy link
Owner

@Maximus5 Maximus5 commented Jul 27, 2017

New version is bundled with ConEmu. wsl-con.cmd may download old one.

@BladeMF
Copy link

@BladeMF BladeMF commented Jul 27, 2017

So, I replaced conemu-cyg-XX.exe with the files in ConEmu folder. The x64 version doesn't start at all (The application was unable to start correctly (0xc000007b)). The x86 starts okay. Also:

  • cygwin1.dll (FileVersion: 2006.0.0.0, ProductVersion: 2.6.0)
  • wsl-bridge.exe does not list a version

Anything else I need to check?

@Maximus5
Copy link
Owner

@Maximus5 Maximus5 commented Jul 27, 2017

Version of the connector of course. It's the only significant thing.

@BladeMF
Copy link

@BladeMF BladeMF commented Jul 27, 2017

Ok, how do I get this version if it is downloaded by bat file? It is the wsl-bridge.exe, right? I could just try overwrite the two files (wslbridge-backend and wslbridge.exe) from the 0.2.2 version (as I have Ubuntu 16)

@Maximus5
Copy link
Owner

@Maximus5 Maximus5 commented Jul 27, 2017

As I said above:

New version is bundled with ConEmu.

Did you downloaded Pack or Installer? Doesn't matter. Proper and latest connector's binaries are located in the folder with ConEmuC.exe.
Of course, connector requires proper cygwin1.dll, msys-2.0.dll, etc.
wslbridge.exe and wslbridge-backend are required too, and they requires proper cygwin1.dll, msys-2.0.dll, etc.

Batch file wsl-con.cmd is obsolete, if was created earlier to demonstrate the ability.

@BladeMF
Copy link

@BladeMF BladeMF commented Jul 27, 2017

Okay, here is what I did:

  • Downloaded wsltty (installed it), got cygwin1.dll, wslbridge.exe and wslbridge-backend from there
  • Copied conemu-cyg-64.exe from the ConEmuC folder
  • Created a new task with these parameters:
    COMMAND: "C:\Program Files\ConEmu\conemu-cyg-64.exe" "/cygdrive/c/Program Files/ConEmu/wslbridge.exe" -cur_console:pn
    PARAMETERS: -icon "%USERPROFILE%\AppData\Local\lxss\bash.ico"
  • Ran the task and created a new console.

It still does not work. Ctrl+Space just types spaces. When I tried running Mintty (presumably using the same files), it does not have the same problem with Ctrl+Space.

@Maximus5
Copy link
Owner

@Maximus5 Maximus5 commented Jul 27, 2017

  1. What does "C:\Program Files\ConEmu\conemu-cyg-64.exe" --version print?
  2. What does "Terminal modes" status bar column show when you run connector+wslbridge?
@BladeMF
Copy link

@BladeMF BladeMF commented Jul 27, 2017

  • ConEmu cygwin/msys connector version 1.0
  • XTerm + AppKeys
@Maximus5
Copy link
Owner

@Maximus5 Maximus5 commented Jul 27, 2017

I see now. You need version 1.1. But it was but released as binary. Sources only yet.

@BladeMF
Copy link

@BladeMF BladeMF commented Jul 27, 2017

Oh. Where should I check for binary when it is released?

@BladeMF
Copy link

@BladeMF BladeMF commented Jul 27, 2017

Or you need to build it?

@Maximus5
Copy link
Owner

@Maximus5 Maximus5 commented Jul 27, 2017

In the ConEmu distribution.

@Maximus5
Copy link
Owner

@Maximus5 Maximus5 commented Jul 27, 2017

Next alpha build.

@BladeMF
Copy link

@BladeMF BladeMF commented Jul 27, 2017

Perfect! Will that solve the mouse events in MC also?

@Maximus5 Maximus5 closed this Sep 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.