Gvim on Windows 7: ALT codes not working

Posted by John Sonderson on Super User See other posts from Super User or by John Sonderson
Published on 2013-10-31T14:26:18Z Indexed on 2013/11/02 15:56 UTC
Read the original article Hit count: 325

Filed under:
|
|

I would like to be able to enter ALT codes in Gvim on Windows 7 as documented on the following site:

Alt Codes

On Windows (Windows 7 in my case), to generate a character via an ALT code you make sure that the NumLock key on your keypad is toggled on, hold down the ALT key, enter the keycode on the numeric keypad, and then release the ALT key.

However this does not work in Gvim on Windows (which ignores the fact that I am pressing the ALT key and just prints to entered keypad key directly onto the screen). How can I get these keystroke combinations to work in Gvim as well? Thanks.


EDIT:

As the answer below points out, the way to insert non-ASCII characters for which you do not have entries on your keyboard without changing the keyboard layout is as follows:

Make sure you are in insert mode, and then type CTRL-V followed by the Unicode character code of interest, for instance:

CTRL-V u00E0    (generates à)
CTRL-V u00C8    (generates È)
CTRL-V u00E8    (generates è)
CTRL-V u00E9    (generates é)
CTRL-V u00EC    (generates ì)
CTRL-V u00F2    (generates ò)
etc...

See for instance http://unicode-table.com/ for a full list of Unicode character codes.

The following list of Unicode characters by language may also be useful:

http://en.wikipedia.org/wiki/List_of_Unicode_characters

In some cases such as this one, though, there might be an easier way to enter special characters (see :help digraphs and :digraphs). For example, while in insert mode you may be able to type the following:

CTRL-K E! (yields É)
CTRL-K a' (yields á)

Note that as the following page shows: http://code.google.com/p/vim/source/browse/runtime/doc/digraph.txt Gvim 7.4 contains an even wider set of default digraphs than Gvim 7.3, thus providing convenience to an even broader set of languages.

Regards.

© Super User or respective owner

Related posts about gvim

Related posts about keys