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

Re: Using filetype plugin for plist file

Expand Messages
  • listuser
    Thank you for your replay, but actually it does not really help. ... what i am supposed to get out of it to answer my question. I know how to use autocmd
    Message 1 of 6 , Jan 14, 2007
    • 0 Attachment
      Thank you for your replay, but actually it does not really help.
      :he autocommand is far over 1200 lines long and I do not really know,
      what i am supposed to get out of it to answer my question.

      I know how to use 'autocmd BufReadPre,FileReadPre', in a script in
      the plugin directory but I'd prefer to use a ftplugin.
      Any suggestions?

      Best regards
      Martin


      > Hi,
      >
      >
      >> I have a plugin which I want to use as a filetype plugin for
      >> binary plist files (e.g. the ones locatet in ~/Library/Preferences).
      >> I have "filetype plugin indent on" in my .vimrc file.
      >>
      >> The plugin works correctly when i put it into ~/.vim/plugin/
      >> plist.vim but of course it is loaded for any filetype.
      >> When I put it into ~/vim/ftplugin/plist.vim ist is not loaded when
      >> editing plist files.
      >>
      >> What do do I have to do, to make vim load my plist.vim file when I
      >> edit a file with the suffix .plist?
      >> I have read ":help add-filetype-plugin" I still can't figure it out.
      >>
      >
      > :he autocommand
      >




      --
      VIM - Vi IMproved 7.0
      MacOS X (unix) version
      Included patches: 1-182
    • Andre Berger
      ... [...] ... Martin, no top-posting please. This works for me: let SOURCEME=expand( /usr/local/etc/vim/plist.vim ) if filereadable(SOURCEME) exe source .
      Message 2 of 6 , Jan 14, 2007
      • 0 Attachment
        * listuser (2007-01-15):
        > Thank you for your replay, but actually it does not really help.
        > :he autocommand is far over 1200 lines long and I do not really know, what i am supposed to get out of it to answer my question.

        > I know how to use 'autocmd BufReadPre,FileReadPre', in a script in the plugin directory but I'd prefer to use a ftplugin.
        > Any suggestions?
        [...]
        > >>I have a plugin which I want to use as a filetype plugin for binary plist files (e.g. the ones locatet in ~/Library/Preferences).
        > >>I have "filetype plugin indent on" in my .vimrc file.

        > >>The plugin works correctly when i put it into ~/.vim/plugin/plist.vim but of course it is loaded for any filetype.
        > >>When I put it into ~/vim/ftplugin/plist.vim ist is not loaded when editing plist files.

        > >>What do do I have to do, to make vim load my plist.vim file when I edit a file with the suffix .plist?
        > >>I have read ":help add-filetype-plugin" I still can't figure it out.

        > >:he autocommand

        Martin, no top-posting please. This works for me:

        let SOURCEME=expand("/usr/local/etc/vim/plist.vim")
        if filereadable(SOURCEME)
        exe "source " . SOURCEME
        endif

        " treat .plist as xml
        au BufRead,BufNewFile *.plist set filetype=xml

        -Andre
      • listuser
        Hello, thanks for the reply. ... I didn t need this part since my plugin ist stored in .vim/ftplugin ... This helped. I just added au BufRead,BufNewFile
        Message 3 of 6 , Jan 15, 2007
        • 0 Attachment
          Hello,

          thanks for the reply.


          > let SOURCEME=expand("/usr/local/etc/vim/plist.vim")
          > if filereadable(SOURCEME)
          > exe "source " . SOURCEME
          > endif

          I didn't need this part since my plugin ist stored in .vim/ftplugin

          >
          > " treat .plist as xml
          > au BufRead,BufNewFile *.plist set filetype=xml

          This helped.
          I just added
          "au BufRead,BufNewFile *.plist set filetype=plist"
          At the end of my .vimrc file.

          Thanks again
          Martin



          --
          VIM - Vi IMproved 7.0
          MacOS X (unix) version
          Included patches: 1-182
        • listuser
          ... Thank you for pointing me to the right direction. Actually I have partially solved my question (see http://
          Message 4 of 6 , Jan 20, 2007
          • 0 Attachment
            Am 18.01.2007 um 22:19 schrieb Benji Fisher:

            > On Jan 14, 2007, at 1:09 PM, listuser wrote:
            >
            >> Hello together,
            >>
            >> I have a plugin which I want to use as a filetype plugin for
            >> binary plist files (e.g. the ones locatet in ~/Library/Preferences).
            >> I have "filetype plugin indent on" in my .vimrc file.
            >>
            >> The plugin works correctly when i put it into ~/.vim/plugin/
            >> plist.vim but of course it is loaded for any filetype.
            >> When I put it into ~/vim/ftplugin/plist.vim ist is not loaded when
            >> editing plist files.
            >>
            >> What do do I have to do, to make vim load my plist.vim file when I
            >> edit a file with the suffix .plist?
            >> I have read ":help add-filetype-plugin" I still can't figure it out.
            >>
            >> Any help will be appreciatetd.
            >
            > If you want to use the ftplugin mechanism, you have to tell
            > vim that *.plist describes a file of type plist. See
            >
            > :help new-filetype
            >
            > for how to do this. There are several options there: I suggest
            > using C.

            Thank you for pointing me to the right direction.
            Actually I have partially solved my question (see http://
            tech.groups.yahoo.com/group/vim-mac/message/4272) but
            my solution is still improvable.

            >
            > By the way, what is the binary plist format? Is it some sort
            > of compressed XML?

            As of Mac OS X 10.3 or so many plist files are stored in binary
            format. They must be converted to xml before they can be
            edited like a plain text file. This can be done easyly with the
            command plutil (see man plutil for details).

            I have written a ftplugin (based on the work of Moritz Heckscher) to
            automate this conversion forward and backwards.
            I plan to publish it after some further testing and improvement
            becaus I think it might br useful to other macusers.

            Best regards
            Martin

            PS: Pleas send replies also to vim-mac@... - otherwise they will
            not get to everybody!

            --
            VIM - Vi IMproved 7.0
            MacOS X (unix) version
            Included patches: 1-182
          • Benji Fisher
            ... Yes, I think it will be useful. Thanks for the tip. One of the many projects I cannot find the time to complete is figuring out how to adapt the gzip
            Message 5 of 6 , Feb 1, 2007
            • 0 Attachment
              On Sat, Jan 20, 2007 at 12:59:21PM +0100, listuser wrote:
              >
              > Am 18.01.2007 um 22:19 schrieb Benji Fisher:
              >
              > > By the way, what is the binary plist format? Is it some sort
              > >of compressed XML?
              >
              > As of Mac OS X 10.3 or so many plist files are stored in binary
              > format. They must be converted to xml before they can be
              > edited like a plain text file. This can be done easyly with the
              > command plutil (see man plutil for details).
              >
              > I have written a ftplugin (based on the work of Moritz Heckscher) to
              > automate this conversion forward and backwards.
              > I plan to publish it after some further testing and improvement
              > becaus I think it might br useful to other macusers.

              Yes, I think it will be useful. Thanks for the tip.

              One of the many projects I cannot find the time to complete is
              figuring out how to adapt the gzip plugin (especially the parts in
              $VIMRUNTIME/autoload/ ) to work with other filters. I have filters that
              let me read ms-word, ms-excel, and PDF in vim, and there should be an
              easy way to invoke them. The binary plist format is another example.

              > Best regards
              > Martin
              >
              > PS: Pleas send replies also to vim-mac@... - otherwise they will
              > not get to everybody!

              Sorry. After my Linux computer died, I was using Mail.app for a
              while, but not long enough to develop good habits with it. Now that I
              have set up mutt on my iMac, I am again more likely to give that advice
              than to need it. ;)

              HTH --Benji Fisher
            Your message has been successfully submitted and would be delivered to recipients shortly.