2011-03-28 32 views
3

我發現的每個與編碼相關的問題都是關於如何重新編碼文件。如何徹底關閉vim的abilty來重新編碼文件?

但是,我完全相反 - 是否有可能讓vim根本不重新編碼文件? (以及如何如何)

有時它在狀態行寫入[converted],總是錯過。但是,我將終端設置爲與編輯文件相同的編碼,因此,我根本不需要重新編碼。

回答

6

使用

vim -b "myfile.type" 

以二進制方式進行編輯。您還可以設置

:set binary 

,或者如果你是懶惰和我一樣

:se bin 

之前在vim編輯一個文件(適用於當前緩衝區)

:he `binary` 


        *'binary'* *'bin'* *'nobinary'* *'nobin'* 
'binary' 'bin'  boolean (default off) 
      local to buffer 
      {not in Vi} 
    This option should be set before editing a binary file. You can also 
    use the |-b| Vim argument. When this option is switched on a few 
    options will be changed (also when it already was on): 
     'textwidth' will be set to 0 
     'wrapmargin' will be set to 0 
     'modeline' will be off 
     'expandtab' will be off 
    Also, 'fileformat' and 'fileformats' options will not be used, the 
    file is read and written like 'fileformat' was "unix" (a single <NL> 
    separates lines). 
    The 'fileencoding' and 'fileencodings' options will not be used, the 
    file is read without conversion. 
1

如果您正在編輯二進制文件,你想要什麼sehe建議,binary

如果您正在編輯文本文件,那麼您可能需要更改fileencodings,或者如果問題在於vim未正確檢測到終端編碼,encoding