zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
47.02k stars 2.7k forks source link

I would like to improve the behavior of vim mode in CJK languages. #16813

Open yasainet opened 3 weeks ago

yasainet commented 3 weeks ago

Check for existing issues

Describe the feature

I am Japanese and a zed enthusiast! I love zed's UI, Design, UX, etc.

However, there are some problems with the CJK language support.

  1. terminal does not allow proper input of CJK languages (this is a separate issue, so I won't go into it here)
  2. vim mode does not support CJK languages well.

Here, we would like to express our hope for vim mode's support for CJK languages.

Switching mode

Behavior considering IME switching

Gaze shifting

CleanShot 2024-08-25 at 08 35 44

If applicable, add mockups / screenshots to help present your vision of the feature

No response

ConradIrwin commented 2 weeks ago

@yasainet @huacnlee and I were talking about this in #16278. Would the solution described there of a setting:

{"vim": {
  "normal_keyboard_layout": "com.apple.keylayout.US"
}}

work for you? That way whenever you are in normal mode, the keyboard is a QWERTY keyboard, but when you are in insert mode it restores your previous keyboard layout.

huacnlee commented 2 weeks ago

I can do a test later. Do I just run that PR code with this setting?

huacnlee commented 2 weeks ago

Actually in VIM and VS Code with Vim extension, the IME is not auto switch to English keyword when we at the Normal Mode.

Yes, They will go to Insert Mode, when I press i, but that not a good experience, the first i will break the next input, that IME not going to continue get other words.

https://github.com/user-attachments/assets/766f8218-c91a-481b-8597-ddc6558a9a5f

So, I usually switch the IME by myself.


@ConradIrwin I have tested that setting in Zed Preview 0.150.4, it is no effect. The IME is still in Chinese in Normal Mode.

huacnlee commented 2 weeks ago

https://github.com/user-attachments/assets/c5a746ae-caea-47f3-8bc4-664e9ab26797

yasainet commented 2 weeks ago

Is there a normal_keyboard_layout configuration item in Zed? I tried to find the source code but I could not find it.

I don't know the details, but on Mac there are US, ABC input sources by default, and I have ABC. Both can be set from the English preferences.

ConradIrwin commented 2 weeks ago

@yasainet this does not yet exist. It was an idea we were thinking about.

It looks like instead we might try to make this "just work" as described here: #17031.

yasainet commented 2 weeks ago

@ConradIrwin Thank you very much! I don't understand English so I read and write using translation software. Sorry for asking questions without understanding the fine nuances.

I will also check the page you presented!