Wednesday, December 5, 2012

Re: filetype detection within files

On 05/12/12 09:09, Marc Weber wrote:
> There are quite a lot of files supporting sub filetypes such as
> .haml
> .php
> and whatnot
>
> Some plugins such as snippet and commenting plugins could benefit from
> knowing which filetype the current cursor is at.
> Do any implemantions of this beside the one contained in tcomment
> already exist?
>
> Marc Weber
>

To know which 'filetype' has been detected for the current editfile, see
:help expr-option

if &filetype == ""
" no filetype has been detected (NoName buffer?)
elseif &filetype == "php"
" do something
elseif &filetype == "phtml"
" do something else
else
" this is probably not PHP
endif

Or did I misunderstand your question? If I did, please explain more clearly.


Best regards,
Tony.
--
User: I'm having problems with my text editor.
Help desk: Which editor are you using?
User: I don't know, but it's version VI (pronounced: 6).
Help desk: Oh, then you should upgrade to version VIM (pronounced: 994).

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment