Questions tagged [unicode]

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

Filter by
Sorted by
Tagged with
45
votes
1answer
10k views

See the Unicode code point of the current character

How can I see the Unicode code point of the character where the cursor is? For example, if my cursor is on a ⌘ character, I'd like Vim to tell me that it is U+2318. Alternative information, such as ...
41
votes
7answers
9k views

What is the easiest way to insert en dash in Vim?

To insert an en dash, I use ^v u 2014 which is seven keypresses. Is there an easier way? (I was looking at digraphs and didn't find en dash there.)
33
votes
5answers
9k views

What is the easiest way to insert Unicode characters into a document?

When writing documents occasionally I want to insert Unicode characters into the text. Sometimes I know the character code and sometimes I look it up on the web. Currently I go to insert mode and ...
25
votes
1answer
8k views

Can I search for a Unicode combining character in Vim?

I have a file with the character ã (lowercase a + combining tilde). Encoding and fileencoding are both utf-8. ga shows <a> 97, hex 61, octal 141 <~> 771, Hex 0303, Octal 1403 (but ...
23
votes
5answers
3k views

How do I keep accidentally creating a no break space before opening curly brace?

From time to time, let's say once a month, when I program, I introduce a No-Break space instead of a regular space, before opening a curly brace. This happens let's say when I'm writing () { This ...
13
votes
1answer
1k views

Can't map German 'umlaut' keys in .vimrc

I'm trying to find a way to map German umlaut keys (Ä,ä,Ö,ö,Ü,ü). A simple shortcut like this won't work: inoremap <c-ö> <Esc> Nothing happens when I hit ctrl+ö. Does anyone know a ...
12
votes
1answer
2k views

Not able to type Unicode with Gvim and VIM on Windows 7

I want to type in different languages using (g)Vim. But when I switch to another language using language bar (Devanagari or Hindi characters), and type anything, (g)vim displays ??? ??. What I tried:...
9
votes
1answer
6k views

What does CTRL-K do in insertion mode?

When I press ^K in my vim while I'm in insertion mode a '?' appears and then if I press a and then another character some strange characters appear the following are a few of the characters I could ...
9
votes
2answers
700 views

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 ...
8
votes
1answer
3k views

How to translate Unicode escape sequences to the Unicode character?

I have a file with a lot of characters represented like this: \u05E2. (These are the actual characters in the file: backslash, lowercase u, and four hexadecimal digits.) Due to that, the file is ...
7
votes
3answers
4k views

Can I write Japanese (SKK) text in Vim?

I need to be break it to you guys, I use emacs. But just for one little thing. Recently I've been working with a good deal of Japanese people (the company is Japanese) and I got some idea of the ...
6
votes
4answers
2k views

How can I get the character at the cursor position in a multibyte aware manner?

Consider the following line: € € This file is encoded in UTF-8 and between the two Euro marks is a Tab character (the Stack Exchange software expands this to spaces). The byte value is: e2 82 ac ...
6
votes
1answer
2k views

Unicode characters available in shell but not within Vim

I'm using Vim on a machine through SSH with PuTTY. In my shell (bash), I can copy/paste unicode characters, like ‘ ¿ ’ using Shift + Insert and it works as expected. In Vim, within the same shell ...
5
votes
2answers
620 views

Is there a version of “strpart” that is aware of characters, rather than bytes

According to :help strpart(), the parameters start and len are bytes, not characters, so that returns a string of 2 characters, starting with the letter Beth. What I'd like to have is a function, ...
5
votes
1answer
2k views

(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 ...
5
votes
0answers
54 views

Matching any Unicode whitespace

I'd like to match in Vim any whitespace character, not only normal space (U+0020) and tab (U+0009) with \s, and the other ASCII ones like form feed (U+000C) with [[:space:]], but any Unicode ...
5
votes
0answers
588 views

Unreadable display of Tamil characters in Vim

gVim seems to have problems displaying text in Tamil (and possibly other Indic languages), even when the font supports it. For eg., here's some text in Emacs and the same text in gVim (both under ...
4
votes
4answers
2k views

How to show illegal whitespace (such as unbreakable space) in source code?

I sometimes type (by accident) shift-space, inserting unbreakable space into code. With c++, I get this: error: stray ‘\302’ in program error: stray ‘\240’ in program while in other formats (like ...
4
votes
3answers
502 views

How can a character be inserted during an edit session by its Unicode numeric value?

I'm trying to set up a plugin to enable indentation guides, following an answer to this question. The plugin is Yggdroot/indentLine. It has instructions to set up a custom glyph to be shown instead of ...
4
votes
1answer
3k views

move forward by a certain number of chars or bytes?

Sometimes I need to move to a particular byte offset or move to the nth unicode rune in a file (utf-8). Does vim expose a way to move to an absolute byte/char offset or to move the cursor forward a ...
4
votes
1answer
2k views

Why do symbols look ugly in gvim?

I'm on Windows 7 with Vim 7.4, and Unicode symbols with the Hack font look awful. Am I missing a setting somewhere? Is there a way to improve this? For reference, this is gvim: and this is atom: I'...
4
votes
1answer
169 views

Latin Capital Letter Thorn

I want to insert the unicode character Thorn Þ into my document. http://www.fileformat.info/info/unicode/char/00de/index.htm The character seems to be inserted when I type i<C-v>u00DE<esc&...
4
votes
1answer
47 views

How to make many definitions available as some kind of mode

I've written a vim script that inserts unicode mathematical notation into what I'm editing. It's basically a few hundred lines of code that look like :map! \bbq ℚ. Sometimes I want to enable all of ...
4
votes
1answer
240 views

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,...
3
votes
2answers
216 views

Is there something similar to g8 but shows the values according to the file encoding

I am looking for a g8 equivalent that prints the hex values of the character under the cursor according to the file encoding of the file loaded in a buffer rather than assuming it's utf-8. Is there ...
3
votes
1answer
430 views

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
3
votes
1answer
89 views

Why using external “tr” command on lines with Farsi numbers does not work correctly?

I want to use external tr command on a line in Vim. When the source or replace pattern includes Farsi numbers the result is unpredictable. Executing :.!tr 1 ۱ on 1 results: Û Executing :.!tr ۱ 1 on ...
3
votes
0answers
61 views

Unicode in vimrc no longer displaying correctly

I'm using VIM 8.1.2234 with +multi_byte and +multi_lang In my vimrc file, I have set listchars=tab:▸\ ,trail:· (Notice the "▸" and the "·") When I cat or less my vimrc, the text ...
2
votes
2answers
165 views

Highlight Unicode Characters

Is it possible to highlight unicode characters? When I copy/paste a code sample I sometimes run into problems because the website uses ‐, ‑, ‒ or – instead of - or some other characters that are hard ...
2
votes
1answer
427 views

Digraph for the “bullet” (8226 hex 2022) [duplicate]

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?
2
votes
1answer
241 views

How to interpret ASCII codes returned by “ga” command?

I'm cleaning data imported from Excel to Access, and ran across funny quotes that I'm having trouble getting unambiguous ASCII codes for. They are the hooked single quotes ‘ and ’. Vim's ga command ...
2
votes
2answers
1k views

Printing unicode chars?

Is there a solution to printing unicode characters from gvim? See this: Results in this print result (Using a Linux setup and Vim 8.0.)
2
votes
1answer
732 views

How can I search for Unicode characters by hex code in very magic regexes in vimscript?

I am working on UTF-8 support for my editorconfig-core vimscript plugin. I have hit a strange snag. This is in official GVim 7.4 Win32. I would like to get this working on 7.4, rather than ...
2
votes
1answer
652 views

Detect if Vim can show utf8 characters

I have the line set listchars=eol:↵,tab:▸-,trail:¤,nbsp:¤ in my .vimrc which I use on different machines. If the LC_CTYPE is not set to an UTF-8 map, I get the message E474: Invalid argument: ...
2
votes
1answer
36 views

How to get the encoded byte sequence for a character in the status line?

I want to display the hex byte sequence for the character under the cursor as it is actually stored on disk. Currently my status line contains 0x%04.5B which works fine for ASCII/latin1 files but for ...
2
votes
1answer
183 views

Some umlauts and extended Latin characters are shown as fullwidth

In Vim, I find each of ü and ß takes up fullwidth, i.e. twice as fat as ASCII characters. I am writing some German-learning notes, and find this to be very confusing, since I have been mistaken that ...
2
votes
1answer
63 views

How do I work with vim9 and unicode?

I've found myself in a bit of an interesting situation. I'm writing a plugin in which I need to do a tiny bit of line parsing. Given a file: æøå It's easy to verify that col('.') returns 1, 3, and 5 ...
2
votes
1answer
201 views

How to deal with accented latin characters on neovim

I'm trying to find out how to configure neovim in order to edit texts with accented latin characters. I usually set ambiwidth to double so Jananese symbols are displayed properly, but then neovim ...
2
votes
0answers
26 views

Wrong width for certain characters

Using this: https://github.com/vim/vim-win32-installer/releases/download/v8.2.1505/gvim_8.2.1505_x64.zip All of these characters (and perhaps others): ℹ ⌨ ⏏ ⏭ ⏮ ⏯ ⏱ ⏲ ⏸ ⏹ ⏺ ☀ ☁ ☂ ☃ ☄ ☎ ☑ ☝ ☠ ☠️ ☢ ☣ ☦ ☪...
2
votes
0answers
30 views

Tell vim to treat character as full width

I am wondering if it is possible to tell vim to treat an individial code point in the unicode plain. I am aware of the ambiwidth option, but it does not help with my current task because the relevant ...
1
vote
1answer
167 views

Can you match unicode blocks by name in vim?

\p{Cyrillic} Works in my normal regular expressions. When trying to match in Vim or gvim however, I can not seem to get it to work. I tried something like this: \p\{Cyrillic} Is it not supported, ...
1
vote
1answer
36 views

How to conceal zerowidth special characters like <U200C>

That character is used so much in Persian writing. And it makes the text difficult to read. I tried to make my terminal display it correctly but I couldn't I was wondering maybe I could use vim syntax ...
1
vote
1answer
87 views

Replace base character, retaining combining characters

I have a vocalized Hebrew text; most letters are followed by one or more combining characters. I would like to replace some of the base characters, leaving the combining characters intact. It seems ...
1
vote
1answer
482 views

Using digraph mode to insert special key codes

I've always thought about digraph mode as a way to quickly insert unicode special or unusual chars into the buffer without copy-pasting things around or changing keyboard layout system-wide. So to ...
1
vote
1answer
599 views

Why some information can't been shown at status bar with iTerm2?

Installed vim with SpaceVim on macOS. When ran vim in the iTerm2 terminal, the information can't been shown rightly at status bar. Much of them been shown as ?. Why?
1
vote
1answer
334 views

Macvim - CJK-specific font settings?

Currently in my MacVim, the English font (Source Code Pro Light) is fine, but the Chinese font is being rendered in a very ugly manner. Is there any way to specify what font to use/fontsize for CJK ...
1
vote
0answers
42 views

Getting the half of a glyph

while trying to add a unicode font, I am getting the half of the font, like in line 239 and 240 in the screenshot: I have, in my vimrc: set history=700 " How many line Vim ...
1
vote
1answer
40 views

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 ...
1
vote
1answer
118 views

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 ...
1
vote
0answers
62 views

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 ...