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

Re: assign current line under cursor to extern program

Expand Messages
  • Gary Johnson
    ... I think Milan did not understand your request. ... will write the current line to the standard input of the command following the exclamation point (!),
    Message 1 of 8 , Nov 30, 2007
    • 0 Attachment
      On 2007-11-30, "jerikmail@..." <jerikmail@...> wrote:

      > On 2007-11-30, Milan Vancura <milan@...> wrote:

      > > :.w !foo.sh
      >
      > I tried but did not work. Cause the directory was not in the PATH, I
      > had to use :.w !./foo.sh
      >
      > foo.sh: echo $* > a.txt
      >
      > after the command, a.txt had only one empty line.
      >
      > This returned an empty line.

      I think Milan did not understand your request.

      :.w !foo.sh

      will write the current line to the standard input of the command
      following the exclamation point (!), whereas what you are looking
      for is a way to pass the current line as a set of arguments to a
      command.

      On the other hand, if foo.sh is something you have written yourself,
      another way to solve this problem would be to write foo.sh to accept
      its data from standard input instead of as command-line arguments.
      Then you _could_ just execute

      :.w !./foo.sh

      > > No functions are needed. This is vim, not emacs :-)

      It's true that functions are not needed here, but there is no reason
      to avoid them, either.

      Regards,
      Gary


      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • jerikmail@googlemail.com
      Hi, [.w !foo.sh explanation] ... Right now, it works fine for me with the assigned command-line arguments. Furthermore I dont know how to write a shell/ruby
      Message 2 of 8 , Dec 1, 2007
      • 0 Attachment
        Hi,

        [.w !foo.sh explanation]

        > On the other hand, if foo.sh is something you have written yourself,
        > another way to solve this problem would be to write foo.sh to accept
        > its data from standard input instead of as command-line arguments.
        > Then you _could_ just execute
        >
        > :.w !./foo.sh

        Right now, it works fine for me with the assigned command-line
        arguments. Furthermore I dont know how to write a shell/ruby script to
        accept data from input standard.

        But thanks for the tip and explanation.

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