简体   繁体   中英

Why is c.vim overriding .vimrc for HTML?

My ~/.vimrc contains the following (default in Ubuntu 14.04, just added the last line):

set smartindent
set tabstop=4
set shiftwidth=4

filetype plugin indent on

In ~/.vim/after/ftplugin/c.vim :

set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab

I was expecting for only .c and .h files to use 8-column tabs. However, other files are also being afected such as .html files.

How can I make c.vim affect only C-related files?

Change this:

set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab

to this:

setlocal tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM