简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM