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

前端 未结 5 1652
庸人自扰
庸人自扰 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:54

    Notice that there is a difference between

    set encoding

    and

    set fileencoding

    In the first case, you'll change the output encoding that is shown in the terminal. In the second case, you'll change the output encoding of the file that is written.

提交回复
热议问题