Add HTML support to taglist in vim (file has PHP and HTML code)

557 views Asked by At

I have a file, which has PHP and HTML mixed code. By default, Vim recognized this extension as php. File extension is phtml.

I wonder if I can add support to taglist (which is a Vim plugin) for that kind of file. I have exuberant-ctags installed too.

I searched in Google, found this but it did not work. It seems the code is wrong; instead of seeing the tags on the left, I can see the name of the file.

1

There are 1 answers

2
benjifisher On

The taglist plugin is rather old, and has not been kept up to date. I suggest you switch to Tagbar, which was written as an update and replacement: http://www.vim.org/scripts/script.php?script_id=3465 or http://majutsushi.github.io/tagbar/.

With no attention to configuration, I created a simple file, foo.phtml:

<?php

function Foo() {
  return 'bar';
}
?>
  <p>Foo says <?php echo Foo(); ?>.</p>

After :TagbarOpen, I see the function I have defined:

" Press <F1> for help

▼ functions
    Foo