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

Re: Network-oriented file reading and writing

Expand Messages
  • raf
    ... excellent. these autocmds will make net-vimming much cleaner. what about scp, sftp, socksified-ftp, ... ? how extensible is netrw.vim? raf
    Message 1 of 4 , Feb 2, 2000
    • 0 Attachment
      Dr. Charles E. Campbell wrote:

      > Ever want to
      >
      > vim rcp://some.host.here/some_path_to_a_file
      > - -or-
      > vim ftp://some.host.here/some_path_to_a_file (uses <.netrc>)
      >
      > ???
      >
      > I have got a solution for you! Now, I haven't extensively tested it, and
      > there may be gotchas with the autocmd patches that I haven't run into. It
      > needs testing.
      >
      > Anyway, here's the idea: I've introduced two new autocmd events, BufReadCmd
      > and BufWriteCmd. When they're triggered they *don't* actually read or write,
      > but they execute associated command(s) (like any good autocmd does). It just
      > so happens that with the <.vimrc> inclusion given below, that the appropriate
      > Nr or Nw command gets executed, which in turn does the rcp or ftp operation
      > for you.

      excellent. these autocmds will make net-vimming much cleaner.

      what about scp, sftp, socksified-ftp, ... ?
      how extensible is netrw.vim?

      raf
    • Bram Moolenaar
      ... Nice idea. I wonder if a more generic solution would be possible. Suppose the pattern for the autocommand is not enough to decide if the text should be
      Message 2 of 4 , Feb 6, 2000
      • 0 Attachment
        Charles Campbell wrote:

        > Anyway, here's the idea: I've introduced two new autocmd events, BufReadCmd
        > and BufWriteCmd. When they're triggered they *don't* actually read or write,
        > but they execute associated command(s) (like any good autocmd does). It just
        > so happens that with the <.vimrc> inclusion given below, that the appropriate
        > Nr or Nw command gets executed, which in turn does the rcp or ftp operation
        > for you.

        Nice idea. I wonder if a more generic solution would be possible. Suppose
        the pattern for the autocommand is not enough to decide if the text should be
        read from a file or obtained with a command. Perhaps a global variable need
        to be checked. Some script would be needed to decide what to do:

        au BufReadPre <pattern> call GetText()

        fun GetText()
        if <some_condition>
        <get text with command>
        <prevent reading text from file>
        endif
        endfun

        In the situation that the text is read with a command, there needs to be some
        way to prevent the file-read action to take place. Since autocommands may
        nest, this is a bit tricky.

        --
        BEDEVERE: Oooooh!
        LAUNCELOT: No "Aaaaarrrrrrggghhh ... " at the back of the throat.
        BEDEVERE: No! "Oooooh!" in surprise and alarm!
        "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

        /-/-- Bram Moolenaar --- Bram@... --- http://www.moolenaar.net --\-\
        \ \ Vim: http://www.vim.org ICCF Holland: http://www.vim.org/iccf / /
      Your message has been successfully submitted and would be delivered to recipients shortly.