I am using Mac OSX 10.7.5, the contents of .vimrc is as follow:
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set shiftround
set smarttab
set autoindent
set copyindent
autocmd FileType make setlocal noexpandtab
What I am trying to do is when I edit normal files like .js, .html I want my tabs to be indented with 4 blank spaces instead of a normal tab.
But when I am editing Makefile, I need it to be a normal tab instead of 4 blank spaces for indentations.
I thought the above setup in .vimrc is going to give me that, but is not working for me as when I am editing Makefile I am still getting 4 blank spaces for indentation.
Not sure what I am doing wrong here?
Best Answer
This is a section of my
.vimrc
:The section should be self-explanatory, but I suggest you read the vim help on
filetype
andautocmd
.The most relevant line to you, is probably this one:
make sure filetype detection is switched on, though.