2

I have a proyect with Laravel and I'm using VIM as editor. I have the syntastic plugin using PSR-2.

According to PSR-2, each class must by namespaced, but Laravel migrations aren't. So I want to find a way to enable Syntastic only for files inside the app folder.

lcjury
  • 1,158
  • 1
  • 14
  • 26

1 Answers1

2

Drop this in your .vimrc:

autocmd BufRead,BufNewFile /path/to/app/dir/* let b:syntastic_mode = 'passive'

That will suppress syntastic for php when you open a file in your app directory in vim for that buffer.

You can read more about changing vim behavior based on the file path here.

lcd047
  • 5,731
  • 2
  • 28
  • 38
Elliott Beach
  • 10,459
  • 9
  • 28
  • 41
  • 1. If you want per file configurations you should probably use `b:syntastic_mode` rather than the global `g:syntastic_mode_map`. 2. If you want an `autocmd` to match only on certain files you can write a test against `expand('')`. – lcd047 Jul 24 '17 at 06:02
  • Edited for point 1, but I don't understand why point 2 is better. @Icd047 – Elliott Beach Jul 24 '17 at 15:56
  • _Edited for point 1_ - Fixed that for you. _I don't understand why point 2 is better._ - It allows you to make exceptions to the `/path/to/app/dir/*` pattern. – lcd047 Jul 24 '17 at 16:13