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

11376Re: Remote commands?

Expand Messages
  • Tony Mechelynck
    Apr 3, 2010
    • 0 Attachment
      On Feb 16, 2:05 am, Sean DeNigris <truste...@...> wrote:
      > > Sorry for taking so long to reply to your posts.  I think what you are
      > > looking for is the "remote functions", see ":h remote.txt|/FUNCTIONS".
      >
      > I've been using remote, and thought there might be a better way, but
      > after posting on vim_use, it seems the two options for remote commands
      > are:
      > 1. sending keys
      > 2. wrapping exe in a function and calling it with remote-expr
      >
      > Thanks!

      Ben Fritz gave you the following solution on vim_use:

      --remote-send ':ruby delete_line(1)<CR>'

      which I think is as economical ("as elegant" as a math teacher would
      say) as you could get. I might add that you would maybe want to test
      for Ruby support -- something like (untested):

      --remote-send ':if has("ruby") | exe "ruby_delete_line(1)" | else |
      echoerr "Sorry, no ruby" | endif<CR>'

      (all on one line, and with single quotes around the whole to force the
      Unix-like shell to pass the | as part of the parameter). I wrap the
      ruby statement in an exe so that Vim versions without ruby support
      would not try to parse it.

      However you could delete the first line more easily without calling
      ruby:

      --remote-send ':1d<CR>'

      (which is still an ex-command) or

      --remote-send ggdd

      In the latter case I think the quotes can be omitted since there are
      no embedded spaces and no risk of interpretation by the shell.


      Best regards,
      Tony.
      --
      "Hey! Who took the cork off my lunch??!"
      -- W. C. Fields

      --
      You received this message from the "vim_mac" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      To unsubscribe, reply using "remove me" as the subject.
    • Show all 4 messages in this topic