New Alexandria
New Alexandria

Reputation: 7324

How do I set vim's default syntax highlighting for all files in a given dir/path?

If I open a given mail file in ~/maildir-sent/ then file has no syntax highlighting. Vi has default highlighting for mail files, and I can turn this on manually with

:set ft=mail This doesn't occur by default because mail files there have the awkward name structure 1339174749.7162_2.tm24-s00418:2,S

How do I make mail files highlighting occur by default? I.E. I presume this default reads like "all files that are not matched by another syntax highlight definition"

Upvotes: 3

Views: 1345

Answers (1)

pb2q
pb2q

Reputation: 59607

Use an autocmd in your .vimrc:

autocmd BufRead ~/maildir-sent/* setlocal ft=mail

See :help autcmd for more information.

Upvotes: 7

Related Questions