开发者

Referencing filetype from function

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜