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

Re: arguments to map commands

Expand Messages
  • Benji Fisher
    ... Another option is ... let x = input( prompt for x: ) ... r !proc.csh x y z startinsert endfun I have not tested this, but I think that the :startinsert
    Message 1 of 4 , Apr 27 8:12 AM
    • 0 Attachment
      "Janakiraman .S" wrote:
      >
      > * Sandip Solanki (sandip@...) wrote thusly :
      >
      > > But I think my question is misinterpreted.
      > > My requirement is, I want to run a shell script from vim which requires
      > > arguments and output I want to insert in file.
      > >
      > > I use map alw in insert mode as
      > >
      > > :map! alw <Esc>:r !proc.csh
      > >
      > > proc.csh requires argument.
      > >
      > > Now depends upon arguments output may differ. Above mapping works but the cursor
      > > comes on command line and take argument, again after applying arguments and
      > > enter it's not continued with insert mode. Which I dont want.
      > >
      > > So, I want to supply arguments with mapped key which further processed and
      > > output placed in file and I continues with insert mode.
      >
      > Something like
      > :imap alw <c-o>:r!proc.csh
      > might do it for you.
      >
      > :he imap
      > :he i_CTRL-O

      Another option is

      :imap alw <Esc>:call Alw()<CR>

      :fun! Alw()
      let x = input("prompt for x:")
      ...
      r !proc.csh x y z
      startinsert
      endfun

      I have not tested this, but I think that the :startinsert should work to
      return you to Insert mode when the function finishes.

      HTH --Benji Fisher
    Your message has been successfully submitted and would be delivered to recipients shortly.