I'm trying to write a funct开发者_开发问答ion that acts on any filetype (thus is not a particular ftplugin), that has divergent behavior based upon what the filetype is. e.g.
if (filetype=='objc')
"do something
elseif (filetype='cpp')
"do something else
endif
I read through the filetype docs, but nothing seems to reference this. Advice?
Try accessing the option value:
if (&ft == 'objc')
...
You can use &
to access the value:
if ( &ft == 'cpp' )
...
etc.
精彩评论