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.

My to-do list is a plain text .txt file that I load in Vim. In .txt files Vim has always coloured hash marks (#) and the text following them on the same line, which I use to mark out urgent to-do items. The other day this highlighting disappeared and I can't for the life of me see how to restore it. I've turned on all the syntax and filetype commands I can find. Should I have a text.vim or txt.vim syntax file that I might've deleted without realising? It feels like there should be a simple solution, but I can't find anything approaching a simple solution from googling round - I'm certainly not going to reinstall, write a custom syntax file, use a complex script, etc., I just want the default behaviour back :-)

share|improve this question
    
What platform are you running on? Windows, Mac OS or Linux (which distribution)? –  Benjamin Bannier Nov 30 '10 at 14:22

1 Answer 1

up vote 5 down vote accepted

I don't think that your Vim is broken. Try putting a hash mark (#) at the beginning of the first line in the file. When Vim sees this, it sets the filetype to conf (for a configuration file). As far as I know, Vim does not syntax color vanilla text files.

share|improve this answer
1  
The straight forward way to force a filetype is a modeline, e.g. # vim: set filetype=conf :. Also, asciidoc comes with syntax highlighting for .txt files (but no, hashed lines are not colored specially). –  Benjamin Bannier Nov 30 '10 at 14:46
    
Wow! erichui and honk, that did the trick - I set filetype to Generic config, saved and quit and all is well again in todo-land. Thank you! –  Vim user Nov 30 '10 at 14:54

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.