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

svnlog filetype autodetection

Expand Messages
  • Adam Monsen
    svnlog.vim includes a hint to add the following script to ~/.vim/ scripts.vim to autodetect if a particular file is a file containing Subversion log messages.
    Message 1 of 6 , Jul 1, 2008
    • 0 Attachment
      svnlog.vim includes a hint to add the following script to ~/.vim/
      scripts.vim to autodetect if a particular file is a file containing
      Subversion log messages. However, the script seems broken. Here's the
      script:

      if did_filetype() " filetype already set...
      finish " ...then don't do these checks
      endif
      if getline(1) =~ /^-\{72}$/
      setfiletype svnlog
      endif

      When opening a file, I get:

      "/tmp/l" 108L, 5557C
      Error detected while processing /home/adamm/.vim/scripts.vim:
      line 4:
      E15: Invalid expression: /^-\{72}$/
      E15: Invalid expression: getline(1) =~ /^-\{72}$/
      Press ENTER or type command to continue

      Anyone know how to fix this?

      I'm using the same svnlog.vim that appears here:
      http://dev.pocoo.org/~mitsuhiko/svnlog.vim

      I'm using the Vim that comes with Ubuntu 8.04:

      VIM - Vi IMproved 7.1 (2007 May 12, compiled Jan 31 2008 12:00:11)
      Included patches: 1-138

      Thank you,

      --
      Adam Monsen
      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Benjamin Fritz
      I m guessing that: ... should be: if getline(1) =~ /^- {72 }$/ setfiletype svnlog endif Note the extra to make a {... } group, specifying a line of 72 -
      Message 2 of 6 , Jul 1, 2008
      • 0 Attachment
        I'm guessing that:

        On 7/1/08, Adam Monsen <haircut@...> wrote:
        > if getline(1) =~ /^-\{72}$/
        > setfiletype svnlog
        > endif
        >

        should be:

        if getline(1) =~ /^-\{72\}$/
        setfiletype svnlog
        endif

        Note the extra \ to make a \{...\} group, specifying a line of 72 '-'
        characters.

        Apparently this is a common occurrence in svn log files or something.

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Benjamin Fritz
        ... Oh, and also enclose it in single quotes instead of / characters to make it a string, like this: ^- {72 }$
        Message 3 of 6 , Jul 1, 2008
        • 0 Attachment
          On 7/1/08, Benjamin Fritz <fritzophrenic@...> wrote:
          > I'm guessing that:
          >
          >
          > On 7/1/08, Adam Monsen <haircut@...> wrote:
          > > if getline(1) =~ /^-\{72}$/
          > > setfiletype svnlog
          > > endif
          > >
          >
          >
          > should be:
          >
          >
          > if getline(1) =~ /^-\{72\}$/
          > setfiletype svnlog
          > endif
          >
          >
          > Note the extra \ to make a \{...\} group, specifying a line of 72 '-'
          > characters.
          >
          > Apparently this is a common occurrence in svn log files or something.
          >

          Oh, and also enclose it in single quotes instead of '/' characters to
          make it a string, like this:

          '^-\{72\}$'

          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Gary Johnson
          ... According to :help / { , the } is not necessary--just } will suffice. Regards, Gary --~--~---------~--~----~------------~-------~--~----~ You received
          Message 4 of 6 , Jul 1, 2008
          • 0 Attachment
            On 2008-07-01, Benjamin Fritz <fritzophrenic@...> wrote:
            > I'm guessing that:
            >
            > On 7/1/08, Adam Monsen <haircut@...> wrote:
            > > if getline(1) =~ /^-\{72}$/
            > > setfiletype svnlog
            > > endif
            > >
            >
            > should be:
            >
            > if getline(1) =~ /^-\{72\}$/
            > setfiletype svnlog
            > endif
            >
            > Note the extra \ to make a \{...\} group, specifying a line of 72 '-'
            > characters.

            According to ":help /\{", the \} is not necessary--just } will
            suffice.

            Regards,
            Gary


            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_use" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • Benjamin Fritz
            ... Oh, so it can...I missed that somehow. Cool. It does need to be a string though, rather than surrounding it with / .
            Message 5 of 6 , Jul 1, 2008
            • 0 Attachment
              On 7/1/08, Gary Johnson <garyjohn@...> wrote:
              >
              > On 2008-07-01, Benjamin Fritz <fritzophrenic@...> wrote:
              > > I'm guessing that:
              > >
              > > On 7/1/08, Adam Monsen <haircut@...> wrote:
              > > > if getline(1) =~ /^-\{72}$/
              > > > setfiletype svnlog
              > > > endif
              > > >
              > >
              > > should be:
              > >
              > > if getline(1) =~ /^-\{72\}$/
              > > setfiletype svnlog
              > > endif
              > >
              > > Note the extra \ to make a \{...\} group, specifying a line of 72 '-'
              > > characters.
              >
              >
              > According to ":help /\{", the \} is not necessary--just } will
              > suffice.
              >

              Oh, so it can...I missed that somehow. Cool.

              It does need to be a string though, rather than surrounding it with '/'.

              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_use" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---
            • Adam Monsen
              ... Awesome! That worked. Thank you! I ll send a patch to the maintainer of svnlog.vim, in case he s interested. -- Adam Monsen
              Message 6 of 6 , Jul 1, 2008
              • 0 Attachment
                On Jul 1, 11:35 am, "Benjamin Fritz" wrote:
                > enclose it in single quotes instead of '/' characters to
                > make it a string, like this:
                >
                > '^-\{72\}$'

                Awesome! That worked. Thank you!

                I'll send a patch to the maintainer of svnlog.vim, in case he's
                interested.

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