sponsor Vim development Vim logo Vim Book Ad

unicode.vim : A Completion function for Unicode glyphs

 script karma  Rating 8/5, Downloaded by 1131    Comments, bugs, improvements  Vim wiki

created by
Christian Brabandt
 
script type
utility
 
description
Basically, this plugin serves 3 purposes:
1) it provides the possibility to complete characters using their Unicode Name or the Unicode Codepoint
2) It can be used to identify the character under the Cursor using the :UnicodeName command
3) It eases the use of digraphs, by providing the :Digraphs command (so one can more easily find a specific digraph).

For a screenshot, see: http://www.256bit.org/~chrisbra/vim_unicode.png


                                                              *unicode-plugin*
1. Functionality

This plugin was written to enable an easier use of any Unicode glyph
available. The unicode.vim Plugin uses the data available from the Unicode
Consortium's website (http://www.unicode.org) to let you enter Unicode
characters using a completion function.

By default, the plugin creates a directory unicode below the path autoload
where this plugin is located. Within this directory it will store  the file
Index.txt from http://www.unicode.org/Public/UNIDATA/Index.txt which it will
try to download using *netrw* . If this is unsuccessfull, or you do not have
|netrw| enabled, dowload the file manually and save it in the unicode
directory below the autoload directory in which unicode.vim is located.


*:EnableUnicodeCompletion*
By default the plugin is not enabled. To enable it enter
:EnableUnicodeCompletion
When you run this command, *unicode.vim* checks for the availability of
Index.txt from the Unicode Consortium, and if it is not available, it will try
to download it.

This will also set up the completion function |completefunc| to use for your
buffer. You can use |i_CTRL-X_CTRL-U| then to start the completion.

*:DisableUnicodeCompletion*
If you want to disable the plugin, enter
:DisableUnicodeCompletion

    *unicode-plugin-usage*
If you have enabled the plugin using |:EnableUnicodeCompletion| then there are
2 possibilities to use the plugin. You can either enter the Unicode Character
name, or enter the Unicode-Codeposition.

For example, you would like to enter Æ, so you enter AE and press <C-X><C-U>
while in insert mode. Alternatively you can enter the Unicode-Codepoint: U+C6
and press <C-X><C-U> and the popup menu will show you all characters, that
have a codepoint like C6 with leading zeros, eg. U+00C6 and U+0C66

A popup menu will appear, showing you the Unicode-Codeposition value, the
Unicode Character Name and the Unicode Character (and if you have enabled it,
it can also show you the digraph characters needed to create this character in
paranthesis, see |unicode-plugin-config| ). You can scroll down in the menu by
pressing <C-N> and up by pressing <C-P>.


    *unicode-plugin-config*
The plugin can be customized to include the 2 digraph characters you have to
type, to get that character. This works only, if there is a digraph defined
for that Unicode char. If you would like this you need to set
g:showDigraphCode, e.g.
:let g:showDigraphCode=1
This functionality is by default disabled, cause it seems to cause some delay
and screen-rendering errors in the menu. Enter
:let g:showDigraphCode=0
to disable the Digraph feature afterwards.

If you would like to specify a different URL from which to download Index.txt,
enter the URL as:
:let g:unicode_URL='http:....'
To force downloading the file from that new url, enter
:call unicode#CheckUniFile(1)

     *unicode-plugin-error*
If the plugin gives an error, first check, that Index.txt from the Unicode
Consortium has been successfully downloaded. It should look something like
this:
A WITH ACUTE, LATIN CAPITAL LETTER 00C1
A WITH ACUTE, LATIN SMALL LETTER 00E1
A WITH BREVE, LATIN SMALL LETTER 0103
A WITH CARON, LATIN SMALL LETTER 01CE
A WITH CIRCUMFLEX, LATIN CAPITAL LETTER 00C2
A WITH CIRCUMFLEX, LATIN SMALL LETTER 00E2
A WITH DIAERESIS, LATIN CAPITAL LETTER 00C4
A WITH DIAERESIS, LATIN SMALL LETTER 00E4
A WITH DOT ABOVE, LATIN SMALL LETTER 0227
A WITH DOT BELOW, LATIN SMALL LETTER 1EA1
A WITH DOUBLE GRAVE, LATIN SMALL LETTER 0201
A WITH GRAVE, LATIN CAPITAL LETTER 00C0
[...]
(several thounsand lines following)

elinks is known to mangle that file and make it unusable, so please check
first if the format is right.

If the file looks correct, and the plugin is still not working correctly
contact the maintainer. You'll find his email-adress in the first line of this
document. Please be patient, it might take a while, until I can take care of
your report.
 
install details
simply source the file and the plugin will be installed automatically
:e unicode.vba
:so %

And afterwards, have a look at the documentation: :h unicode.txt
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
unicode-0.16.vmb 16 2013-02-16 7.3 Christian Brabandt :UnicodeName returns html entity, if possible
(automatically uploaded)
unicode-0.15.vmb 15 2013-02-05 7.3 Christian Brabandt - make sure, the returned digraphs list is not empty.
(automatically uploaded)
unicode-0.14.vmb 14 2012-12-01 7.3 Christian Brabandt Added command :Digraphs for better output of digraphs
(automatically uploaded)
unicode-0.13.vmb 13 2012-09-08 7.3 Christian Brabandt - better output for |UnicodeName| (did previously hide messages)
(automatically uploaded)
unicode-0.12.vmb 12 2012-04-12 7.3 Christian Brabandt - UnicodeName shows digraph, if it exists
- better completion of digraphs
(automatically uploaded)
unicode-0.10.vmb 10 2011-12-15 7.3 Christian Brabandt - enable completing of only the names
- Really disable the 'completefunc' when disabling the function
unicode-0.9.vba 9 2011-07-20 7.3 Christian Brabandt :UnicodeName checks for existence of UnicodeData.txt
:UnicodeName now also detects combined chars
:UnicodeName now also outputs control chars
(automatically uploaded)
unicode.vba 0.8 2010-09-30 7.3 Christian Brabandt New Release
- Fix an issue with configuring the plugin (Thanks jgm)
- Code cleanup
- Make use of the preview window, when completing
  Digraph or Unicode Glyphs
- By default, the Digraph Glyphs will now be enabled
  using |i_Ctrl-X_CTRL-G| instead of using
  Ctrl-X_Ctrl-C which wouldn't work in a terminal
- |:UnicodeName| now displays the hexadecimal Unicode
  Codepoint instead of the decimal one (as this seems
  to be the official way to display unicode
  codepoints).
unicode.vba 0.7 2010-09-23 7.3 Christian Brabandt
- Determine the Name of a Character using :UnicodeName
- the global variable g:enableUnicodeCompletion determines, whether the completion will be loaded automatically
unicode-0.6.vba 0.6 2010-08-26 7.2 Christian Brabandt - many small bugfixes with regard to error-handling and error displaying
- use default netrw_http_cmd (instead of hardwiring wget)
- small documentation update (Inlude a snippet of UnicodeData.txt and get rid of Index.txt data)
unicode.vba 0.5 2010-04-19 7.0 Christian Brabandt New public repository at http://github.com/chrisbra/unicode.vim
unicode.vba 0.4 2010-02-01 7.0 Christian Brabandt Use UnicodeData.txt to generate Data
(Index.txt does not contain all glyphs).
Check for empty file UnicodeData.txt
unicode.vba 0.3 2009-10-26 7.0 Christian Brabandt Added digraph completion
unicode.vba 0.2 2009-10-22 7.0 Christian Brabandt Enabled GetLatestVimScripts
unicode.vba 0.1 2009-10-22 7.0 Christian Brabandt Initial upload
ip used for rating: 50.16.108.167

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo