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 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.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer

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
share|improve this answer

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.