Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Maybe it’s time for a plugin that does this (or maybe it already exists?):

You press the backslash key, enter the name of the symbol, then press enter, and the symbol will show up in your buffer.

Something like:

\lambda -> λ

\Lambda -> Λ

\\ -> \

et cetra.




A dedicated global compose key solves this problem very elegantly. Hitting the ◆ compose key (right alt for me) followed by a series of intuitive characters inserts the corresponding character.

For example:

◆ - - - produces an em dash (—)

◆ - - . produces an en dash (–)

◆ ' e produces é

◆ | c produces the cent symbol (¢)

Usually, you can just guess the combination and be right 3/4 times. Otherwise, it's fairly easy to look it up, or create it if it doesn't exist yet.

Some distros of Linux have this built-in, but I use WinCompose[1] on Windows.

[1]https://github.com/samhocevar/wincompose


> Some distros of Linux have this built-in […]

Some? Nearly all of them do — usually it just needs to be activated in the desktop environment.

I used a … and an — in this post using the compose key without even thinking twice.

> Usually, you can just guess the combination and be right 3/4 times.

¾ even. Just guessing that it was <comp> 3 4.


macOS has something very similar with the option key, but the set of characters doesn’t include all Greek letters which is incredibly annoying: https://sites.psu.edu/symbolcodes/mac/codemac/


Except most of the key combinations are not intuitive. I could never guess them like I could with a compose key.


Relatively easy in Vim with digraphs (:h digraph)

Ctrl-K l* produces λ

Ctrl-K L* produces Λ

Unsurprisingly, Emacs also supports this when programming in Agda (\lambda) i'm not sure if it's a builtin feature or part of the Agda plugin.

In Agda using Unicode identifiers is widely accepted, even in the standard library: https://github.com/agda/agda-stdlib/blob/master/src/Relation...


Atom in Julia Pro does this (with autocomletion), and I've been using it in practice to clarify math in my code. It's great in practice.


Also works in the Julia REPL, and jupyter notebooks. I'd hope that the tooling for any language which allows unicode variable names would support this.


Emacs has this plugin (well not a plugin because it’s built in). One can select an input mode. Some translate directly (e.g. a Greek input mode where typing a gives an alpha). There is also a TeX mode like what you describe and another mode which is more concise (e.g. &a for alpha, where the means Greek). The difference from what you described is that instead of some escape sequence for these special prefixes, they are just never converted if they don’t match and you move the point away.



xcompose does something like that. (as does TeX for that matter, in a different fashion.)




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: