I am doing some Drupal programming and have created yasnippets for common functions: db_select, db_delete etc.
I want to load them only when I am working on a Drupal file and not for a common php file. The task is this:
given a list of yasnippet files and the path of the currently opening file
if(path contains '/sites/all/modules')
{
load all the snippets from the list
}
How to do it?
You have two options:
Either way you’ll be doing things based on the current directory or filename.
find-file-hookexampleI haven’t tested this code but the concept is there. You’ll probably have to check the
yas/load-directory-1function to something else or mess around with parameters.