July 2016

3456 789

Style Credit

Expand Cut Tags

No cut tags
Friday, November 11th, 2011 13:33

First thing. For those who use vim but might not have known about it: vim has a feature called digraphs which gives you a way to enter letters with diacritics (eg ä), symbols (eg ✓), and other characters that aren't on your keyboard. It does have its idiosyncracies, but it's fairly reasonable once you start to toy with it a bit.

How it works: first, enter the compose key, which by default is Control-K. Then enter the two characters of the digraph, and you'll get the single character that's defined in the digraphs table for that particular combination.

So, for instance:

  • Ctrl-K + o + -ō
  • Ctrl-K + e + :ë
  • Ctrl-K + c + ,ç
  • Ctrl-K + o + C
  • Ctrl-K + P + d£
  • Ctrl-K + 1 + 2½

The command :digraphs will show you everything in the digraphs table.

Last thing and the point of all that preparatory context above: there is a terrible problem with the set of digraphs as it ships with vim. Clearly the sequence < + 3 should compose to the character ♥, but it doesn't by default. To remedy this horrible shortcoming, add the line

digraph <3 9829

to your vim config file. (9829 is the unicode decimal identifier for the character ♥.)

Friday, November 11th, 2011 20:36 (UTC)
Ooooh this is a very cool post. Mind if I share with [community profile] command_liners?
Friday, November 11th, 2011 22:09 (UTC)

For all the years I've been using vi and (later) vim, it never ceases to impress (or even amaze) me all can be done with what I'd like to think is the most versatile and powerful programmer's text editor in existence. I'm actually using it to comment on this post with the w3m WEB browser.

Thank you for posting this and Happy Friday everybody!

Plain text is beautiful.
Saturday, November 12th, 2011 12:01 (UTC)
Wow, very importa- wait, actually, no. The last time I entered non-ASCII characters in vim was… oh, right, when I was writing that unit test for transliteration.

That's just "nice to have". Like that feature of TextMate, Emacs w/ an add-on and Sublime Text 2 when you can drag a file into the editor and it'll insert the appropriate snippet, like, dragging an image into html code = img src="that_image.png". Never actually used it.
Sunday, November 13th, 2011 14:23 (UTC)
No, I mean, I don't use vim for anything other than code.
Sunday, November 13th, 2011 22:06 (UTC)
I find digraphs slightly more intuitive than any other method of entering accented characters, such that I actually installed digraph support for Firefox, such that I can use digraphs in any firefox text area. Wööt!
Sunday, November 13th, 2011 23:09 (UTC)
I'm a terrible command-liner: I have itsalltext installed, but I usually use it to edit in geany. What kind of arguments do you use to launch vim in a terminal, anyway? Or are you browsing from a text-only browser already?
Monday, November 14th, 2011 04:05 (UTC)
I'm capable of using vim in a hunt and peck sort of way, but I'm pretty chary of it. But yeah, I use itsalltext on my linux boxes.