David Purton wrote:
Hi all,

I gather that the vim7 xml omnicomplete needs a data file to work -
which is fair enough, since you can get all the attributes as well this
way.

But, how can I get a generic xml omnifunction system where vim will just
close the last open tag for me.

eg, at present, for html, I have vim set up to close the current tag as
soon as I type '</'


cheers

dc




Such "generic" xml/html ftplugins are distributed with Vim. You must "activate" them by having one (not all) of the following lines in your vimrc:

        filetype plugin on
        filetype plugin indent on
        source $VIMRUNTIME/vimrc_example.vim
        runtime vimrc_example.vim

(I recommend the last one, near the top of your vimrc, but YMMV.) Then you trigger omni-completion by hitting Ctrl-X Ctrl-O in Insert mode. In either HTML or XML, if the cursor is immediately after </ Vim should then close the current tag. Omni-completion also functions at other places, for instance (IIRC) in HTML after < hitting Ctrl-X Ctrl-O should give you a menu of possible tag names, after <DIV a menu of possible attributes, etc.

You can also assing a single-key shortcut for it, e.g.

        :imap <F12> <C-X><C-O>

to use F12 instead of Ctrl-X plus Ctrl-O


Best regards,
Tony.

Reply via email to