On 06/10/08 13:05, Efraim Yawitz wrote:
> Why doesn't the following work to make all files in a given directory
> have a certain syntax highlighting?
>
> :au BufRead /some/directory set syn=somesyntax
You should set 'filetype' rather than 'syntax'. What happens is (I
think) the following:
- A file is read.
- Your autocommand, defined in the vimrc, sets 'syntax'
- The standard autocommand, defined by filetype.vim (which is run when
you do ":filetype [plugin] [indent] on" sets 'filetype'
- Setting 'filetype' triggers the FileType autocommand.
- One of the standard autocommands for FileType (sefined when you set
":syntax on") sets 'syntax' equal to 'filetype'
- So what you get is the default syntax highlighting for that kind of file.
Best regards,
Tony.
--
"Last night, I came home and realized that everything in my apartment
had been stolen and replaced with an exact duplicate. I told this to
my friend -- he said, `Do I know you?'"
-- Steven Wright
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---