Tab completion for numeric codepoints

Hi, is there a way to get a Unicode character from its numeric code in the REPL (without resorting to copy and paste)?

I was trying to input the ace of each card suit (spade, heart, club, diamond) based on the codepoints: U+1f0a1, U+1f0b1, U+1f0c1, U+1f0d1. I can get the character with ‘\U1f0a1’ but typing \U1f0a1 and hitting Tab does not “complete” like it does for \spadesuit for example. And using ‘\U…’ then Enter then copy-paste is a bit annoying…

That’s the responsibility of your operating system’s input method, not Julia’s. For example, in Ubuntu, you can use ctrl+shift+U, then type the number, then return. There’s probably something similar for Mac & Windows.

Indeed! Thanks!

Note that in the REPL (and many Julia editors that have adopted the REPL’s tab completions), you can tab-complete \spadesuit etcetera for these characters.

The help mode will tell you that:

help?> ♠
"♠" can be typed by \spadesuit<tab>

Update: I see that you actually want 🂡 (U+1f0a1) etcetera, for which we don’t (yet) have a tab completion. You could add a tab completion via:

import REPL
push!(REPL.REPLCompletions.latex_symbols, "\\spadeace" => "\U1f0a1")

e.g. in your ~/.julia/config/startup.jl file.

(Or you could just type A\spadesuit<tab> to get A♠, which is a reasonable substitute for 🂡.)

1 Like

We could certainly add \U.... tab completion in the REPL, however! It’s an interesting feature idea.


Thanks for mentioning the push! solution, although so far I’ve only felt the need for such codes in one-off situations.

@tkluck’s solution works for me but I can see small benefits of having \U... completion in the REPL: more discoverable (for some users at least), and the Ctrl-Shift-U shortcut shows weird artefacts in some terminals (not Julia’s fault of course).

For some reason there are actually some numeric codepoints that can be expanded with the emoji syntax:


They appear to be Chinese characters: :u5272: :u55b6: :u6708: :u6e80: :u7533: :u7a7a: :u5408: :u6307: :u6709: :u7121: :u7981: