sponsor Vim development Vim logo Vim Book Ad

unicode.vim : Various enhancements for using unicode and digraphs with Vim

 script karma  Rating 34/15, Downloaded by 7548  Comments, bugs, improvements  Vim wiki

created by
Christian Brabandt
 
script type
utility
 
description
Basically, this plugin serves 3 purposes:

1. Complete Characters

A custom completion function is available to complete characters using their Unicode name or Codepoint. If a digraph exists for that character, it will be displayed in paranthesis. Press Ctrl-X Ctrl-Z to trigger this completion from insert mode. Also a new custom completion for digraph chars is available. Press Ctrl-X Ctrl-G to trigger this completion. It will display all digraphs, that are reachable from the previous typed letter.

2. Identify Characters

The :UnicodeName command can be used to identify the character under the cursor. This works similar to the builtin ga command (in fact, the help also states a possibility to map this command to the ga builtin command), but it also displays the digraph character (if it exists) and the HTML entity.
The :SearchUnicode command can be used to search in the unicode character table to search for a certain unicode character with a given name or value.
The :UnicodeTable can be used to generate an Unicode table, including HTML entity names and Digraph chars. The UnicodeTable will be nicely syntax highlighted.

3. Ease the use of Digraphs

Use the :Digraphs command to search for an digraph with the given name (e.g. :Digraphs copy will display all digraphs that will create a character name which contains copy in its name). You can also search for the decimal value. This plugin also maps the key <F4> that will allow to transform 2 given normal chars into their digraph char.

For a screenshot, see: https://chrisbra.github.io/vim-screencasts/unicode-screencast.gif
Note: the development version of this plugin is available at github: https://github.com/chrisbra/unicode.vim

Here is a short overview of the functionality provided by the plugin:

Ex commands:
    :Digraphs        - Search for specific digraph char
    :SearchUnicode   - Search for specific unicode char
    :UnicodeName     - Identify character under cursor (like ga command)
    :UnicodeTable    - Print Unicode Table in new window
    :DownloadUnicode - Download (or update) Unicode data

Normal mode commands:
    <C-X><C-G>  - Complete Digraph char
    <C-X><C-Z>  - Complete Unicode char
    <F4>        - Combine characters into digraphs

Scripting Functions:
    unicode#FindUnicodeBy() - Find unicode characters
    unicode#FindDigraphBy() - Find Digraph char
    unicode#Digraph()       - Returns digraph char
    unicode#UnicodeName()   - Identifies unicode character (by value)
 
install details
simply source the file and the plugin will be installed automatically
:e unicode-<nr>.vmb
:so %

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

Alternatively, use the plugin manager of your choice.
 

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.vim-0.21.vmb 21 2017-09-27 7.4 Christian Brabandt This is release 0.21
(automatically uploaded)
unicode-0.20.vmb 20 2015-01-15 7.4 Christian Brabandt - unicode#Digraph expects a 2 char string
- Install a QuitPre autocommand for :UnicodeTable
- Make :Digraphs! output the digraph name
(automatically uploaded)
unicode-0.19.vmb 19 2014-04-16 7.4 Christian Brabandt - |:UnicodeName| shows all digraphs per character
- |:UnicodeName| shows decimal value for glyph
- |:SearchUnicode| search unicode character by name or value
- Make functions publicly available (|unicode#Digraphs()|, |unicode#Digraph()|, |unicode#FindUnicodeBy()|, |unicode#UnicodeName()|)
- cache UnicodeData.txt file in VimL dictionary format (so reading will be faster)
- Performance tuning, more comments, better error handling
- All configuration variables have a common g:Unicode... prefix
- document |<Plug>(UnicodeGA)|
- Always display digraph char when completing unicode char (and a digraph is available).
- Unicode completion always available using <C-X><C-Z>
- Therefore removed |:EnableUnicodeCompletion| and |:DisableUnicodeCompletion| commands
- too slow unicode completions will be stopped after 2 seconds
- fix annoying new line bug, when using digraph generation in visual mode
- new command |:UnicodeTable|
- new command |:DownloadUnicode| (including syntax highlighting)
(automatically uploaded)
unicode-0.18.vmb 18 2014-03-27 7.4 Christian Brabandt - include mapping for easier digraph generation
- fix wrong display of :Digraphs 57344
- |:Digraphs| can also search for unicode name
(automatically uploaded)
unicode-0.17.vmb 17 2013-08-15 7.3 Christian Brabandt - disable preview window (for completing unicode chars) by default, can be enabled by setting the variable g:UnicodeShowPreviewWindow (patch by Marcin Szamotulski, thanks!)
(automatically uploaded)
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: 142.132.191.50

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.
   
Vim at Github