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

wish: semi-automatic inst of syntax files from central location (www.vim.org) ?

Expand Messages
  • Yakov Lerner
    Hello, The problem. ... Recently, I needed to edit the rpm spec file. The person who edited the spec file before me was xemacs guy. He opened the file in
    Message 1 of 11 , Aug 6, 2003
    • 0 Attachment
      Hello,

      The problem.
      -----------
      Recently, I needed to edit the rpm spec file. The person who edited
      the spec file before me was xemacs guy. He opened the file in xemacs
      and showed me around the file, all syntax-colored in xemacs. Frowning upon
      his xemacs, I opened the file in gvim, and ... there were no syntax coloring.

      I realize there are dozens of rarely used languages and it's hassle
      to keep myriad of syntax files updated in the distribution. And complex
      syntax files are probably updated quote often.

      Possible solution
      -----------------

      What if vim.org had a stable URL for quering the latest version, and
      for downloading the syntax files, and the vim had a plugin allowing
      for semi-automatic remote downloading (and installing) the syntax files ?

      Example:

      % vim mypackage.spec
      ..... ~/.vimrc has: let g:auto_install_syntaxes=ask
      ..... ~/.vimrc has: let g_remote_syntaxes=http://www.vim.org/auto_syntaxes/
      vim: Do you want to query central repository for syntax file for *.spec ?
      user: Yes!
      vim: There are two versions of spec.vim syntax: (1) From J. Doe (2) From D. Jones
      user: 1
      vim: Quering .. downloading ... Syntax rpmspec.vim installed.
      user: Cool!

      By semi-automatic, I mean that auto-installing plugin would
      ask user whether to query/download from central repository.

      The life would be easier for user to update/install the latest version of his
      local syntax file with one command:

      :InstallSyntax " for current file, no arguments needed
      vim: quering www.vim.org .. latest version is 1.27 .. sh.vim installed.
      user: wow!
      :InstallSyntax *.spec " for specific language
      :InstallSyntax ALL " having fast internet ...

      I wouldn't be humiliated in the face of the user of xemacs then ...

      This solution would need involvement of administrator of central www-site,
      besides writing of plugin ....

      What do you fellow vimers think ?

      Yakov Lerner
    • David Brown
      ... Hmm. spec.vim has been around for quite a while in vim. It also hasn t changed in the distribution much (6.2c and then not since 6.00a. ... I would
      Message 2 of 11 , Aug 6, 2003
      • 0 Attachment
        On Thu, Aug 07, 2003 at 09:14:17AM +0300, Yakov Lerner wrote:

        > Recently, I needed to edit the rpm spec file. The person who edited

        > I realize there are dozens of rarely used languages and it's hassle
        > to keep myriad of syntax files updated in the distribution. And complex
        > syntax files are probably updated quote often.

        Hmm. spec.vim has been around for quite a while in vim. It also hasn't
        changed in the distribution much (6.2c and then not since 6.00a.

        > What do you fellow vimers think ?

        I would suspect something else is wrong. Is syntax highlighting enabled
        for other file types?

        Dave Brown
      • Yakov Lerner
        ... Now that I try it on the same machine (RedHat 8, vim 6.1.165), syntax highlighting does work by default for .spec files. I don t know what s different now
        Message 3 of 11 , Aug 7, 2003
        • 0 Attachment
          David Brown wrote:
          > I would suspect something else is wrong. Is syntax highlighting enabled
          > for other file types?

          Now that I try it on the same machine (RedHat 8, vim 6.1.165),
          syntax highlighting does work by default for .spec files.
          I don't know what's different now vs then.
          Maybe $TERM was set differently back then. I did vim not gvim.
          I definitely remember that I tried 'syntax on'/'syntax off' back
          then when we viewed same file in xemacs and in vim.
          Date of .exrc and .vimrc is very old. I don't know.

          I still wish for single-command-installation 'InstallSyntax' command.
          There are lots of computers around, and many have outdated sh.vim syntax-files.

          Lerner


          David Brown wrote:
          > On Thu, Aug 07, 2003 at 09:14:17AM +0300, Yakov Lerner wrote:
          >
          >
          >>Recently, I needed to edit the rpm spec file. The person who edited
          >
          >
          >>I realize there are dozens of rarely used languages and it's hassle
          >>to keep myriad of syntax files updated in the distribution. And complex
          >>syntax files are probably updated quote often.
          >
          >
          > Hmm. spec.vim has been around for quite a while in vim. It also hasn't
          > changed in the distribution much (6.2c and then not since 6.00a.
          >
          >
          >>What do you fellow vimers think ?
          >
          >
          > I would suspect something else is wrong. Is syntax highlighting enabled
          > for other file types?
          >
          > Dave Brown
          >
        • David Necas (Yeti)
          ... The file - filetype mapping is done in filetype.vim (and scripts.vim), and isn t always that simple as `*.spec = spec . And if you have working filetype
          Message 4 of 11 , Aug 7, 2003
          • 0 Attachment
            On Thu, Aug 07, 2003 at 09:14:17AM +0300, Yakov Lerner wrote:
            > Example:
            >
            > % vim mypackage.spec
            > ..... ~/.vimrc has: let g:auto_install_syntaxes=ask
            > ..... ~/.vimrc has: let
            > g_remote_syntaxes=http://www.vim.org/auto_syntaxes/
            > vim: Do you want to query central repository for syntax file for
            > *.spec ?

            The file -> filetype mapping is done in filetype.vim (and
            scripts.vim), and isn't always that simple as `*.spec => spec'.

            And if you have working filetype detection for the filetype,
            you have the syntax file too, unless you intentionally
            didn't install it.

            So how would the silly thing find there's something to offer
            in the first place?

            Yeti


            --
            Do not use tab characters. Their effect is not predictable.
          • Bram Moolenaar
            ... There has been a spec syntax file for quite a while. There must be something wrong in your Vim setup. You can also update to the latest runtime files
            Message 5 of 11 , Aug 7, 2003
            • 0 Attachment
              Yakov Lerner wrote:

              > The problem.
              > -----------
              > Recently, I needed to edit the rpm spec file. The person who edited
              > the spec file before me was xemacs guy. He opened the file in xemacs
              > and showed me around the file, all syntax-colored in xemacs. Frowning
              > upon his xemacs, I opened the file in gvim, and ... there were no
              > syntax coloring.

              There has been a spec syntax file for quite a while. There must be
              something wrong in your Vim setup.

              You can also update to the latest runtime files (including syntax files)
              from the ftp server. An easy way to do this is explained in this page:

              http://www.vim.org/runtime.php

              This does require installing Aap, but after that it's automatic
              (checksums are used to find out which file changed).

              > I realize there are dozens of rarely used languages and it's hassle
              > to keep myriad of syntax files updated in the distribution. And complex
              > syntax files are probably updated quote often.

              True. And the distribution is getting quite big. I have been thinking
              of dropping a few syntax files that hardly anybody uses, but since it's
              not easy to obtain them I haven't done that.

              > Possible solution
              > -----------------
              >
              > What if vim.org had a stable URL for quering the latest version, and
              > for downloading the syntax files, and the vim had a plugin allowing
              > for semi-automatic remote downloading (and installing) the syntax files ?

              Yes, that would be useful. This can be combined with the Vim-online
              storage of Vim scripts. I think that this is a nice idea.

              > The life would be easier for user to update/install the latest version
              > of his local syntax file with one command:
              >
              > :InstallSyntax " for current file, no arguments needed
              > vim: quering www.vim.org .. latest version is 1.27 .. sh.vim installed.
              > user: wow!
              > :InstallSyntax *.spec " for specific language
              > :InstallSyntax ALL " having fast internet ...

              How can this be made to work in a portable way? The netrw plugin can be
              used for downloading perhaps. Unfortunately, not many systems have a
              command to download files over http. Commands like wget and fetch may
              need to be installed.

              The Aap program could be used, like it's done to get the runtime files.
              But Aap has to be installed as well.

              --
              hundred-and-one symptoms of being an internet addict:
              54. You start tilting your head sideways to smile. :-)

              /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
              /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
              \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
              \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
            • Yakov Lerner
              ... Other than by unrecognized extension (*.spec), I agree with you, it s impossible. Science fiction. Unless InstallSyntax downloads the updated copy of
              Message 6 of 11 , Aug 7, 2003
              • 0 Attachment
                David Necas (Yeti) wrote:
                > Yakov Lerner wrote:
                > The file -> filetype mapping is done in filetype.vim (and
                > scripts.vim), and isn't always that simple as `*.spec => spec'.
                >
                > And if you have working filetype detection for the filetype,
                > you have the syntax file too, unless you intentionally
                > didn't install it.
                >
                > So how would the silly thing find there's something to offer
                > in the first place?

                Other than by unrecognized extension (*.spec), I agree with you,
                it's impossible. Science fiction. Unless 'InstallSyntax' downloads
                the updated copy of filetype.vim first, maybe ...

                However, assuming that 'InstallSyntax' does download the updated
                copy of filetype.vim, it's possible that manual 'InstallSyntax'
                will guess and download the new syntax file:

                :InstallSyntax " for current file, no arguments needed
                vim: quering www.vim.org .. latest version is 1.27 .. sh.vim installed.
                user: wow!
                :InstallSyntax *.spec " for specific language
                :InstallSyntax ALL " having fast internet ...

                To me, the difference between 1-step installation vs N-step
                installation is HUGE. Multiply number of steps N by M, the number
                of machines, then by K, the number of OS resinstalls on every machine,
                then by L, the number of non-root users ...

                Lerner
              • Yakov Lerner
                ... Yes! ... I see following possibilities: 1. To include [non-blocking] sockets into vim. (But I know that Bram doesn t want this). 2. To include the
                Message 7 of 11 , Aug 7, 2003
                • 0 Attachment
                  Bram Moolenaar wrote:


                  > Yakov Lerner wrote:
                  > > What if vim.org had a stable URL for quering the latest version, and
                  > > for downloading the syntax files, and the vim had a plugin allowing
                  > > for semi-automatic remote downloading (and installing) the syntax files ?

                  > Yes, that would be useful. This can be combined with the Vim-online
                  > storage of Vim scripts. I think that this is a nice idea.
                  Yes!

                  > > :InstallSyntax " for current file, no arguments needed
                  > > vim: quering www.vim.org .. latest version is 1.27 .. sh.vim installed.
                  > > user: wow!
                  > > :InstallSyntax *.spec " for specific language
                  > > :InstallSyntax ALL " having fast internet ...
                  >
                  > How can this be made to work in a portable way? The netrw plugin can be
                  > used for downloading perhaps. Unfortunately, not many systems have a
                  > command to download files over http. Commands like wget and fetch may
                  > need to be installed.

                  I see following possibilities:

                  1. To include [non-blocking] sockets into vim.
                  (But I know that Bram doesn't want this).

                  2. To include the stripped-down minimalistic analogue of wget
                  right into vim distribution. The really useful minimalistic and
                  portable client will be well under 500..1000 lines. ( No need for
                  -r(recursivity), no need for authentication, no need for non-http
                  protocols ..).

                  3. To invoke old-fashioned ftp client for portability. It's
                  very hard to script it but it's possible, and it's probably present
                  everywhere. Ftp is much slower that http for small files, though.

                  4. To build the 'minimalistic-wget' functionality (same as (2))
                  right into vim, but invocable NOT as function or command, only
                  as a subporocess (as exec 'vim -wget ...) NOT as function or command.
                  Well the difference between (4) and (2) is negligible.

                  Yakov
                • Bram Moolenaar
                  ... Indeed. ... An alternative could be to use Python for this. The more ideas pop up for extensions that are not closely related to the actual editing of
                  Message 8 of 11 , Aug 7, 2003
                  • 0 Attachment
                    Yakov Lerner wrote:

                    > > How can this be made to work in a portable way? The netrw plugin can be
                    > > used for downloading perhaps. Unfortunately, not many systems have a
                    > > command to download files over http. Commands like wget and fetch may
                    > > need to be installed.
                    >
                    > I see following possibilities:
                    >
                    > 1. To include [non-blocking] sockets into vim.
                    > (But I know that Bram doesn't want this).

                    Indeed.

                    > 2. To include the stripped-down minimalistic analogue of wget
                    > right into vim distribution. The really useful minimalistic and
                    > portable client will be well under 500..1000 lines. ( No need for
                    > -r(recursivity), no need for authentication, no need for non-http
                    > protocols ..).
                    >
                    > 3. To invoke old-fashioned ftp client for portability. It's
                    > very hard to script it but it's possible, and it's probably present
                    > everywhere. Ftp is much slower that http for small files, though.
                    >
                    > 4. To build the 'minimalistic-wget' functionality (same as (2))
                    > right into vim, but invocable NOT as function or command, only
                    > as a subporocess (as exec 'vim -wget ...) NOT as function or command.
                    > Well the difference between (4) and (2) is negligible.

                    An alternative could be to use Python for this. The more ideas pop up
                    for extensions that are not closely related to the actual editing of
                    text, the more I find that using Python for these things would be really
                    helpful.

                    It does require installing Python and compiling Vim with the Python
                    interface, but that should be possible on nearly every platform.

                    Taking it a step further would use Aap to do it. But including Aap in
                    the Vim distribution might be interpreted as misusing my position to
                    push the use of Aap.

                    - Bram

                    --
                    Creating the world with Emacs: M-x let-there-be-light
                    Creating the world with Vim: :make world

                    /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                    /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
                    \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
                    \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
                  • Charles E. Campbell
                    ... Hello! Several points: * Automatic queries: having vim ask the user if it should check a central repository for updates to syntax/*.vim files would rapidly
                    Message 9 of 11 , Aug 7, 2003
                    • 0 Attachment
                      On Thu, Aug 07, 2003 at 09:14:17AM +0300, Yakov Lerner wrote:
                      > What if vim.org had a stable URL for querying the latest version, and
                      > for downloading the syntax files, and the vim had a plugin allowing
                      > for semi-automatic remote downloading (and installing) the syntax files ?
                      > ...
                      > By semi-automatic, I mean that auto-installing plugin would
                      > ask user whether to query/download from central repository.
                      ---------------------------------------------------------------------

                      Hello!

                      Several points:

                      * Automatic queries: having vim ask the user if it should
                      check a central repository for updates to syntax/*.vim
                      files would rapidly grow tiresome. One would receive
                      such a query every time one opened a file!

                      * New syntax file queries: this situation is probably less
                      onerous.

                      Guess I don't care for querying the user about this. However, the idea
                      of a syntax-highlighting repository seems beneficial to me, as many
                      computers seem to have internet access these days.

                      I have a script (<GetLatestVimScripts.vim>, available at
                      http://vim.sourceforge.net/scripts/script.php?script_id=642) that
                      automates querying vim.sf.net for the latest versions of desired scripts
                      and downloading them as indicated. I'm sure it could easily be
                      modified to do the same sort of thing for syntax files. It uses wget.

                      I haven't been able to get Python to run on my old SGI; that reason
                      plus lack-of-time is why, for example, I haven't gotten aap/agide
                      running on it. I'd rather keep Python/Perl/Ruby/etc out of the
                      loop for downloading syntax files, except as an optional thing.

                      Such a repository could be used by Bram to build a separate syntax
                      highlighting (why not indent, too?) downloadable file
                      (vim-6.X-synhi.tar.bz2) automatically for those who would find it useful
                      and remove it from vim-6.2.tar.bz2.

                      IMHO the repository would need to restrict updates to their official
                      maintainers, however. Apparently anyone can send updates for any
                      scripts without the need to contact the original author of them, let
                      alone have any need to get their acquiescence. We're lucky some jerk
                      hasn't decided to flood the current archive with thousands of bogus
                      scripts.

                      Regards,
                      Chip Campbell

                      --
                      Charles E Campbell, Jr, PhD _ __ __
                      Goddard Space Flight Center / /_/\_\_/ /
                      cec@... /_/ \/_//_/
                      PGP public key: http://www.erols.com/astronaut/pgp.html
                    • Aron Griffis
                      Bram Moolenaar wrote: [Thu Aug 07 2003, 05:32:06AM EDT] ... I just tried this method, and it says # aap -f ftp://ftp.vim.org/pub/vim/runtime/main.aap fetch
                      Message 10 of 11 , Aug 11, 2003
                      • 0 Attachment
                        Bram Moolenaar wrote: [Thu Aug 07 2003, 05:32:06AM EDT]
                        > http://www.vim.org/runtime.php
                        >
                        > This does require installing Aap, but after that it's automatic
                        > (checksums are used to find out which file changed).

                        I just tried this method, and it says

                        # aap -f ftp://ftp.vim.org/pub/vim/runtime/main.aap fetch
                        Aap: Recipe file "/var/tmp/portage/vim-core-6.2-r2/work/vim62/runtime/ftp:/ftp.vim.org/pub/vim/runtime/main.aap" not found

                        It appears to be prepending my current working directory to the URL for
                        the recipe file.

                        Aron
                      • Bram Moolenaar
                        ... You need a newer version of Aap. The support for fetching a recipe specified on the command line was added in version 1.003. -- From know your smileys :
                        Message 11 of 11 , Aug 12, 2003
                        • 0 Attachment
                          Aron Griffis wrote:

                          > Bram Moolenaar wrote: [Thu Aug 07 2003, 05:32:06AM EDT]
                          > > http://www.vim.org/runtime.php
                          > >
                          > > This does require installing Aap, but after that it's automatic
                          > > (checksums are used to find out which file changed).
                          >
                          > I just tried this method, and it says
                          >
                          > # aap -f ftp://ftp.vim.org/pub/vim/runtime/main.aap fetch
                          > Aap: Recipe file "/var/tmp/portage/vim-core-6.2-r2/work/vim62/runtime/ftp:/ftp.vim.org/pub/vim/runtime/main.aap" not found
                          >
                          > It appears to be prepending my current working directory to the URL for
                          > the recipe file.

                          You need a newer version of Aap. The support for fetching a recipe
                          specified on the command line was added in version 1.003.

                          --
                          From "know your smileys":
                          [:-) Frankenstein's monster

                          /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                          /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
                          \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
                          \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
                        Your message has been successfully submitted and would be delivered to recipients shortly.