I know I can setf python and then the file is recognized as python. However I must redo this everytime I reload the scons file.

I have read some weeks ago that one could write in the last lines of a file with a special syntax and sets parameters that vim should read.

In my case I would like setf python to be set anytime I open this scons file.

However I don't remember the syntax, and I can't manage to find the web site where I read it was possible to have file dependent properties.

#:setf python on the last line doesn't seem to suffice.


Correct syntax:

# vim: set filetype=python:

But you need set modeline (it's default in my case) in .vimrc.

Read this wiki for more information.


If the scons file always has the same name / adheres to a certain pattern, you can also configure the filetype detection; put the following into your ~/.vimrc:

:autocmd BufNew,BufRead SConstruct setf python

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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