Hacker News new | past | comments | ask | show | jobs | submit login
Uni: Query the Unicode database from the CLI, with good support for emojis (github.com/arp242)
111 points by oftenwrong on Dec 12, 2019 | hide | past | favorite | 29 comments



I really appreciate the section on alternatives¹, and I wish more people would add these to their projects. Not only does it show the author is aware of the current landscape, it may even help users to find tools that better fit their needs. Imagine a tip of my virtual hat, @Carpetsmoker!

From the README's notes on emoj "not a fan of npm (has 1862 dependencies)", I'm actually tempted to try that just to find out if it is true ;)

1. https://github.com/arp242/uni/blob/master/README.markdown#al...


And yet, among the alternatives, there is no mention of `unicode`, a standard-ish command line tool that does more or less the same thing and is available in common Linux distros since ~2005.

Example output (the CLI's output is colored):

    $ unicode €
    U+20AC EURO SIGN
    UTF-8: e2 82 ac UTF-16BE: 20ac Decimal: € Octal: \020254
    €
    Category: Sc (Symbol, Currency)
    Bidi: ET (European Number Terminator)

    $ unicode 
    U+1F30D EARTH GLOBE EUROPE-AFRICA
    UTF-8: f0 9f 8c 8d UTF-16BE: d83cdf0d Decimal: 🌍 Octal: \0371415
    
    Category: So (Symbol, Other)
    Bidi: ON (Other Neutrals)

    U+1F3E4 EUROPEAN POST OFFICE
    UTF-8: f0 9f 8f a4 UTF-16BE: d83cdfe4 Decimal: 🏤 Octal: \0371744
    
    Category: So (Symbol, Other)
    Bidi: ON (Other Neutrals)
I am not being sarcastic here. I am just noticing that the software landscape is vast, and that it is often hard to know what exists out there. Even old glories are forgotten.

There should be an interdisciplinary stackoverflow where you can ask: "does this already exist?"


I can't find that one in Void or Arch, but did find it in Debian[1]. I think this is the homepage[2] (Debian packages don't seem to have a clear field for this?) I'll add it to the list.

I mainly searched for "emoji" tools, as that's the real reason I wanted this, so I probably missed a zillion scripts. That list is by no means intended to be comprehensive.

[1]: https://packages.debian.org/buster/unicode

[2]: http://kassiopeia.juls.savba.sk/~garabik/software/unicode/


Looks like it might be this package in the AUR? https://aur.archlinux.org/packages/unicode/

Given that it's been around for 10 years though, it probably won't be promoted to the main repos


> There should be an interdisciplinary stackoverflow where you can ask: "does this already exist?"

https://alternativeto.net is not too bad, although it takes a while for new projects to appear and also sometimes when a tool does x and y and you're looking for an alternative for x, only alternatives for y are shown.


Yes, listing alternatives is a really good thing. Another alternative (not from me, just an user): https://github.com/NoraCodes/charpicker

It's just shell and rofi, and from an IDE can easily be hooked to a key combination. As it's shell, it's also easy to tweak if needed.

For those using X11, I found that xdotool used by charpicker has some limitation. From the xdotool man page: "Typing unusual symbols under non-us keybindings is known to occasionally send the wrong character.", and I've seen it happens with unicode characters. Instead, one can paste to the X11 clipboard:

   echo -n "$selected_symbol" | xclip -i
And then fake a middle click to insert in the current application:

  xdotool click 2
It's still using xdotool but just to send a click not process the inserted character. That's never failed for me so far.


Thanks :-)

> From the README's notes on emoj "not a fan of npm (has 1862 dependencies)", I'm actually tempted to try that just to find out if it is true ;)

That's the number "npm install" showed after it was done (which took quite a while too), so I assume it's accurate?


I use https://github.com/salty-horse/ibus-uniemoji to search emoji/unicode glyphs using the input. Works pretty well for me.


There's also a Perl script with the same name since 2009, written by Audrey Tang (of pugs fame) and then rewritten by Ricardo Signes (of Dist::Zilla fame). I've used this script for years, not realizing there were other implementations of it. Nice to know.

https://metacpan.org/pod/uni


Or any text box on Mac hit ctrl+cmd+space, start typing unicode names


Thanks! But doesn't go the other way.

And doesn't have an easy way to see the long unicode name afaics.


Mouseover on the emoji to see the unicode name.


I would love something like this for ibus


If you're willing to switch to a different input method, fcitx supports Unicode search: https://fcitx-im.org/wiki/Unicode

I mostly use it for trivial stuff like proper Unicode arrows → instead of ASCII ->, but I think it's pretty cool to have the option to type any Unicode character I want.


I use it but it always seems kinda "buggy" to select the desired char


Just mentioned in a comment myself: https://github.com/salty-horse/ibus-uniemoji


Or .. use vim Unicode

"Hover" to name.

Search is available, not live though


What are you meaning by “hover”? All I know of is ga (a.k.a. the misnamed :ascii), which tells you the decimal, hex and octal for the Unicode scalar values, but doesn’t give you a name.

Oh, are you meaning https://github.com/chrisbra/unicode.vim?


Uni started life as a replacement to that plugin (note how how the output is similar) as I got tired of opening Vim all the time :-)


Haha, thank you! (I am the author)


But it opens instantly! And zz to close


Not as "instant" as dmenu, the searching is kinda awkward and not emoji-aware, and you can't use it in pipes.


I am open for suggestions on how to make the search work better.


Ctrl-p like functionality wouldn't be too difficult... But I see your point


Yeah, you can do a lot with it. One of the (unstated) ideas behind uni is that it can work as a backend for a lot of different integrations: dmenu, Vim, fzf, Emacs, a more domain-specific emoji picker GUI, etc.

Other than this, the feature set is roughly similar. The biggest difference is that uni knows how to deal with emoji sequences.


Yes to chrisbra. Wish I could live search


fzf-vim's :BLines¹ can enable a live search for most basic needs. For example, something like unicode.vim's :UnicodeTable, followed by :BLines, then yl to grab the char.

Note: I'm only pointing this out in the general case of wanting a live search on some data, because uni and the provided uni.vim seem to be a far better solution anyway.

¹ https://github.com/junegunn/fzf.vim


what are you missing? Please use the issue tracker for discussions of better features.


Kitty has something like this built in too:

https://sw.kovidgoyal.net/kitty/kittens/unicode-input.html




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: