I am trying to make an auto-cmd triggered by opening a new file with path including test/
and with filename ending in Test.java
. Reading in :h autocmd-patterns
I can not figure out if either only limited patterns can be used as a file pattern in an auto-cmd or if I am simply doing something wrong with my pattern. The following works for matching any file ending in .java
autocmd! BufNewFile *.java
\ "command implemented !
Now I try to match new files with a path containing /test/
and with a file name ending in Test.java
through the following and derivatives of it
autocmd! BufNewFile */test/*Test.java
\ "command implemented !
How do I trigger the autocmd on all files having part of their path the test/
folder and the filename ending in Test.java
. For instance it should be triggered on doing
$ vim code/algos/graphs/test/KruskalTest.java
echo "yep"
instead. – Waynant*.java
the command triggered correctly. Changing the pattern to */test/*Test.java` made it not get triggered even with an appropriate path. Will look more into VimScript before continuing. – Avid