Nikolay Fominyh
Nikolay Fominyh

Reputation: 9256

Vim. Troubles with encoding on file saved in windows

I have ��� chars after each time I save file in windows for some folders. And for some other folders - all is fine. I can't find difference between folders where everything is fine and folders where files saving with bad endings. So I have to run dos2unix in my linux virtual machine on modified files every time. Since these files is javascript - it's very annoying!

Help me, where to dig? How to avoid appearing of ��� chars at the end of file?

:set fileencoding=utf-8 does not help.

Usually vim has for dos files - [dos] label at the bottom of buffer window - in my case all is fine, and no [dos] label there.

Upvotes: 1

Views: 185

Answers (1)

janos
janos

Reputation: 124744

This looks more like a file format problem than encoding. I recommend adding this to your ~/_vimrc:

set fileformat=unix
set fileformats=unix,dos
set nobinary

You can find more details in :help fileformat

Upvotes: 3

Related Questions