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

visual 2html.vim

Expand Messages
  • Hofmann, Joachim
    Hello, is it possible to pass only visually selected lines to 2html.vim? Thank You Joachim ########################################### This message has been
    Message 1 of 6 , Apr 2, 2003
    • 0 Attachment
      Hello,

      is it possible to pass only visually selected lines to 2html.vim?

      Thank You

      Joachim
      ###########################################

      This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
      For more information, connect to http://www.F-Secure.com/
    • Bram Moolenaar
      ... Good question. No, it currently isn t possible. You can cut out the lines you want to convert, but that might very well change the syntax highlighting.
      Message 2 of 6 , Apr 2, 2003
      • 0 Attachment
        Joachim Hofmann wrote:

        > is it possible to pass only visually selected lines to 2html.vim?

        Good question. No, it currently isn't possible. You can cut out the
        lines you want to convert, but that might very well change the syntax
        highlighting.

        Since 2html.vim is a script, it doesn't take a line range argument. It
        would need to be wrapped in a user command to do this. The user command
        could check for a range, set a couple of variables and 2html.vim would
        do only the specified lines when these variables are set.

        It's not too difficult, since 2html.vim has uses "s:lnum" to go over the
        lines. Perhaps someone with a bit of Vim scriptology can make this.

        --
        Q: How does a UNIX Guru do Sex ?
        A: unzip;strip;touch;finger;mount;fsck;more;yes;umount;sleep

        /// 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 at Amazon -- http://ICCF.nl/click1.html ///
      • Christian J. Robinson
        ... Put the following in a script, and apply the patch below to 2html.vim. Then you can highlight a section of text and type :Convert2HTML . command! -range=%
        Message 3 of 6 , Apr 3, 2003
        • 0 Attachment
          Yesterday (Wed, 2 Apr 2003), Bram Moolenaar wrote:

          > Joachim Hofmann wrote:
          >
          >> is it possible to pass only visually selected lines to 2html.vim?
          >
          > It's not too difficult, since 2html.vim has uses "s:lnum" to go over
          > the lines. Perhaps someone with a bit of Vim scriptology can make
          > this.

          Put the following in a script, and apply the patch below to 2html.vim.
          Then you can highlight a section of text and type ":Convert2HTML".


          command! -range=% Convert2HTML :call Convert2HTML('<line1>', '<line2>')

          function! Convert2HTML(line1, line2)
          if a:line2 >= a:line2
          let g:_2html_start_line = a:line1
          let g:_2html_end_line = a:line2
          else
          let g:_2html_end_line = a:line1
          let g:_2html_start_line = a:line2
          endif

          runtime syntax/2html.vim

          unlet g:_2html_start_line
          unlet g:_2html_end_line
          endfunction



          *** syntax/2html.vim~ Tue Apr 1 19:41:55 2003
          --- syntax/2html.vim Thu Apr 3 20:17:51 2003
          ***************
          *** 172,179 ****
          endwhile

          " Loop over all lines in the original text
          ! let s:end = line("$")
          ! let s:lnum = 1
          while s:lnum <= s:end

          " Get the current line
          --- 172,188 ----
          endwhile

          " Loop over all lines in the original text
          ! if exists("_2html_start_line")
          ! let s:lnum = _2html_start_line
          ! else
          ! let s:lnum = 1
          ! endif
          ! if exists("_2html_end_line")
          ! let s:end = _2html_end_line
          ! else
          ! let s:end = line("$")
          ! endif
          !
          while s:lnum <= s:end

          " Get the current line


          --
          Love your enemy, it will scare the hell out of them. == Mark Twain
          Christian J. Robinson <infynity@...> http://infynity.spodzone.com/
          PGP key: 0x893B0EAF / 0xFB698360 http://infynity.spodzone.com/pgp
        • Bram Moolenaar
          ... Thanks. I ll include the change to 2html.vim. Using html_start_line and html_end_line. Similar variables are already used in 2html.vim,
          Message 4 of 6 , Apr 4, 2003
          • 0 Attachment
            Christian J. Robinson wrote:

            > >> is it possible to pass only visually selected lines to 2html.vim?
            > >
            > > It's not too difficult, since 2html.vim has uses "s:lnum" to go over
            > > the lines. Perhaps someone with a bit of Vim scriptology can make
            > > this.
            >
            > Put the following in a script, and apply the patch below to 2html.vim.
            > Then you can highlight a section of text and type ":Convert2HTML".

            Thanks. I'll include the change to 2html.vim. Using html_start_line
            and html_end_line. Similar variables are already used in 2html.vim,
            "_2html_start_line" is a bit obscure.

            I'm not sure where to put the User function. In a plugin perhaps?

            --
            MARTHA'S WAY: Don't throw out all that leftover wine. Freeze into ice cubes
            for future use in casseroles and sauces.
            MY WAY: What leftover wine?

            /// 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 at Amazon -- http://ICCF.nl/click1.html ///
          • Benji Fisher
            ... In reading the previous post, I noticed a strange line in the function: if a:line2 = a:line2 You could put the function in vimrc_example.vim (ugh) or in a
            Message 5 of 6 , Apr 5, 2003
            • 0 Attachment
              Bram Moolenaar wrote:
              > Christian J. Robinson wrote:
              >
              >
              >>>>is it possible to pass only visually selected lines to 2html.vim?
              >>>
              >>>It's not too difficult, since 2html.vim has uses "s:lnum" to go over
              >>>the lines. Perhaps someone with a bit of Vim scriptology can make
              >>>this.
              >>
              >>Put the following in a script, and apply the patch below to 2html.vim.
              >>Then you can highlight a section of text and type ":Convert2HTML".
              >
              >
              > Thanks. I'll include the change to 2html.vim. Using html_start_line
              > and html_end_line. Similar variables are already used in 2html.vim,
              > "_2html_start_line" is a bit obscure.
              >
              > I'm not sure where to put the User function. In a plugin perhaps?

              In reading the previous post, I noticed a strange line in the function:

              if a:line2 >= a:line2

              You could put the function in vimrc_example.vim (ugh) or in a new plugin that
              also contains the Sort() routine currently in explorer.vim .

              --Benji Fisher
            • Christian J. Robinson
              ... Hash: SHA1 ... Ugh, my mistake. It should be: if a:line2 = a:line1 - - Christian - -- Children seldom misquote you. In fact, they usually repeat word for
              Message 6 of 6 , Apr 5, 2003
              • 0 Attachment
                -----BEGIN PGP SIGNED MESSAGE-----
                Hash: SHA1

                Today (Sat, 5 Apr 2003), Benji Fisher wrote:

                > Bram Moolenaar wrote:
                >
                >> Christian J. Robinson wrote:
                >>
                >>>Put the following in a script, and apply the patch below to 2html.vim.
                >>>Then you can highlight a section of text and type ":Convert2HTML".
                >>
                >> Thanks. I'll include the change to 2html.vim. Using html_start_line
                >> and html_end_line. Similar variables are already used in 2html.vim,
                >> "_2html_start_line" is a bit obscure.
                >
                > In reading the previous post, I noticed a strange line in the function:
                >
                > if a:line2 >= a:line2

                Ugh, my mistake. It should be:

                if a:line2 >= a:line1

                - - Christian

                - --
                Children seldom misquote you.
                In fact, they usually repeat word for word what you shouldn't have said.
                Christian J. Robinson <infynity@...> http://infynity.spodzone.com/
                PGP key: 0x893B0EAF / 0xFB698360 http://infynity.spodzone.com/pgp
                -----BEGIN PGP SIGNATURE-----
                Version: GnuPG v1.0.6 (GNU/Linux)
                Comment: For info see http://www.gnupg.org

                iD8DBQE+j2qiNCSthIk7Dq8RArrYAJ0dExVb9yXckMggl4W8ZrsTcAk8nACfcwwx
                MVDU8fOpZov58Zk0qxFMyhw=
                =d0Li
                -----END PGP SIGNATURE-----
              Your message has been successfully submitted and would be delivered to recipients shortly.