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

jump to chinese character base on its Pinyin #267

Closed
jdhao opened this issue Nov 21, 2020 · 5 comments
Closed

jump to chinese character base on its Pinyin #267

jdhao opened this issue Nov 21, 2020 · 5 comments

Comments

@jdhao
Copy link

jdhao commented Nov 21, 2020

It would be great if we can also jump to Chinese characters using the first letter of its Pinyin, because if we use the Chinese character itself for jumping, we have to type several key strokes (which is usually the Pinyin of a Chinese character, of course, there are other ways, but pinyin is the most used way) to get the character.

A crude translation of the above English text:

如果能用汉字的拼音首字母来跳转到对应的汉字就更好了,因为如果我们直接使用汉字来搜索,我们必须先使用拼音打出这个汉字,这样有点繁琐,会导致我们需要敲击更多键盘。

Suppose we have the above Chinese texts and we want to jump to the Chinese words 汉语 (the corresponding pinyin is han yu), it would be great if we can type the sneak shortcut, and then press hy to jump to the position where words 汉语 exist.

Some thought on how this may be implemented:

  • Find the first alphabet of the pinyin for each Chinese character in the current buffer or viewport.
  • when the user provides the sneak character for the Chinese character using the first alphabet of its Pinyin, find the consecutive Chinese characters whose pinyin match the sneak character, bookmark their locations, and give them labels
  • Jump to a location when the user provides the sneak label.

A similar discussion about this feature for vim-easymotion is here.

@justinmk justinmk changed the title It would be great if we can also jump to chinese character base on its Pinyin jump to chinese character base on its Pinyin Jul 3, 2021
@draftman9
Copy link

BTY, this function has benn added yet? To achieve this function, what we have to do is just to add a map between about 7000 characters and 26 alphabets which can resolve most situations. It should not be too difficult.

@jdhao
Copy link
Author

jdhao commented Feb 22, 2022

I have tried to add the feature myself, but found the vim-sneak code hard to understand... So I haven't been able to do it myself... 😿

@draftman9
Copy link

I have tried to add the feature myself, but found the vim-sneak code hard to understand... So I haven't been able to do it myself... 😿

Maybe this can bring you a surprise. easymotion/vim-easymotion#455

@jdhao
Copy link
Author

jdhao commented Feb 26, 2022

@draftman9 Thanks for this info, but I have since switched to hop.nvim (yes, basically the same feature as vim-sneak).

@justinmk
Copy link
Owner

Vim or your OS input method should deal with this. Then whatever input sneak gets is simply mapped to your custom g:sneak#target_labels.

Adding explicit support into Sneak is out of scope.

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

No branches or pull requests

3 participants