bodokaiser
bodokaiser

Reputation: 15752

Vim mixes up indent style when editing different files

I am using the nerdtree with some other plugins.

When I edit files with different indent settings (e.g. Makefile which requires tabs and *.js which should have spaces) then vim mixes up both and applies tabs to *.js.

The file type stuff is defined in these lines:

" use real tabs for these languages
autocmd FileType go,make
            \ set noexpandtab

" use two spaces for these languages
autocmd FileType ruby,html,json,jade,javascript
            \ set tabstop=2 |
            \ set shiftwidth=2

" use four spaces for these languages
autocmd FileType css
            \ set tabstop=4 |
            \ set shiftwidth=4

Any idea how to make vim to reapply autocmd Filetype when opening another tab in nerdtree?

Bodo

Upvotes: 2

Views: 145

Answers (1)

romainl
romainl

Reputation: 196751

You should use setlocal instead of set to prevent your settings from leaking to other buffers.

Upvotes: 5

Related Questions