2

I'm running Vim (9) on Ubuntu both on my local machine and a VPS. I was working on moving my config to the server, where I encountered an error saying:

Invalid argument: listchars=tab:~@\ ,trail:~@,extends:#,nbsp:.

After a bit of googling, I found an answer to add :set encoding=utf8 in my vimrc, but I figured it might have had to do with the locale and set export LANG=hu_HU.UTF-8 in my .zshrc on both machines.

Now the Vim on my computer is throwing stuff like this on the screen, while the visually shown lines and my actual cursor positions is misaligned:

P1+r436f=323536^[\^[P1+r6b75=1b4f41^[\^[P1+r6b64=1b4f42^[\^[P1+r6b72=1b4f43^[\^[P1+r6b6c=1b4f44^[\^[P1+r2332=1b5b313b

The issue goes away if I remove all my theme config (notably vim-airline). The issue does not happen now on the server, just on the computer. The Vim config on the two machines are the same.

I obviously don't get something about locales and utf-8 in general, and how that interacts with vim-airline.

I'm also not sure if I handled the original issue properly (set encoding).

What happening here and how can I fix this?

edit: I rolled back my recent changes to my configuration to one that definitely worked properly and the issue persists, so it must have been the locale changes (I can't really think of anything else), but I have no idea what the original settings were and what should work with vim ...

edit2: For good measure:

❯ locale
LANG=en_GB.UTF-8
LANGUAGE=
LC_CTYPE="en_GB.UTF-8"
LC_NUMERIC=hu_HU.UTF-8
LC_TIME=hu_HU.UTF-8
LC_COLLATE="en_GB.UTF-8"
LC_MONETARY=hu_HU.UTF-8
LC_MESSAGES="en_GB.UTF-8"
LC_PAPER=hu_HU.UTF-8
LC_NAME=hu_HU.UTF-8
LC_ADDRESS=hu_HU.UTF-8
LC_TELEPHONE=hu_HU.UTF-8
LC_MEASUREMENT=hu_HU.UTF-8
LC_IDENTIFICATION=hu_HU.UTF-8
LC_ALL=
14
  • Make sure you set the encoding very early in your .vimrc, otherwise it may invalidate all loaded strings in memory. Aug 25 at 6:14
  • It's the very first line in ~/.vim/vimrc, so I'm guessing it's not that :(
    – fbence
    Aug 25 at 6:39
  • I checked an earlier config and it is definitely not a .vimrc issue, or at least not directly.
    – fbence
    Aug 25 at 6:46
  • 1
    I don't think this is locale related. Also it may also matter if you are running Vim inside tmux/screen Aug 25 at 7:55
  • 2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.