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

Command to generate GUID ?

Expand Messages
  • Timothy Madden
    Hello I want to create my install packages with WiX in .wxs source files edited with Vim. For WiX I need to generate a new GUID for every new package I
    Message 1 of 4 , Dec 1, 2008
    • 0 Attachment
      Hello

      I want to create my install packages with WiX in .wxs source files
      edited with Vim.
      For WiX I need to generate a new GUID for every new package I
      distribute and every
      major version of my program.

      Could someone create a :command that would check the current selection or
      the next 36 chararcters after the cursor to be hexadecimal digits
      including minus
      sign (anywhere in between) and then replace this text with the output
      from a command
      line executable (bin/GUIDGEN.exe) ?

      Is there a script for this already ?

      I do not know vim language, I am still learning the commands

      Thank you,
      Timothy Madden

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Tony Mechelynck
      ... Easy ... / replace what? %# zero-width, current cursor position [ start collection - dash [:xdigit:] (inside collection) hex digit ] end collection {36}
      Message 2 of 4 , Dec 1, 2008
      • 0 Attachment
        On 01/12/08 15:34, Timothy Madden wrote:
        > Hello
        >
        > I want to create my install packages with WiX in .wxs source files
        > edited with Vim.
        > For WiX I need to generate a new GUID for every new package I
        > distribute and every
        > major version of my program.
        >
        > Could someone create a :command that would check the current selection or
        > the next 36 chararcters after the cursor to be hexadecimal digits
        > including minus
        > sign (anywhere in between) and then replace this text with the output
        > from a command
        > line executable (bin/GUIDGEN.exe) ?
        >
        > Is there a script for this already ?
        >
        > I do not know vim language, I am still learning the commands
        >
        > Thank you,
        > Timothy Madden

        Easy

        :s/\%#[-[:xdigit:]]\{36}/\=`GUIDGEN`

        Explanation:

        :s substitute on current line
        / replace what?
        \%# zero-width, current cursor position
        [ start collection
        - dash
        [:xdigit:] (inside collection) hex digit
        ] end collection
        \{36} repeat 36 times (i.e., multiply previous atom by 36)
        / replace by what?
        \= expression
        `GUIDGEN` the stdout of program GUIDGEN which is the PATH
        (no flags) do it just once

        See
        :help :s
        :help pattern.txt


        Best regards,
        Tony.
        --
        "If I am elected, the concrete barriers around the WHITE HOUSE will be
        replaced by tasteful foam replicas of ANN MARGARET!"

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Timothy Madden
        On Dec 1, 5:18 pm, Tony Mechelynck ... [...] ... [...] ... My vim says Invalid expression `wine GUIDGEN.exe` after I type
        Message 3 of 4 , Dec 1, 2008
        • 0 Attachment
          On Dec 1, 5:18 pm, Tony Mechelynck <antoine.mechely...@...>
          wrote:
          > On 01/12/08 15:34, Timothy Madden wrote:
          [...]
          > > Could someone create a :command that would check the current selection or
          > > the next 36 chararcters after the cursor to be hexadecimal digits
          > > including minus
          > > sign (anywhere in between) and then replace this text with the output
          > > from a command
          > > line executable (bin/GUIDGEN.exe) ?
          >
          > > Is there a script for this already ?
          >
          > > I do not know vim language, I am still learning the commands
          [...]
          > Easy
          >
          >         :s/\%#[-[:xdigit:]]\{36}/\=`GUIDGEN`
          >
          > Explanation:
          >
          >         :s      substitute on current line
          >         /       replace what?
          >         \%#     zero-width, current cursor position
          >         [       start collection
          >         -       dash
          >         [:xdigit:]      (inside collection) hex digit
          >         ]       end collection
          >         \{36}   repeat 36 times (i.e., multiply previous atom by 36)
          >         /       replace by what?
          >         \=      expression
          >         `GUIDGEN`       the stdout of program GUIDGEN which is the PATH
          >         (no flags)      do it just once


          My vim says Invalid expression `wine GUIDGEN.exe` after I
          type :Guidgen,
          which I defined like this in ~/.vimrc:

          command Guidgen :s$\%#[-[:xdigit:]]\{36}$\=`wine GUIDGEN.exe`

          I have vim7.2 on Slackware.

          I used $ instead of / in the search command because the path to
          GUIDGEN
          might someday contain a literal /.

          I would also like to skip the first line of output
          (reading Z:\home\adrian\GUIDGEN.exe) and then ignore the braces
          around
          the generated GUID, if possible

          Thank you,
          Timothy Madden

          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Jürgen Krämer
          Hi, ... you might try command Guidgen :s$ %#[-[:xdigit:]] {36}$ =system( GUIDGEN.exe ) instead. Regards, Jürgen -- Sometimes I think the surest sign that
          Message 4 of 4 , Dec 1, 2008
          • 0 Attachment
            Hi,

            Timothy Madden wrote:
            >
            > My vim says Invalid expression `wine GUIDGEN.exe` after I
            > type :Guidgen,
            > which I defined like this in ~/.vimrc:
            >
            > command Guidgen :s$\%#[-[:xdigit:]]\{36}$\=`wine GUIDGEN.exe`
            >
            > I have vim7.2 on Slackware.

            you might try

            command Guidgen :s$\%#[-[:xdigit:]]\{36}$\=system('GUIDGEN.exe')

            instead.

            Regards,
            Jürgen

            --
            Sometimes I think the surest sign that intelligent life exists elsewhere
            in the universe is that none of it has tried to contact us. (Calvin)

            --~--~---------~--~----~------------~-------~--~----~
            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.