35

I'm trying to get the following into my .vimrc

" Use the same symbols as TextMate for tabstops and EOLs
set listchars=tab:▸\ ,eol:¬

Those lines are from here are worked perfectly in vim 7.2 I recently compiled and installed vim 7.3 and now those characters aren't understood by vim. Also: Ctrl+V then U in insert doesn't let me insert any characters, it just seems to ignore that.

Any ideas?

This is what I see: set listchars=tab:�~V�\ ,eol:¬

Sandro
  • 2,219
  • 4
  • 27
  • 41
  • 2
    Are you using a Unicode capable terminal or gvim? – Peter Rincker Sep 22 '10 at 15:05
  • 1
    Yes I am. I am using screen, but I can paste those characters into it just fine. – Sandro Sep 22 '10 at 16:36
  • Though Vim supports unicode, both MS and Linux systems don't have unicode support, I mean their terminals and consoles. Hence, I have installed vrapper in eclipse. Now, I am able to type in Unicode. :) – SibiCoder May 27 '16 at 15:47

9 Answers9

39

You need to compile vim with multi-byte support.

The easiest way to do this is to run

./configure --with-features=big
make

This will build vim with the correct support.

You can verify that it was compiled correctly with

:version

in vim or by running

vim --version

and looking for +multi_byte. If it says -multi_byte it will not work.

Olivier Pons
  • 15,363
  • 26
  • 117
  • 213
Alan Geleynse
  • 24,821
  • 5
  • 46
  • 55
  • I had been kicking myself for the past couple days, trying to get vim-powerline symbols to work with fancy characters. This finally fixed it. Thanks! – Liam Feb 13 '12 at 18:14
  • I installed arch linux the other day and my arrow symbols and tmux borders were messed up. This fixed vim, I think locale fixed the rest – chris.ritsen Jun 07 '12 at 12:54
  • 2
    for those still struggling: you also have to make sure your terminal is also set to use unicode : ) – Yeow_Meng Sep 19 '13 at 01:09
30

I have the following in my .vimrc

scriptencoding utf-8
set encoding=utf-8

and that in my .gvimrc

set listchars=trail:·,precedes:«,extends:»,eol:↲,tab:▸\ 

and works fine(notice there is a space after the ▸\ ).

Tassos
  • 3,158
  • 24
  • 29
  • interesting, on linux i don't have to set anything. on vim win32 with +multi_byte i started to have to add it after i changed something in my vimrc... now, putting those two lines will not raise an error, but the trail chars render as a question mark or something else... if i leave ONLY `set encoding=utf-8` then it works as before – gcb Apr 23 '14 at 18:48
  • Remember to `set list` to enable listchars. – jacwah Aug 01 '17 at 10:40
7

I had the same issue with the vim that ships with OS X Lion although it was compiled with multi_byte.

The issue was the encoding used by vim. I added set encoding=utf-8 in my ~/.vimrc and the issue was solved.

Ref: Terminal Vim redraw issues in OS X Lion

Community
  • 1
  • 1
arghav
  • 139
  • 1
  • 4
  • Perfect. I share a vimrc between Mac and Windows using Dropbox. Worked perfectly fine with MacVim but Gvim on Windows was giving me errors upon startup. – mrak Sep 04 '12 at 00:08
5

Make sure you're using a compatible font. My problem was that inconsolata-g does not support the utf-8 characters in my document.

also, this was all I needed in my gvimrc:

set enc=utf-8
set fileencoding=utf-8
set fileencodings=ucs-bom,utf8,prc
set guifont=Monaco:h14
set guifontwide=NSimsun:h14
AndrewPK
  • 6,100
  • 3
  • 32
  • 36
4

I had this issue while being in a screen session. It's gone with setting the following in my .bashrc:

export LANG=en_US.UTF-8
erikbstack
  • 12,878
  • 21
  • 81
  • 115
2

Don't forget, if you're running vim in a terminal, make sure the terminal itself is using utf-8 as well.

2

When all else failed, telling vim to save with UTF-8 encoding seemed to work (for now at least):

:write ++enc=utf-8
Community
  • 1
  • 1
c24w
  • 7,421
  • 7
  • 39
  • 47
1

Do you need a

scriptencoding utf-8

or whatever encoding your .vimrc is actually in?

Aristotle Pagaltzis
  • 112,955
  • 23
  • 98
  • 97
  • 2
    Also, check the values of `encoding`, `termencoding`, `fileencoding` options. Ensure that when you are editing `.vimrc` all of them are set to `utf-8`. – ib. Sep 22 '10 at 07:31
  • I've added it and it still doesn't work. How do I check the value of those other options? – Sandro Sep 22 '10 at 16:41
  • 1
    You can see the value of any option by adding a ? after the set command. ie :set encoding? – Tassos Sep 22 '10 at 19:55
  • Woah weird! Apparently the "encoding" option is not supported. I typed ":set encoding?" and that's the error that I got. – Sandro Sep 23 '10 at 02:03
  • 2
    You must have a version of vim compiled with +multi_byte. The vim version must be B (Big), H (Huge) or a manually compiled with the +multi_byte flag. Check your build flags via :version – Peter Rincker Sep 23 '10 at 03:47
  • Yes! This ended up being the problem. – Sandro Sep 25 '10 at 05:54
1

The accepted answer didn't work for me. Working off of the downloaded source on a Mac running Lion, I went into the src directory and ran:

make clean
export CONF_OPT_MULTIBYTE='--enable-multibyte'
make reconfig

Running: ./vim --version to check for +muti_byte then:

make install

Via: http://vim.1045645.n5.nabble.com/compiling-vim7-1-huge-version-gets-build-with-normal-version-td1162314.html