JohnBeckett (talk | contribs) (Reword tip; explain usage; add see also; fix a couple of quirks in code and update to Vim 7; remove delete/review) |
Carpetsmoker (talk | contribs) m (→See also: link to Entering special characters) |
||
Line 44: | Line 44: | ||
==See also== |
==See also== |
||
+ | *[[Entering special characters]] |
||
*[http://www.clarkson.edu/~maxi/unicode.gif A screen shot showing output from the script] |
*[http://www.clarkson.edu/~maxi/unicode.gif A screen shot showing output from the script] |
||
*[[wikipedia:List_of_Unicode_characters|List of Unicode characters (Wikipedia)]] |
*[[wikipedia:List_of_Unicode_characters|List of Unicode characters (Wikipedia)]] |
Revision as of 13:38, 19 April 2008
Tip 576 Printable Monobook Previous Next
created October 5, 2003 · complexity basic · author maxiangjiang · version 7.0
This function generates a table of Unicode characters in Vim so you can see how they are displayed by your system. This may be of interest to anyone using CJK characters.
Example The following will add a table showing the characters from hex 9900 to hex 9fff, inclusive:
:call GenerateUnicode(0x9900, 0x9fff)
For this to work, you will need:
:set guifont=* "select a suitable font :set encoding=utf-8 "set a suitable encoding :set ambiwidth=double "for CJK characters
If you copy the following into a file, you can type :so % (source current file) to define the function.
function! GenerateUnicode(first, last) let i = a:first while i <= a:last if (i%256 == 0) $put ='----------------------------------------------------' $put =' 0 1 2 3 4 5 6 7 8 9 A B C D E F ' $put ='----------------------------------------------------' endif let c = printf('%04X ', i) for j in range(16) let c = c . nr2char(i) . ' ' let i += 1 endfor $put =c endwhile endfunction
See also
- Entering special characters
- A screen shot showing output from the script
- List of Unicode characters (Wikipedia)
- Charts of Unicode characters (Unicode Consortium)