I'm writing a snippet in which I need to get the current file name in vimscript. I can do this happily with expand('%:t:r')
(as shown here). However, I'd like to not only exclude '.js' from the filename, but also '.test'.
e.g.
If in myName.test.js
, I would like to grab 'myName'
If in myName.js
, I would also like to grab 'myName'
I'm doing this to create an UltiSnips snippet so other methods (e.g. regex) would also be useful