justinmk / vim-sneak

The missing motion for Vim :athletic_shoe:
http://www.vim.org/scripts/script.php?script_id=4809
MIT License
3.26k stars 88 forks source link

jump to chinese character base on its Pinyin #267

Closed jdhao closed 2 years ago

jdhao commented 3 years ago

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:

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

draftman9 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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. https://github.com/easymotion/vim-easymotion/pull/455

jdhao commented 2 years ago

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

justinmk commented 2 years ago

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.