How can I change a file's encoding with vim?

前端 未结 5 1645
庸人自扰
庸人自扰 2020-11-30 16:02

I\'m used to using vim to modify a file\'s line endings:

$ file file
file: ASCII text, with CRLF line terminators
$ vim file
:set ff=mac
:wq
$ file file
file         


        
5条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-30 16:51

    From the doc:

    :write ++enc=utf-8 russian.txt

    So you should be able to change the encoding as part of the write command.

提交回复
热议问题