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

vim --remote over ssh -X

Expand Messages
  • Bastian Venthur
    Hi, when I log into a remote machine with ssh -X and start a local gvim session, i can see the local gvim with: user@remote$ gvim --serverlist GVIM To control
    Message 1 of 9 , Jan 2, 2011
    • 0 Attachment
      Hi,

      when I log into a remote machine with ssh -X and start a local gvim
      session, i can see the local gvim with:

      user@remote$ gvim --serverlist
      GVIM

      To control that it is really my local gvim session, I repeat it after
      closing the local gvim and the serverlist is empty.

      when I want to open a remote file with the --remote option

      user@remote$ gvim --remote test.py

      an empty file gets loaded in my local gvim. Is this a bug? If not, is
      there a similar way to edit remote files locally? I know that it's
      possible to use :e scp:user@remote/path/to/file but I find it more
      convenient to call vim direclty within the remote filesystem.


      Cheers,

      Bastian


      --
      Bastian Venthur http://venthur.de
      Debian Developer venthur at debian org


      --
      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
    • Tony Mechelynck
      ... T ain t a bug, it s a feature: 1) see :help remote.txt --remote and friends pass messages between the current Vim (the client) and another Vim instance
      Message 2 of 9 , Jan 2, 2011
      • 0 Attachment
        On 02/01/11 19:05, Bastian Venthur wrote:
        > Hi,
        >
        > when I log into a remote machine with ssh -X and start a local gvim
        > session, i can see the local gvim with:
        >
        > user@remote$ gvim --serverlist
        > GVIM
        >
        > To control that it is really my local gvim session, I repeat it after
        > closing the local gvim and the serverlist is empty.
        >
        > when I want to open a remote file with the --remote option
        >
        > user@remote$ gvim --remote test.py
        >
        > an empty file gets loaded in my local gvim. Is this a bug? If not, is
        > there a similar way to edit remote files locally? I know that it's
        > possible to use :e scp:user@remote/path/to/file but I find it more
        > convenient to call vim direclty within the remote filesystem.
        >
        >
        > Cheers,
        >
        > Bastian
        >
        >

        T'ain't a bug, it's a feature:

        1) see :help remote.txt
        --remote and friends pass messages between the current Vim (the client)
        and another Vim instance (the server) which may even be running on the
        same machine.

        2) see
        :help gui-fork
        :help -f
        :help 'guioptions'
        when starting the GUI, it forks away from its shell, launching the GUI
        as a new process, unless you start gvim with the -f (or --nofork)
        command-line switch, or unless 'guioptions' includes the f flag at the
        instant the GUI is started (e.g. because you had "if has('gui') | set
        go+=f | endif", without the double quotes but with the single ones, in
        your vimrc)

        To edit remote files in the local Vim, see :help pi_netrw.txt -- as
        apparently you know.

        To edit remote files with a Vim running on a remote machine, you should
        be able to do it by starting a console-Vim (not gvim) instance within
        your ssh (or whatever) remote shell, provided of course that Vim is
        installed on the remote machine.

        To edit remote files with *gvim* running on the remote machine, your
        remote gvim must have access to an X11 (or Windows or whatever)
        graphical display server displaying on the display you're looking at,
        not on some display or pseudo-display located at the remote site.


        Best regards,
        Tony.
        --
        The chief cause of problems is solutions.

        --
        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
      • Tony Mechelynck
        ... [...] Oh, and I m not sure of the difference between ssh -X (untrusted X11 forwarding) and ssh -Y (trusted X11 forwarding). Best regards, Tony. -- Winter
        Message 3 of 9 , Jan 2, 2011
        • 0 Attachment
          On 03/01/11 08:45, Tony Mechelynck wrote:
          > On 02/01/11 19:05, Bastian Venthur wrote:
          >> Hi,
          >>
          >> when I log into a remote machine with ssh -X and start a local gvim
          >> session, i can see the local gvim with:
          >>
          >> user@remote$ gvim --serverlist
          >> GVIM
          >>
          >> To control that it is really my local gvim session, I repeat it after
          >> closing the local gvim and the serverlist is empty.
          >>
          >> when I want to open a remote file with the --remote option
          >>
          >> user@remote$ gvim --remote test.py
          >>
          >> an empty file gets loaded in my local gvim. Is this a bug? If not, is
          >> there a similar way to edit remote files locally? I know that it's
          >> possible to use :e scp:user@remote/path/to/file but I find it more
          >> convenient to call vim direclty within the remote filesystem.
          >>
          >>
          >> Cheers,
          >>
          >> Bastian
          >>
          >>
          >
          > T'ain't a bug, it's a feature:
          [...]

          Oh, and I'm not sure of the difference between ssh -X (untrusted X11
          forwarding) and ssh -Y (trusted X11 forwarding).


          Best regards,
          Tony.
          --
          Winter is the season in which people try to keep the house as warm as
          it was in the summer, when they complained about the heat.

          --
          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
        • Bastian Venthur
          Hi ... I don t see how this is a feature. I can see the local gvim on my remote machine and want to load a remote file in my local gvim. When I use gvim
          Message 4 of 9 , Jan 3, 2011
          • 0 Attachment
            Hi

            Am 03.01.2011 08:45, schrieb Tony Mechelynck:
            > On 02/01/11 19:05, Bastian Venthur wrote:
            >> Hi,
            >>
            >> when I log into a remote machine with ssh -X and start a local gvim
            >> session, i can see the local gvim with:
            >>
            >> user@remote$ gvim --serverlist
            >> GVIM
            >>
            >> To control that it is really my local gvim session, I repeat it after
            >> closing the local gvim and the serverlist is empty.
            >>
            >> when I want to open a remote file with the --remote option
            >>
            >> user@remote$ gvim --remote test.py
            >>
            >> an empty file gets loaded in my local gvim. Is this a bug? If not, is
            >> there a similar way to edit remote files locally? I know that it's
            >> possible to use :e scp:user@remote/path/to/file but I find it more
            >> convenient to call vim direclty within the remote filesystem.

            > T'ain't a bug, it's a feature:

            I don't see how this is a feature. I can see the local gvim on my remote
            machine and want to load a remote file in my local gvim. When I use gvim
            --remote SOMEFILE on the remote machine, an *empty* file gets loaded on
            my local gvim. So it seems that there is some connection between the
            remote machine an my local gvim, but I actually expected that SOMEFILE
            gets loaded in my local vim. Is this possible with the --remote option?

            > To edit remote files in the local Vim, see :help pi_netrw.txt -- as
            > apparently you know.

            I really want to avoid that, since I don't want to browse the rather
            complicated tree on the remote system within vim, but rather with ssh.


            Cheers,

            Bastian


            --
            Bastian Venthur http://venthur.de
            Debian Developer venthur at debian org


            --
            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
          • Tony Mechelynck
            ... Maybe I m obtuse; but what s the problem with browsing the rather complicated tree in a netrw directory window? gvim scp://user@remote/path/ with the
            Message 5 of 9 , Jan 3, 2011
            • 0 Attachment
              On 03/01/11 10:42, Bastian Venthur wrote:
              > Hi
              >
              > Am 03.01.2011 08:45, schrieb Tony Mechelynck:
              >> On 02/01/11 19:05, Bastian Venthur wrote:
              >>> Hi,
              >>>
              >>> when I log into a remote machine with ssh -X and start a local gvim
              >>> session, i can see the local gvim with:
              >>>
              >>> user@remote$ gvim --serverlist
              >>> GVIM
              >>>
              >>> To control that it is really my local gvim session, I repeat it after
              >>> closing the local gvim and the serverlist is empty.
              >>>
              >>> when I want to open a remote file with the --remote option
              >>>
              >>> user@remote$ gvim --remote test.py
              >>>
              >>> an empty file gets loaded in my local gvim. Is this a bug? If not, is
              >>> there a similar way to edit remote files locally? I know that it's
              >>> possible to use :e scp:user@remote/path/to/file but I find it more
              >>> convenient to call vim direclty within the remote filesystem.
              >
              >> T'ain't a bug, it's a feature:
              >
              > I don't see how this is a feature. I can see the local gvim on my remote
              > machine and want to load a remote file in my local gvim. When I use gvim
              > --remote SOMEFILE on the remote machine, an *empty* file gets loaded on
              > my local gvim. So it seems that there is some connection between the
              > remote machine an my local gvim, but I actually expected that SOMEFILE
              > gets loaded in my local vim. Is this possible with the --remote option?
              >
              >> To edit remote files in the local Vim, see :help pi_netrw.txt -- as
              >> apparently you know.
              >
              > I really want to avoid that, since I don't want to browse the rather
              > complicated tree on the remote system within vim, but rather with ssh.
              >
              >
              > Cheers,
              >
              > Bastian
              >
              >

              Maybe I'm obtuse; but what's the problem with browsing the "rather
              complicated tree" in a netrw directory window?

              gvim scp://user@remote/path/

              with the trailing / so netrw knows it's a directory; and from there, hit
              <Enter> on any filename to open it, or on any subdirectory name to
              browse it (or hit o instead to open it in a new split-window)


              Best regards,
              Tony.
              --
              hundred-and-one symptoms of being an internet addict:
              7. You finally do take that vacation, but only after buying a cellular modem
              and a laptop.

              --
              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
            • Bastian Venthur
              ... [...] ... [...] ... Yeah, I know. I just happen to find it more convenient to browse the FS with my shell and open files with gvim --remote as needed. The
              Message 6 of 9 , Jan 3, 2011
              • 0 Attachment
                Am 03.01.2011 12:01, schrieb Tony Mechelynck:
                > On 03/01/11 10:42, Bastian Venthur wrote:

                [...]

                >>> T'ain't a bug, it's a feature:
                >>
                >> I don't see how this is a feature. I can see the local gvim on my remote
                >> machine and want to load a remote file in my local gvim. When I use gvim
                >> --remote SOMEFILE on the remote machine, an *empty* file gets loaded on
                >> my local gvim. So it seems that there is some connection between the
                >> remote machine an my local gvim, but I actually expected that SOMEFILE
                >> gets loaded in my local vim. Is this possible with the --remote option?
                >>
                >>> To edit remote files in the local Vim, see :help pi_netrw.txt -- as
                >>> apparently you know.
                >>
                >> I really want to avoid that, since I don't want to browse the rather
                >> complicated tree on the remote system within vim, but rather with ssh.

                [...]

                > Maybe I'm obtuse; but what's the problem with browsing the "rather
                > complicated tree" in a netrw directory window?
                >
                > gvim scp://user@remote/path/

                Yeah, I know. I just happen to find it more convenient to browse the FS
                with my shell and open files with gvim --remote as needed. The question
                is still if the above behavior is a bug or not. Clearly gvim --remote
                SOMEFILE does *something* with my local gvim but it does not load
                SOMEFILE but an emtpy one. I think it is a bug but I'm not sure.


                Cheers,

                Bastian

                --
                Bastian Venthur http://venthur.de
                Debian Developer venthur at debian org


                --
                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
              • Ben Schmidt
                ... It s not really a bug. The Vim remote feature wasn t actually designed to work between machines, just between instances on the same machine. Here s what s
                Message 7 of 9 , Jan 3, 2011
                • 0 Attachment
                  > I don't see how this is a feature. I can see the local gvim on my remote
                  > machine and want to load a remote file in my local gvim. When I use gvim
                  > --remote SOMEFILE on the remote machine, an *empty* file gets loaded on
                  > my local gvim. So it seems that there is some connection between the
                  > remote machine an my local gvim, but I actually expected that SOMEFILE
                  > gets loaded in my local vim. Is this possible with the --remote option?

                  It's not really a bug. The Vim remote feature wasn't actually designed
                  to work between machines, just between instances on the same machine.

                  Here's what's happening.

                  Vim on your remote machine can see Vim on your local machine because of
                  the forwarded X connection. But it has no way of knowing the Vim on your
                  local machine is on a different machine, with a different filesystem,
                  etc.. --remote doesn't forward any file contents, it just sends a
                  command to the Vim it's communicating with, telling it to edit a file at
                  a certain path. Since the local and remote Vim don't share the same
                  filesystem, the path doesn't mean the same thing to both Vims.

                  The best thing I can suggest is to make yourself a little shell script
                  or macro that takes an argument and calls vim --remote with the path
                  modified in such a way that your local Vim can find it via scp. So when
                  you do

                  vimremote file.txt

                  it does

                  vim --remote scp://host/path/to/file.txt

                  Ben.



                  --
                  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
                • Asis Hallab
                  Dear Tony, I think you should use netrw in order to open your remote file. Details with ... and especially ... I might be mistaken though.. Best! Asis 2011/1/3
                  Message 8 of 9 , Jan 3, 2011
                  • 0 Attachment
                    Dear Tony,

                    I think you should use netrw in order to open your remote file.
                    Details with
                    :h netrw
                    and especially
                    :h netrw-read

                    I might be mistaken though..

                    Best!
                    Asis

                    2011/1/3 Tony Mechelynck <antoine.mechelynck@...>
                    On 03/01/11 08:45, Tony Mechelynck wrote:
                    On 02/01/11 19:05, Bastian Venthur wrote:
                    Hi,

                    when I log into a remote machine with ssh -X and start a local gvim
                    session, i can see the local gvim with:

                    user@remote$ gvim --serverlist
                    GVIM

                    To control that it is really my local gvim session, I repeat it after
                    closing the local gvim and the serverlist is empty.

                    when I want to open a remote file with the --remote option

                    user@remote$ gvim --remote test.py

                    an empty file gets loaded in my local gvim. Is this a bug? If not, is
                    there a similar way to edit remote files locally? I know that it's
                    possible to use :e scp:user@remote/path/to/file but I find it more
                    convenient to call vim direclty within the remote filesystem.


                    Cheers,

                    Bastian



                    T'ain't a bug, it's a feature:
                    [...]

                    Oh, and I'm not sure of the difference between ssh -X (untrusted X11 forwarding) and ssh -Y (trusted X11 forwarding).


                    Best regards,
                    Tony.
                    --
                    Winter is the season in which people try to keep the house as warm as
                    it was in the summer, when they complained about the heat.

                    --
                    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



                    --
                    Asis Hallab
                    Rothehausstr. 6 - 12
                    50823 Köln

                    Skype: asis.hallab.cgn
                    Fest (Köln) 42346046
                    Mobil  (O2) 0176 63370211
                    Fax 01212 - 5 - 30697106

                    --
                    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
                  • Simon Ruderich
                    ... Hi Bastian, I can recommend sshfs. It uses FUSE and lets you mount the remote directory locally thus you can use your shell as usual and Vim on the local
                    Message 9 of 9 , Jan 3, 2011
                    • 0 Attachment
                      On Mon, Jan 03, 2011 at 01:02:20PM +0100, Bastian Venthur wrote:
                      > [snip]
                      >
                      > Yeah, I know. I just happen to find it more convenient to browse the FS
                      > with my shell and open files with gvim --remote as needed. The question
                      >
                      > [snip]

                      Hi Bastian,

                      I can recommend sshfs. It uses FUSE and lets you mount the remote
                      directory locally thus you can use your shell as usual and Vim on
                      the local system.

                      If you need to run commands directly on the remote system that
                      won't work of course (because all commands are run on your local
                      system, just on the remote filesystem) but for that case you can
                      use a ssh session and switch between it (for example with GNU
                      screen or tmux).

                      Regards,
                      Simon
                      --
                      + privacy is necessary
                      + using gnupg http://gnupg.org
                      + public key id: 0x92FEFDB7E44C32F9
                    Your message has been successfully submitted and would be delivered to recipients shortly.