Christian Schlensker
Christian Schlensker

Reputation: 22478

Match partial filetype in vimscript

I have a file that's being recognized as jasmine.coffee in VIM, but &filetype=='coffee' evaluates to false.

Is there a way to do a partial filetype match in Vimscript

Upvotes: 1

Views: 226

Answers (1)

Michael Berkowski
Michael Berkowski

Reputation: 270607

Use the =~ pattern matching operator instead, which will treat the right side as a regular expression to test against.

&filetype =~ 'coffee' 

This is mentioned in the Conditionals section of the Vimscript documentation.

Upvotes: 2

Related Questions