Skip to content

Instantly share code, notes, and snippets.

@kristjan
Created March 2, 2011 20:26
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kristjan/851669 to your computer and use it in GitHub Desktop.
Save kristjan/851669 to your computer and use it in GitHub Desktop.
Yank from a remote vim into OSX's local copy buffer
map <Leader>y :echo system('echo -n '.shellescape(@").' \| npaste')<CR>
  • Run ncopy on your local machine, perhaps in a screen so it doesn't die
  • Put npaste into your path on the remote machine
  • Drop the shortcut into your .vimrc
  • When you SSH, add a reverse tunnel: ssh <host> -R 12888:localhost:12888
  • Yank and paste like a madman
#!/bin/bash
while sleep .01; do nc -l 12888 | pbcopy; done
#!/bin/bash
cat - |
sed 's/^\s*//' | # Leading whitespace
sed 's/\s*$//' | # Trailing whitespace
sed 's/\\$//' | # Escaped newline
nc localhost 12888
@kristjan
Copy link
Author

kristjan commented Mar 2, 2011

Netcatting through the reverse tunnel courtesy josh@gmail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment