2014-10-16 38 views
0

~/.vimrc包含以下(在Ubuntu 14.04默認情況下,剛剛添加的最後一行):爲什麼c.vim重寫.vimrc的HTML?

set smartindent 
set tabstop=4 
set shiftwidth=4 

filetype plugin indent on 

~/.vim/after/ftplugin/c.vim

set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab 

我期待只.c.h文件使用8列標籤。但是,其他文件也正在受到保護,例如.html文件。

我該如何讓c.vim隻影響C相關文件?

回答

3

更改此:

set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab 

這樣:

setlocal tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab 
+0

改變'set'到'setlocal'工作!注意:現在又做了一個改動,刪除了'filetype plugin indent on'並將'c.vim'放入'〜/ .vim/syntax/c.vim'中。 – Daniel 2014-10-16 15:34:34

+3

不,請將'filetype plugin'縮進。 Vim作爲一個沒有這一行的編程編輯器是沒用的。 – romainl 2014-10-16 15:39:19

+3

並且不要將這個文件移動到'syntax /'。 'ftplugin /'是正確的地方。 – 2014-10-16 15:42:50