开发者

Referencing filetype from function

开发者 https://www.devze.com 2023-04-06 18:40 出处:网络
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.

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

精彩评论

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