remotecopy


Ⅰ. 插件描述

Copy from your terminal into your local clipboard.

Ⅱ. 基本信息

创建日期:  2011-02-13
使用用户:  1
Github星:  37
插件作者:  Nate Jones

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'justone/remotecopy'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'justone/remotecopy'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'justone/remotecopy'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/justone/remotecopy

Ⅳ. 文档说明

# Remote Copy

Overview

Taking something from a remote shell and copying into your local pasteboard
would be very useful. This blog post details one solution:

http://seancoates.com/blogs/remote-pbcopy

The big caveat at the bottom is that this particular solution is not secure.
Anyone who figure out the port and writes to it puts something in your
pasteboard.

This project aims to address that problem with a little extra logic. See
ARCH.md for details.

Installation

Step 1. Run the remotecopyserver script on your local laptop or desktop.

NOTE: Be sure to run remotecopyserver outside of a tmux session. Unless you've patched it to work around the reattach-to-user-namespace issue, remotecopyserver won't work correctly.

This can either be done manually:

$ remotecopyserver &

Or you can use the built-in LaunchAgent support. This will start the
remotecopyserver process and make sure it's started whenever you reboot:

$ remotecopyserver -x start

Step 2. Configure SSH to forward the remotecopyserver port to your remote machine.

The default port is 12345 (see Configuration on how to change
that). Remotecopy works by connecting to the (localhost) port on the remote
machine, so it is necessary to forward the local port over your SSH connection.

To forward for a single session:

$ ssh server.com -R 12345:localhost:12345

Or, to forward for all sessions to that server, put a snippet like this into your .ssh/config file:

Host server.com
    RemoteForward 12345 localhost:12345

Step 3. Test out the remote copy connection

After connecting to the remote machine, run remotecopy foo to ensure that the
port forward and remotecopyserver are running correctly. If everything is
working, you should be prompted for the secret. Just paste and 'foo' will be
copied into your clipboard.

$ remotecopy foo
Input secret:
rc-aa474a07fbb93fe29450b6618110bdc2
$

If it doesn't work, try running telnet localhost 12345 on your remote machine
to make sure the port is forwarded correctly. It should look like this (see
the "HELLO 0.1" at the bottom?):

$ telnet localhost 12345
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
HELLO 0.1

Configuration

To change the port that remotecopyserver listens on and remotecopy connects to,
just put this into ~/.remotecopyrc:

port = 52413

Note: this file should be present on both ends so that they agree on the port.
This is easy if you manage your dotfiles with git. I suggest using
dfm, and here is a starter repository.

More information

First, there's the introductory blog post, and then a follow up a while later.

添加新评论