Loading ...
Sorry, an error occurred while loading the content.

Installing xmledit

Expand Messages
  • Bill K.
    Hi, I m a long time vi user (29 years!), but I m relatively new to MacVim. I m using MacVim to author in DocBook XML, so I m interested in installing the
    Message 1 of 3 , Jul 31, 2008
    • 0 Attachment
      Hi, I'm a long time vi user (29 years!), but I'm relatively new to
      MacVim.

      I'm using MacVim to author in DocBook XML, so I'm interested in
      installing the xmledit plugin. But I'm having trouble getting this
      plugin working. Can anyone help me?

      I created ~/.vim/ftdetect/mine.vim, and added a rule for the XML
      files, which in my case have an extension ".pml".

      au BufRead,BufNewFile *.pml set filetype=xml

      This seems to be working, because when I open a .pml file, "set
      filetype" reports "xml" which is correct.

      Then I created ~/.vim/ftplugin/xml.vim containing the following
      commands:

      set ai
      set sw=2

      But when I open a .pml file, these settings are obviously not in
      effect. Why aren't files in my home ftplugin directory being loaded?

      I'd be grateful for any help.

      Regards,
      Bill Karwin

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_mac" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Ben Schmidt
      ... Probably should be called xml.vim but in this case I don t think it ll matter. ... Good. ... Are filetype plugins definitely enabled? If you just do ...
      Message 2 of 3 , Aug 1, 2008
      • 0 Attachment
        > I created ~/.vim/ftdetect/mine.vim, and added a rule for the XML
        > files, which in my case have an extension ".pml".
        >
        > au BufRead,BufNewFile *.pml set filetype=xml

        Probably should be called xml.vim but in this case I don't think it'll
        matter.

        > This seems to be working, because when I open a .pml file, "set
        > filetype" reports "xml" which is correct.

        Good.

        > Then I created ~/.vim/ftplugin/xml.vim containing the following
        > commands:
        >
        > set ai
        > set sw=2
        >
        > But when I open a .pml file, these settings are obviously not in
        > effect. Why aren't files in my home ftplugin directory being loaded?

        Are filetype plugins definitely enabled? If you just do

        :filetype

        does it say plugin:ON? If not, you need

        :filetype plugin on

        in your .vimrc or such.

        Also, since xml is already a filetype recognised by Vim, perhaps
        something in Vim's builtin formatting is overriding it. If you have
        filetype indenting on, for instance, Vim may well be setting the
        indentexpr, which overrides autoindent. To in a way give your settings
        priority, try putting your xml.vim file in ~/.vim/after/ftplugin instead
        of just ~/.vim/ftplugin and it'll be sourced, funnily enough, after the
        Vim distributed stuff and therefore have the last say.

        You may like to think about whether this should really perhaps be
        considered filetype indenting, not an ftplugin, ensure you have

        :filetype indent on

        and put in ~/.vim/after/indent. I personally would probably stick with
        the ftplugin option, though: I tend to dislike other filetype specific
        indenting, so have it turned off and set my own settings with ftplugins
        if I want to.

        By the way, you should use :setlocal not :set.

        Ben.



        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_mac" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Bill K.
        ... Okay, I think that was the problem. I had checked this before, and it did say ON, but I guess it was activating it after it had a chance to scan my local
        Message 3 of 3 , Aug 1, 2008
        • 0 Attachment
          On Aug 1, 6:32 am, Ben Schmidt <mail_ben_schm...@...> wrote:
          > > Why aren't files in my home ftplugin directory being loaded?
          >
          > does it say plugin:ON?

          Okay, I think that was the problem. I had checked this before, and it
          did say ON, but I guess it was activating it after it had a chance to
          scan my local directory. Anyway, after I put "filetype plugin on" in
          my ~/.vimrc, it's working.

          Now I have the key mappings from xmledit. For example, "\%" can be
          used to jump to a matching XML tag, and when I close an XML tag, it
          auto-completes, inserting the closing tag. Woo hoo!

          Many thanks for the troubleshooting help.

          Regards,
          Bill Karwin
          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_mac" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        Your message has been successfully submitted and would be delivered to recipients shortly.