[英]Vim. Troubles with encoding on file saved in windows
I have chars after each time I save file in windows for some folders. 每次我在Windows中为某些文件夹保存文件后,我都会有 字符。 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. 所以我每次都必须在我的linux虚拟机上运行dos2unix
修改过的文件。 Since these files is javascript
- it's very annoying! 由于这些文件是javascript
- 这非常烦人!
Help me, where to dig? 帮帮我,在哪里挖? How to avoid appearing of chars at the end of file? 如何避免在文件末尾出现 字符?
:set fileencoding=utf-8
does not help. :set fileencoding=utf-8
没有帮助。
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. 通常vim有dos文件 - 缓冲区窗口底部的[dos]
标签 - 在我的情况下一切都很好,那里没有[dos]
标签。
This looks more like a file format problem than encoding. 这看起来更像是文件格式问题而不是编码。 I recommend adding this to your ~/_vimrc
: 我建议将它添加到~/_vimrc
:
set fileformat=unix
set fileformats=unix,dos
set nobinary
You can find more details in :help fileformat
您可以在:help fileformat
找到更多详细信息:help fileformat
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.