2011-08-04 24 views

回答

1

過了一會的閱讀和試​​驗:

設置這些在_gvimrc

set encoding=utf-8      "Set default buffer encoding to UTF-8. 
set fileencodings=utf-8,latin1   "Set the order of file encodings when reading and creating files. 
set fileformats=unix,dos,mac   "Set the order of line endings when reading and creating files. 

這些應該在命令行中使用。

set fileencoding=utf-8     "Change an opened file's encoding. 
set fileformat=unix      "Change an opened file's line endings. 
1

當然,把這個給你的gvimrc:

set encoding=utf-8 
set fileformat=unix 

可以使用:h[elp]命令來獲得額外的信息,例如:h encoding

0

注意
我知道你特別要求的設置爲您vimrc文件,但我想,因爲我懷疑你可能會從中受益(我無論如何都會提供意見的該位你可能會同時使用* nix和Windows)。

我雙方的* nix和Windows的工作,我發現了很多更容易使用modeline功能(請參閱::help modeline)代替設置文件格式在我的RC文件。這允許我在每個文件的底部有這樣的東西:vim:ff=unix(這樣,我不必擔心爲改變* nix生成文件的行結束符,我碰巧在Windows中編輯/在Windows上。

HTH

+0

應當指出的是,VIM已幾個遠程漏洞在模式支持內發現的 。 –

0

this question從鏈接答案看一看,應該涵蓋所有的你的vim編碼的基礎

報價,在添加你的行結束喜好:

set fileformats=unix,dos,mac 
if has("multi_byte") 
    if &termencoding == "" 
    let &termencoding = &encoding 
    endif 
    set encoding=utf-8      " better default than latin1 
    setglobal fileencoding=utf-8   " change default file encoding when writing new files 
endif 
相關問題