Skip to content

Instantly share code, notes, and snippets.

@YumaInaura
Last active April 26, 2024 05:04
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YumaInaura/27bb1f79881a63bed2fb9635cbaed73b to your computer and use it in GitHub Desktop.
Save YumaInaura/27bb1f79881a63bed2fb9635cbaed73b to your computer and use it in GitHub Desktop.
Zsh — Mac OS option key for bindkey

Zsh — Mac OS option key for bindkey

Probably this is resolving of just binding as character.

Not related with like some escape sequences or special characters.

Example

In Mac OS bind Option + a

bindkey å accept-line

it is å not a.

How find?

With my keyboard setting when I pushed Option + a key then å appears. So I use this character directly as keybinding.

Others

Same way you can find other keys.

# 1234567890-^\
¡™£¢∞§¶•ªº–≠\

# qwertyuiop@[
œ∑´®†¥¨ˆøπ“‘

# asdfghjkl;:]
åß∂ƒ©˙∆˚¬…æ«

# zxcvbnm,./_
Ω≈ç√∫˜µ≤≥÷`

Not English bindkey works

I found now.

bindkey -s "日本語" "Japanese"

When input "日本語" then it will be replaced with "Japanese".

( Can you copy and paste "日本語" and it works? )

Versions

  • zsh 5.5.1 (x86_64-apple-darwin17.5.0)

Ref

Links

@laudai
Copy link

laudai commented Mar 19, 2023

Hi YumaInaura さん,

I had reproduced this issue you mentioned about in both in iTerm2, and the original terminal from MacOS.
It is interesting that have different result.

The iTerm2 will print the "Japanese" in the terminal, but this terminal will stuck/frozen and cannot type as usually.
Another test in terminal Application is that it show "日本語" instead of the "Japanese".

It is interesting.
I'm new in the MacOS just 2 month ago.

Before I use MacOS, I use this keybinding in Linux for clear all line text and send "exit" text to my gnome terminal.
bindkey -s '^[d' '^Uexit^M'

My test environment is:
MacOS: M1
MacOS veriosn: 12.6.3 Monterey
iTerm2: 3.4.19
Terminal Application: 2.12.7
Zsh: zsh 5.8.1 (x86_64-apple-darwin21.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment