Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I vaguely remember that there is a way to store instructions for vim in my file (like tabstop width etc). I'm not speaking of settings in vimrc but of storing those settings with in the file to be edited.

That way the tabstop has always the right width even if I transfer this file to another computer.

However, I can't remember what the magic word is so that vim picks up those settings when loading the file. Any ideas?

share|improve this question
add comment

1 Answer 1

up vote 5 down vote accepted

Put a comment with vi: in it, ending with a newline.

/* vi: tabstop=4
*/

If vim doesn't pick this up then you may need to add set modeline to ~/.vimrc. See :h modeline for full details.

share|improve this answer
    
Thanks a lot for pointing me into the right direction! It works perfect. Cheers. –  Jon Feb 15 '11 at 13:46
2  
You can avoid having to have the closing comment string on a new line by using the "set" form of a modeline, for example: /* vi: set tabstop=4: */ –  Heptite Aug 21 '11 at 20:05
    
I didn't need a new line # vim:et:sts=4:sw=4 –  Felipe Alvarez Oct 2 '13 at 0:12
    
You're welcome: <!-- vi: set sw=4 ts=4: --> –  Andrejs Cainikovs Feb 23 at 16:04
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.