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

Sending buffer to Vim server

Expand Messages
  • Claus Atzenbeck
    Hi all: I start appreciating Vim s server capabilities: vim --servername vim , followed by vim --remote from another terminal. Now, imagine that I have 2
    Message 1 of 3 , Jun 13, 2013
    • 0 Attachment
      Hi all:

      I start appreciating Vim's server capabilities: "vim --servername vim",
      followed by "vim --remote" from another terminal.

      Now, imagine that I have 2 instances of Vim running, of which one has
      been started as a Vim server.

      Is there a way to push a Vim buffer from one instance to the Vim server?
      (This would be directly from within Vim, *not* by calling "vim --remote"
      from command line)?

      (( Explanation why I'd like to have that: I have Vim server running. In
      addition to that, my e-mail application starts new instances of Vim for
      typing e-mail messages. Sometimes, I'd like to copy text from buffers
      open in Vim server. Certainly, I could save them and re-open them in my
      mail's Vim instance, however, it would be more efficient to push a
      buffer to Vim server, change it there and push it back to my mail's Vim
      instance. ))

      Any hint is appreciated.

      Best,
      Claus

      --
      --
      You received this message from the "vim_use" 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

      ---
      You received this message because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Marcin Szamotulski
      ... You cannot send buffers to a server. But you can read buffers: just use ... [R]eadonly. Alternatively you can write a function which ask the server for a
      Message 2 of 3 , Jun 13, 2013
      • 0 Attachment
        On 19:16 Thu 13 Jun , Claus Atzenbeck wrote:
        > Hi all:
        >
        > I start appreciating Vim's server capabilities: "vim --servername vim",
        > followed by "vim --remote" from another terminal.
        >
        > Now, imagine that I have 2 instances of Vim running, of which one has
        > been started as a Vim server.
        >
        > Is there a way to push a Vim buffer from one instance to the Vim server?
        > (This would be directly from within Vim, *not* by calling "vim --remote"
        > from command line)?
        >
        > (( Explanation why I'd like to have that: I have Vim server running. In
        > addition to that, my e-mail application starts new instances of Vim for
        > typing e-mail messages. Sometimes, I'd like to copy text from buffers
        > open in Vim server. Certainly, I could save them and re-open them in my
        > mail's Vim instance, however, it would be more efficient to push a
        > buffer to Vim server, change it there and push it back to my mail's Vim
        > instance. ))
        >
        > Any hint is appreciated.
        >
        > Best,
        > Claus

        You cannot send buffers to a server. But you can read buffers: just use
        :edit filename, and when vim detects that there was a change choose
        [R]eadonly. Alternatively you can write a function which ask the
        server for a buffer's contents and puts it to new buffer in the 'email'
        instance of vim.

        Best regards,
        Marcin

        --
        --
        You received this message from the "vim_use" 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

        ---
        You received this message because you are subscribed to the Google Groups "vim_use" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • Claus Atzenbeck
        ... Thanks for the reply. This led me to a good solution: I start Vim from within my mail client as vim --servername mail , which enables me to open files
        Message 3 of 3 , Jun 13, 2013
        • 0 Attachment
          On Fri, 14 Jun 2013 at 12:56am -0000, Marcin Szamotulski wrote:

          > You cannot send buffers to a server. But you can read buffers: just use
          > :edit filename, and when vim detects that there was a change choose
          > [R]eadonly. Alternatively you can write a function which ask the
          > server for a buffer's contents and puts it to new buffer in the 'email'
          > instance of vim.

          Thanks for the reply. This led me to a good solution: I start Vim from
          within my mail client as "vim --servername mail", which enables me to
          open files there from within any other vim instance. For that I added
          the following to my .vimrc:

          function! OpenOnVimServerMail()
          exec '!view --servername mail --remote-tab "%"'
          endfunction
          nmap <leader>m :call OpenOnVimServerMail()<cr>

          Possibly there is a more elegant solution, but it works.

          Best,
          Claus

          --
          --
          You received this message from the "vim_use" 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

          ---
          You received this message because you are subscribed to the Google Groups "vim_use" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
          For more options, visit https://groups.google.com/groups/opt_out.
        Your message has been successfully submitted and would be delivered to recipients shortly.