I've been in a few .php/.js-projects lately where it is not straight forward to use gf ("goto file"). Usually when the cursor in vim is above a filename I simply hit gf and it opens that file for reviewing/editing.
But in webdev land where I have been lately it is not untypically to do a reference to a file of sorts:
{% include '\_partials/main-menu' with {id: mainMenu} %}
It states the path _partials/main-menu, but the file that I want to investigate is craft/templates/_partials/main-menu.twig.
To gf my way to the right file I found that I could set path+=$PWD/craft/templates and set suffixesadd+=.twig
But I do not want to enable this to all the files I'm editing, so I use setlocal path and setlocal suffixesadd instead. At the same time I don't want to type this in every time I open a file. And I do not want it to happen for all the .twig files I edit. To fix this I added silent! so ../vimlocal.vim to my vimrc.
In the ../vimlocal.vim file I put the Filetype check I put
autocmd Filetype html.twig setlocal path+=$PWD/craft/templates
autocmd Filetype html.twig setlocal suffixesadd+=.twig
Now it is important to open vim in the project root directory (or to both get the ../vimlocal.vim-path right and the path= to point in the right direction.