helix-editor / helix

A post-modern modal text editor.
https://helix-editor.com
Mozilla Public License 2.0
33.24k stars 2.47k forks source link

Digraphs and Unicode input tools #1438

Open Anderssorby opened 2 years ago

Anderssorby commented 2 years ago

In vim you can input some unicode characters by pressing Ctrl + k in insert mode and then typing to chars like *l for λ. There are other ways to, but this is very convenient and customizable.

A-Walrus commented 2 years ago

How should this work? Should the typed characters appear in the buffer, and then be replace by the Unicode character (this is how it works in vim), or should they appear at the bottom of the screen (where numbers appear before an action)? Also what should the default keyboard shortcut be (Ctrl + k is already used)?

a12l commented 1 year ago

Another nice way to insert unicode symbols is how Emacs' input methods work. E.g. if I've the Agda input method active in the current Emacs buffer I can write the TeX command for a symbol, and the literal (i.e. the symbol) TeX command symbol get replaced with the unicode char it corresponds to. It's very nice when you write some more math heavy texts.

Anderssorby commented 1 year ago

Another option which would be more helix-y would be to do a text search for unicode symbols.

imuli commented 1 year ago

So we have four columns for a text search - the unicode code point (for #4216), the literal character (escaped for control chars or modifiers), compose sequences (for this issue), and a description of the character (e.g. column 2 or 11 of UnicodeData.txt). For example:

0009  <TAB>  HT  Character Tabulation
00fe  þ      th  Latin Small Letter Thorn
093f  ि     *i  Devanagari Vowel Sign I
estin commented 1 year ago

imho. it's custom snippets + multi language server feature.

I was trying implements snippets for my words completion language server https://github.com/estin/simple-completion-language-server

And found that language server with snippets support may be useful for this goals Each input must be separate by space to process them as words, this behavior may be fixed.

https://github.com/helix-editor/helix/assets/520814/ed177572-a111-4702-9a91-3cdb9bbe2e40

jakobjpeters commented 1 year ago

Another option which would be more helix-y would be to do a text search for unicode symbols.

I like this way of doing it

Unicode input is very important to a package I'm writing, so I really hope this feature is implemented.

EDIT: typo

bound-variable commented 1 year ago

Or how about US-ASCII codes for the character separators:

1c  FS  ␜  ^\  File Separator
1d  GS  ␝  ^]  Group Separator
1e  RS  ␞  ^^  Record Separator
1f  US  ␟  ^_  Unit Separator

In vim and bash we can use ctrl-v + ctrl-^ for example to enter a "record separator" and bash will display ^^ for that.

Would be nice with csv files.

jakobjpeters commented 1 year ago

I am a a bit concerned about basing it on a US standard, given that their are non-US countries and the US doesn't have a great track record cough imperial units cough. However, I am from the US and am not knowledgeable on what standards are out there. Is US-ASCII the standard internationally or are their competing ideas? If it is indeed an internationally used standard, my concern above is not relevant.

trzza commented 1 year ago

Another option which would be more helix-y would be to do a text search for unicode symbols.

I like this way of doing it

Unicode input is very important to a package I'm writing, so I really hope this feature is implemented.

EDIT: typo

Kitty terminal implements this very nicely and does feel more helix-y

chtenb commented 1 year ago

I think it is more powerful to put this functionality in the terminal emulator, or even better, in the OS level. Using WinCompose/XCompose you can handle unicode keyboard input pretty well, and this carries over to all other applications automatically. Keeping it confined to a (single) text editor is quite restrictive, though it may be useful for some language specific control.

SeSodesa commented 2 months ago

Something like this would be very useful, as languages like Julia and Lean both allow the use of Unicode characters in identifiers. The Julia language extension for Vim (https://github.com/JuliaEditorSupport/julia-vim) has addressed this by allowing tab-completions of LaTe\Chi-like strings in insert mode, and I believe Lean does something similar, although their tab-completion table is not based on LaTeX.

I believe such a "macro system" would be the most ergonomic way of typing Unicode characters. The backslash key is probably not the most ergonomic modifier key, though.