0

I am given an account on a new server these days. The new server does not have x11 install, neither do I have sudo. So I cannot install system packages, and I cannot compile with the option -with-x.

But I still want to use vim when I am working on my server, and I need to use the clipboard feature to allow me to copy the contents from and to the vim and other places. How could I do this pleaes?

===== Edit: I got to find that the clipboard provided by the terminal can help. I could paste contents to vim with ctrl+shift+v. But the hot key of ctrl+shift+'c' does not work in the vim. how could I copy from vim like I copy from terminal?

  • Can't you compile Vim and install it to a directory owned by your user that you'll add to your $PATH? This way you shouldn't need sudo. – statox Apr 26 at 8:21
  • @statox Hi, I can compile my own vim, but I cannot use -with-x option anyway. Can I copy to system board without -with-x compiled? – coin cheung Apr 26 at 8:24
  • I would say that you don't need -X11, +clipboard should be enough but maybe I'm wrong. – statox Apr 26 at 8:29
1

If you want to use the clipboard directly from Vim, you'll need a version compiled with either the +clipboard or +xterm_clipboard features. On non-macOS Unix systems, those generally require at least X11 libraries. Without those features, Vim itself has no way of talking to the clipboard. You'll also need X forwarding enabled on your SSH connection (ssh -X).

Without those features, you can copy and paste from your terminal, but the copy will be only from the data you highlight with your mouse (then copy with Ctrl-Shift-C), just like at the shell. You can also use a terminal multiplexor like screen or tmux (running your remote Vim inside them) and configure it to copy and paste regions from the screen.

-1

To copy from vim to the the system clipboard: select the text to be copied in visual mode, do "+y to copy the text and then try to paste it to the acceptable non-vim location. This assumes vim was compiled with +clipboard

Here is the complete discussion of system clipboard and vim. Its worth reading: How can I copy text to the system clipboard from Vim?

  • The asker is asking about something entirely beyond just how to copy to the clipboard. I recommend reviewing the question more carefully. – ZeroKnight Apr 29 at 2:49
  • This is the part of the question that "+y addresses: "how could I copy from vim like I copy from terminal?" – DC Slagel Apr 29 at 13:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.