1

I'm trying to detect buck's TARGETS file as 'buck' files instead of 'python', which is the filetype vim's currently detecting for them.

I tried to add autocmd BufRead,BufNewFile **/TARGETS set filetype=buck to my .vimrc but it didn't seem to work.

What's the correct way to change a 'default' detected file type ?

Vinz
  • 5,997
  • 1
  • 31
  • 52

1 Answers1

4

Your autocmd is the way to go in principle; just omit the **/ in the pattern:

autocmd BufRead,BufNewFile TARGETS set filetype=buck

see :help autocmd-patterns

Ideally, you'd have this line in a .vim/ftdetect/buck.vim file

OhleC
  • 2,821
  • 16
  • 29