Questions tagged [unicode]

Question about using Unicode character set, how to insert them, how to display them and general use of the UTF8 encoding.

From :h unicode

The Unicode character set was designed to include all characters from other character sets. Therefore it is possible to write text in any language using Unicode (with a few rarely used languages excluded). And it's mostly possible to mix these languages in one file, which is impossible with other encodings.

Unicode can be encoded in several ways. The most popular one is UTF-8, which uses one or more bytes for each character and is backwards compatible with ASCII. On MS-Windows UTF-16 is also used (previously UCS-2), which uses 16-bit words. Vim can support all of these encodings, but always uses UTF-8 internally.

Vim has comprehensive UTF-8 support. It works well in:

  • xterm with utf-8 support enabled
  • Athena, Motif and GTK GUI
  • MS-Windows GUI
  • several other platforms

Double-width characters are supported. This works best with 'guifontwide' or 'guifontset'. When using only 'guifont' the wide characters are drawn in the normal width and a space to fill the gap. Note that the 'guifontset' option is no longer relevant in the GTK+ 2 GUI.

81 questions
9
votes
2 answers

Vim does not take umlauts as word characters

When I write a German text containing something like abücd for instance and to a dw in front, it will only delete the ab since it does not interpret ü as a word character. When I edit reStructuredText, I…
Martin Ueding
  • 305
  • 1
  • 7
5
votes
1 answer

(How) can I convert full-width characters to half-width ones?

I need to transform the full-width characters(NBA) in the following sentence to half-width ones. NBA中曾有“怒吼天尊”之称的已退役球员是谁? 拉希德·华莱士 H5N2疫苗可对抗H5禽流感病毒 I know I can realize it in Python using unicodedata.normalize module(with a parameter "NFKC").…
Lerner Zhang
  • 740
  • 7
  • 19
4
votes
1 answer

How to use a UTF8 character as part of the iskeyword setting?

I would like to be able to add the ’ character to iskeyword setting. I'm currently using this: " Count ’ as a part of words like I’m and you’re¬ au FileType plaintex,context,tex,latex,mail,markdown,textile,text set iskeyword+=’ Unfortunately, I'm…
Aaron Massey
  • 171
  • 8
3
votes
1 answer

Displaying terms as single character unicode symbols in VIM?

Does VIM have a way to show symbols as characters? So lambda can be displayed as λ (yet keep its underlying ascii text) for example. Something like emacs pretty-symbols
ideasman42
  • 3,733
  • 3
  • 27
  • 34
2
votes
0 answers

Editing files containing Devanagari script

Editing files containing Devanagari script (or other Indian scripts) in vim doesn't work out of the box. I have not found a satisfactory solution for it yet and would like to hear if anybody else has.
muk.li
  • 449
  • 3
  • 8
2
votes
1 answer

Digraph for the "bullet" (8226 hex 2022)

I am looking for a digraph to enter the bullet symbol • (Unicode 8226, hex 2022), but it seems there is none. So, in absence of such a digraph, is there an alternative way to enter the bullet easily?
René Nyffenegger
  • 2,105
  • 20
  • 36
2
votes
0 answers

Can vim handle unicode line and paragraph separators?

Line endings differ between platforms; LF on unix, CRLF on windows, CR on Mac OS Classic. Unicode introduced LS (Line separator, U+2028) and PS (Paragraph separator, U+2029), as unambiguous alternatives to platform-defined line endings. Vim can…
Andrew
  • 393
  • 2
  • 10
1
vote
0 answers

Open file with Esperanto characters `Ĝ` and `ĝ` in gVim

I have an Autohotkey script to write Esperanto characters. It has the form AppsKey & G:: if GetKeyState("Shift", "P") send Ĝ else send ĝ return Notepad has no problem with opening it in a way that shows both Ĝ and ĝ. On the…
Christian
  • 131
  • 4
1
vote
1 answer

How to type math multipliction symbol (×) in insert mode?

The Unicode value of multiplication sign (×) is 00d7. I can insert it using the key sequence: Ctrl-vu00d7. I want another way to generate it. In the webpage: Typing Vim math symbols in insert mode. indicates that we can input the division sign (÷)…
newview
  • 291
  • 1
  • 7
1
vote
1 answer

Use unicode string to replace cjk characters

Create a sample text for testing. cat > sample.txt << EOF i and 你 EOF Open sample.txt in vim,the cjk character 你 in unicode is 4f60, %s/\%u4f60/you/g %s/你/you/g # you can use it also It can replace 你 with you,it turn out to be i and you,i…
showkey
  • 1,130
  • 2
  • 11
  • 30
1
vote
1 answer

Vim plugin for making source code pretty using unicode

A few months ago, someone in a programming class showed me a vim plugin he found that used Unicode to make source code "look pretty." I remember, specifically, that one of the things it did was make HTML comments () joined and look like…
0
votes
1 answer

Can I specify the encoding of a sourced file?

When vim sources a file (vimrc, or :so ...), how does it know in what encoding the file was written? Can I specify the encoding with which it should source the file?
René Nyffenegger
  • 2,105
  • 20
  • 36
0
votes
2 answers

Greek beta code conversion within (n)vim

I would like to be able to use Greek Beta Code in vim so that I do not need to keep changing keyboard layouts while typing a mixture of Greek text, LaTeX commands, and vim normal-mode commands. Is there some way to do this in insert mode --- and/or…
Alex Roberts
  • 307
  • 1
  • 8
0
votes
0 answers

Why does vim/neovim show the zero width space as <200b>?

When I copy a zero width space into vim, it is displayed as <200b>, instead of it being invisible: I've tried this in multiple terminal emulators and in both vim and neovim, and the character is always shown this way. Why is this? Is it possible to…
videbar
  • 13
  • 3
0
votes
1 answer

Detect when at last character when character is multibyte

I have the following command for \ that jumps to the last character unless the cursor is under the last character, in which case it jumps to the start of the line. nnoremap \ ((col(".") >= col("$")-1) ? "^" : "$") It works great…
Greg Nisbet
  • 1,839
  • 14
  • 27