Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I need different tab widths for different files when using Vim. Is there a way to store this information in the file, and let Vim apply the setting automatically?

share|improve this question

1 Answer 1

up vote 7 down vote accepted

Depending on what fits your situation you could look into customizing the filetype plugins (if you want tabstop settings by filetype) or enable modelines and accept the accompanying security risks if the settings are specific to individual files.

For the filetype approach, as an example I have the following in ~/.vim/after/ftplugin/python.vim:

setlocal expandtab softtabstop=4 shiftwidth=4
share|improve this answer
    
Modelines is what I was looking for. Thanks! –  user4518 Nov 11 '11 at 10:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.