37

How do I enter Unicode characters like without copying it to the clipboard and pasting it?

Things I know:

  • The command ga on the character gives me hex:0001d4ed.
  • I can copy it on the clipboard and paste it via "+p.
  • I know how to enter Unicode values that have a 4 digit hex code:
    <C-v>u for example <C-v>u03b1 gives the α character.
Micha Wiedenmann
  • 19,979
  • 21
  • 92
  • 137
epsilonhalbe
  • 15,637
  • 5
  • 46
  • 74

3 Answers3

50

You can use <C-v>U, that is, an uppercase u, to input an 8 digit hex codepoint character.

More information here and here.

Eduardo Ivanec
  • 11,668
  • 2
  • 39
  • 42
  • 1
    you're so fast - I can't accept it yet. ;-) thank you - I completely overread the `U` in the first link you gave me, when I read it first. – epsilonhalbe Feb 02 '12 at 20:54
12

There is a Vim feature designed to simplify entering characters that cannot be typed directly. It is called Digraphs (see :help digraphs).

To define a custom digraph for entering ‘’, use an Ex command similar to the one below.

:dig dd 120045

where 120045 is the decimal representation of ‘’, as one can easily confirm using the ga command.

Inserting a character using a digraph is simple: Type Ctrl+K followed by the shortcut of that digraph (dd for the above example).

ib.
  • 27,830
  • 11
  • 80
  • 100
  • defining a global digraph - sounds a bit overkill to me I only have to insert the character once or twice and then have a `imap \curld ` in a tex-plugin to use it just with latex - in other places I don't need it and digraphs I can enter via the keyboard-compose key (I use the neo-keyboard-layout). – epsilonhalbe Feb 03 '12 at 11:35
  • @epsilonhalbe: Yeah, that is a fine approach, too. – ib. Feb 21 '20 at 02:41
6

There exists a Unicode plugin for Vim. According to the plugin description, this plugin has three main features:

  1. Character/digraph completion using either the Unicode name or the codepoint.
  2. Identify the character/digraph under the cursor.
  3. Search for digraphs by name; transform two normal characters into their corresponding digraph.
shoover
  • 3,071
  • 1
  • 29
  • 40
epsilonhalbe
  • 15,637
  • 5
  • 46
  • 74