mawww / kakoune

mawww's experiment for a better code editor
http://kakoune.org
The Unlicense
9.94k stars 716 forks source link

alt→ doesn't work in Terminal.app #997

Closed lilyball closed 7 years ago

lilyball commented 7 years ago

Pressing alt→ in Terminal.app instead behaves like alt-f. This is because the default keyboard mapping is \033f, which is apparently the same thing as alt-f. I'm not sure what the appropriate thing to do here is, beyond providing some other shortcut for the same behavior.

mawww commented 7 years ago

Yep, kakoune will interpret <esc>f as <a-f>, using a timeout to distinguish plain <esc> from <a-something>. I dont know what we can do there, its a terminal input limitation, eventual GUI will not have that problem.

lilyball commented 7 years ago

As I suggested, perhaps you should provide an alternative keyboard shortcut as a predefined alias. That way Terminal.app users don't all have to rebind it themselves.

lenormf commented 7 years ago

The keyboard is already pretty full as it is, there is not a lot of room for such configuration-dependant hacks.

pauldub commented 7 years ago

Also this is really a problem with Terminal.app handling of alt (also known as meta) which affects emacs users heavily for example. I do not think it is possible to setup Terminal.app to handle the alt key correctly in the same way as ITerm2.

edit: Looks like I was incorrect, the emacs wiki states that

If you are having problems using option as meta in the Terminal app, look in preferences, navigate to keyboard options (exactly where it is depends on OSX version), look for a checkbox “Use Option as Meta key”, check it, open a new Terminal, and voilà!

see https://www.emacswiki.org/emacs/MetaKeyProblems#toc15

lilyball commented 7 years ago

What you quoted is something different. Terminal.app lets you either use Option as the Meta key, or use it like it works in all other apps for entering text (e.g. ⌥e produces the ´ accent over the next key).

This is completely different than the problem I'm describing, which is the default keybinding of ⌥→ is the same as ⌥F. I'm guessing this keybinding exists the way it does so that way users pressing ⌥→ and ⌥← have their selection move by words in anything using conventional line editing (including shells). It's certainly possible for users to rebind this, but it's probably safe to assume that very few people have rebound those keys in Terminal.app.

rawaludin commented 7 years ago

I'm having same problem. Using iTerm2, alt+h not bring me to first character on line. Other key combination using alt is not working too.

Here is my iterm configuration

screen shot 2016-12-17 at 12 21 23 pm
casimir commented 7 years ago

I use this configuration (see left option key). That way the left alt key works <alt-h> and the right alt key allow international keyboard combination like <alt-e>e for é.

screen shot 2016-12-19 at 13 57 41
lenormf commented 7 years ago

@casimir maybe you could grab your configuration file (with the bindings in it), as create a PR that adds it to contrib ? As far as I know iterm2 is popular, so most mac users could just copy/paste the key combinations from your config.

casimir commented 7 years ago

Well, this is the default mapping, the only thing I did was checking a radio button (+Esc). Maybe an FAQ entry would help though.

lenormf commented 7 years ago

A FAQ entry would be good indeed.

lilyball commented 7 years ago

Again, whether option behaves as meta or as Mac-native option is completely unrelated to this PR.

mawww commented 7 years ago

So, If I did not miss anything, this is a duplicate of #1016.