Last active
December 7, 2020 08:27
-
-
Save kosmatov/ef29d5b200c3688bc77f5c24e9e4b80c to your computer and use it in GitHub Desktop.
Vim pbcopy through SSH
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ tail -3 ~/.ssh/config | |
Host pbcopy-host | |
HostName 10.0.1.1 | |
User key | |
$ cat ~/.vimrc | grep pbcopy | |
Plug 'ahw/vim-pbcopy' | |
let g:vim_pbcopy_remote_cmd = "ssh pbcopy-host pbcopy" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Motivation
There is a small trick to copy any text from vim inside virtual machine running on Mac OS X host to its clipboard
vim-pbcopy
This is a Vim plugin that exposes a
cy
mapping in Visual mode and acy{motion}
mapping in Normal mode which both attempt to yank the selected/moved-over text and pipe it (viassh
if necessary) to thepbcopy
command on a Mac OS X client. What does this mean? It means you can usecy
wherever you'd normally usey
and have that text available in your Mac OS X system clipboard, whether you're working locally or remotely. It also performs a simpley
yank operation on your selection so you'll have it in the default"
yank register as well.ahw/vim-pbcopy