-2

I use the following command to copy the content of a text file (located in remote server) opened with VIM (Linux OS):

gg v shift+g

The text is selected and greyd out as seen in the screenshotenter image description here

But I don't know how to copy it in clipboard in order to paste it later in another vim file (in my host machine)

user1919
  • 3,818
  • 17
  • 62
  • 97
  • 1
    Check this: http://vim.wikia.com/wiki/Accessing_the_system_clipboard – danglingpointer Jan 17 '18 at 09:01
  • 2
    also the visual mode is not needed here: `ggYG` directly makes a copy – Doktor OSwaldo Jan 17 '18 at 09:15
  • 1
    this is not a dup! OP's problem is copy stuff to the clipboard (or to local vim) from a **remote** machine. – Kent Jan 17 '18 at 09:43
  • 1
    Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. – jww Jan 17 '18 at 12:17

1 Answers1

1

If I understand you right, you are going in the wrong way.

I guess you opened the remote file via ssh. You cannot copy to your local clipboard directly over a remote ssh.

I would suggest that, you open the file from your local vim, via :e scp://server//path/file or open it in a split window in your local vim. Then you are free to yank/copy content from your remote file to your local vim file(s).

Kent
  • 189,393
  • 32
  • 233
  • 301