12

I am using VIM 7.4 on an Ubuntu 14.04 64 bit machine. In my .vimrc file, I have the following lines:

" Use UTF-8 without BOM
set encoding=utf-8 nobomb

The config file basically uses Unicode character to display white spaces like tabs, new lines, etc. The complete .vimrc file is taken from Paul Irish's dotfiles.

On an earlier install of 14.04 as well as in previous distributions, I was able to see the unicode characters without any problems but not with this one.

I also tried:

 set fileencodngs=utf-8

But, the above setting has no effect and I still see garbled characters on the screen. Is there any way around this?

  • 1
    Can you give a link to an example file that looks garbled to you? And can you include a screenshot of what you are seeing in vim? What is the value of the fenc variable after opening a file? – Mike Miller Jun 4 '14 at 15:08
15
+50

If your current locale is in an utf-8 encoding, Vim will automatically start in utf-8 mode.

If you are using another locale, set below in your user ~/.vimrc file:

set encoding=utf-8

You might also want to select the font used for the menus. Unfortunately this doesn't always work.

Also you have this option to force encoding with :set fileencodings=utf-8. You can find the documentation here

Second solution is: In insert mode, press Ctrl-R ="\xe2\x82\xa9" Enter.

ref: Vim documentation

Note: If you did the above configuration but still you were not able to see Unicode characters well or type, check in your Terminal or Console configuration if Character encoding was set to UTF-8.

Read also Special characters in Vim.

  • 1
    This also solved the issue of not being able to input Chinese characters for me. – Zelphir Oct 22 '16 at 17:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.