I’m having trouble getting this to work. I’m writing a Vim snippet that will take the current file’s name and expand it into a class name, e.g.
If the current file name is: some_awesome_class.foo … the snippet would expand to class SomeAwesomeClass
So far, I have:
substitute(Filename(), '\(^.\|_\a\)', '\u&', 'g')
.. but this only capitalizes the first letter, even though it correctly matches all the underscores. I guess what I’m looking for is a way to use the underscore as part of the search, but not have it be matched in the ampersand, i.e: it looks for _\a but only matches \a.
Any help would be much appreciated!
Here is a suggestion: