With vim, how can I use autocmd's for files in subdirectories of a specific path?

后端 未结 2 1372
心在旅途
心在旅途 2020-12-30 00:42

I am trying to figure out how I can define an autocmd that influences all files under a specific path.

The autocmd I have tried is something like

aut         


        
2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-30 01:08

    So, I've done this in my code with paths under a particular path. You need to do:

    autocmd BufRead,BufNewFile */somepath/* set filetype=sometype
    

    At least, that's what I was using to set a given filetype for things under a particular library path. Hopefully that will help with your example.

    If you want to include all subdirectories, use **:

    autocmd BufRead,BufNewFile */somepath/** set filetype=sometype
    

提交回复
热议问题