Remote settings (Debian Stretch)
- Install
vim-gtk
xclip
andxauth
apt-get install -y xclip xauth vim-gtk
- Check that
clipboard
has been compiled in your VIM installed
root@remote# vim --version | grep clipboard traefik!?
+clipboard +job +path_extra +user_commands
+eval +mouse_dec +statusline +xterm_clipboard
- Edit the file
/etc/ssh/sshd_config
X11Forwarding yes
X11UseLocalhost no
- Reload ssh
/etc/init.d/ssh reload
- Configure VIM in the file
~/.vimrc
" yank to clipboard
if has("clipboard")
set clipboard=unnamed " copy to the system clipboard
if has("unnamedplus") " X11 support
set clipboard+=unnamedplus
endif
endif
Remote settings (Centos 7)
- Install
xclip
andxauth
yum install xclip xauth
- Follow the same steps for Debian installation
Local settings
- Install VIM 8 in Mac
brew install vim --with-client-server
- Check that
clipboard
has been compiled in your VIM installed
adam@shanghai ~> vim --version | grep clipboard
+clipboard +jumplist +persistent_undo +vertsplit
+emacs_tags +mouse_dec -sun_workshop +xterm_clipboard
- Edit the file
vim ~/.ssh/config
and put inside this content
XAuthLocation /opt/X11/bin/xauth
Host *
ForwardAgent yes
ForwardX11 yes
If XQuartz is not already open each time Vim is launched, open XQuartz and marked the option which says
Update Pasteboard immediately when text is selected
in the sectionPasteboard
underPreferences
For login, always include the letter
X
in your connection string like thisssh -X root@xxx.xxx.xxx.xxx
Testing VIM captures
- For copying in the clipboard run in your VIM console when you are in
Visual Mode
"*y
or
"+y
- For paste in the remote server you can use
"*p
or
"+p
- For paste in the local server you can use your mouse or (or
COMMAND + V
) to paste the already copied text in theremote
clipboard.
Testing Xclip captures
- In the remote server run
vim --version | grep clipboard | xclip
- In the local server use your mouse (or
COMMAND + V
) to paste the already copied text in theremote
clipboard. If should be there
keeping X11 display after su or sudo
ln -s /home/username/.Xauthority /root/.Xauthority