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

Alt key settings for macOS #344

Closed
AspieterPan opened this issue Dec 1, 2022 · 3 comments
Closed

Alt key settings for macOS #344

AspieterPan opened this issue Dec 1, 2022 · 3 comments
Labels
good-first-issue Good for newcomers keymap Keymap related issues platform:macos

Comments

@AspieterPan
Copy link

Neovim version

NVIM v0.8.1 Build type: Release

Operating system/version

macOS Ventura 13.0.1 (22A400)

Terminal name/version

iTerm2 Build 3.4.18

$TERM environment variable

xterm-256color

Branch info

main (Default/Latest)

Fetch Preferences

SSH (use_ssh = true)

How to reproduce the issue

使用 option 键相关的快捷键,没有任何反应 (使用的是MacBook Pro)
contrl 和 shift 相关的快捷键都可以正常使用

  1. 测试1: 具体使用的按键是 option + j/k 的切换buffer没有生效
  2. 测试2:在配置文件中,将按键改为或后,按下 option + h 没有反应,按下 <C+w> + h 成功切换窗口

Expected behavior

能够正常使用 option 键相关的快捷键

Actual behavior

No response

Additional information

No response

@AspieterPan AspieterPan added the bug Something isn't working label Dec 1, 2022
@Jint-lzxy
Copy link
Collaborator

Jint-lzxy commented Dec 1, 2022

By default, the <A-*> key doesn't work in any macOS terminal since all alt-related keys are mapped to the corresponding real character generated. For example (You can try typing these characters yourself!):

<A-g> --> ©
<A-S-p>(upper case `p`) --> ∏ 

There are two solutions, you may choose the one that suits you best 👍

  1. Map the Alt key to the corresponding output symbol (e.g., <A-g> --> ©), you may refer to my config for more information. Do note that you need to change two files: lua/keymap/init.lua and lua/core/mapping.lua.
  2. Looks like you are using iTerm2. Simply open "Preferences" (⌘,) --> Profiles (select your current profile) --> Keys --> General tab, and set the Left/Right Option key to Esc+. As shown: (Note: In this mode, the modified left/right option key can no longer be used to input symbols in the terminal)

iterm-opt

@Jint-lzxy Jint-lzxy added good-first-issue Good for newcomers keymap Keymap related issues platform:macos and removed bug Something isn't working labels Dec 1, 2022
@AspieterPan
Copy link
Author

我用了修改 iterm profile 的方法,现在可以正常使用了
非常感谢!

@ayamir
Copy link
Owner

ayamir commented Jun 18, 2024

For kitty user, set macos_option_as_alt yes in ~/.config/kitty/kitty.conf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good-first-issue Good for newcomers keymap Keymap related issues platform:macos
Projects
None yet
Development

No branches or pull requests

3 participants