"Vim is a text editor that is upwards compatible to Vi." - man vim

Modelines

modelines are commented lines in files that set vim settings to use when editing that file.

http://vim.wikia.com/wiki/Modeline_magic

modeline example:

# vim: set expandtab ts=2