Skip to content

Instantly share code, notes, and snippets.

@mikepqr
Forked from burke/remotepaste.md
Last active December 7, 2015 03:18

Revisions

  1. mikepqr revised this gist Dec 7, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions remotepaste.md
    Original file line number Diff line number Diff line change
    @@ -106,13 +106,13 @@ cat | nc -q1 localhost 2224
    #### `~/.vimrc`
    ```viml
    function! PropagatePasteBufferToOSX()
    let @n=getreg("*")
    let @n=getreg('"')
    call system('pbcopy-remote', @n)
    echo "done"
    endfunction
    function! PopulatePasteBufferFromOSX()
    let @+ = system('pbpaste-remote')
    let @" = system('pbpaste-remote')
    echo "done"
    endfunction
  2. @burke burke revised this gist Jul 9, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion remotepaste.md
    Original file line number Diff line number Diff line change
    @@ -104,7 +104,7 @@ cat | nc -q1 localhost 2224
    ```

    #### `~/.vimrc`
    ```vimscript
    ```viml
    function! PropagatePasteBufferToOSX()
    let @n=getreg("*")
    call system('pbcopy-remote', @n)
  3. @burke burke revised this gist Jul 9, 2013. 1 changed file with 9 additions and 9 deletions.
    18 changes: 9 additions & 9 deletions remotepaste.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    ## Local (OS X) Side

    #### `~/Library/LaunchAgents/pbcopy.plist`
    ```
    ```xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    @@ -32,7 +32,7 @@
    ```

    #### `~/Library/LaunchAgents/pbpaste.plist`
    ```
    ```xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    @@ -65,15 +65,15 @@
    #### `~/.ssh/config`
    ```
    Host myhost
    HostName 192.168.1.123
    User myname
    RemoteForward 2224 127.0.0.1:2224
    HostName 192.168.1.123
    User myname
    RemoteForward 2224 127.0.0.1:2224
    RemoteForward 2225 127.0.0.1:2225
    ```

    **After adding the PLists above, you'll have to run:**

    ```
    ```bash
    launchctl load ~/Library/LaunchAgents/pbcopy.plist
    launchctl load ~/Library/LaunchAgents/pbpaste.plist
    ```
    @@ -92,19 +92,19 @@ bind C-v run "tmux set-buffer $(pbpaste-remote); tmux paste-buffer"
    ```

    #### `~/bin/pbpaste-remote`
    ```
    ```bash
    #!/bin/sh
    nc localhost 2225
    ```

    #### `~/bin/pbcopy-remote`
    ```
    ```bash
    #!/bin/sh
    cat | nc -q1 localhost 2224
    ```

    #### `~/.vimrc`
    ```
    ```vimscript
    function! PropagatePasteBufferToOSX()
    let @n=getreg("*")
    call system('pbcopy-remote', @n)
  4. @burke burke revised this gist Jul 9, 2013. 1 changed file with 17 additions and 0 deletions.
    17 changes: 17 additions & 0 deletions remotepaste.md
    Original file line number Diff line number Diff line change
    @@ -102,3 +102,20 @@ nc localhost 2225
    #!/bin/sh
    cat | nc -q1 localhost 2224
    ```

    #### `~/.vimrc`
    ```
    function! PropagatePasteBufferToOSX()
    let @n=getreg("*")
    call system('pbcopy-remote', @n)
    echo "done"
    endfunction
    function! PopulatePasteBufferFromOSX()
    let @+ = system('pbpaste-remote')
    echo "done"
    endfunction
    nnoremap <leader>6 :call PopulatePasteBufferFromOSX()<cr>
    nnoremap <leader>7 :call PropagatePasteBufferToOSX()<cr>
    ```
  5. @burke burke renamed this gist Jul 9, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  6. @burke burke created this gist Jul 9, 2013.
    104 changes: 104 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,104 @@
    ## Local (OS X) Side

    #### `~/Library/LaunchAgents/pbcopy.plist`
    ```
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Label</key>
    <string>localhost.pbcopy</string>
    <key>ProgramArguments</key>
    <array>
    <string>/usr/bin/pbcopy</string>
    </array>
    <key>inetdCompatibility</key>
    <dict>
    <key>Wait</key>
    <false/>
    </dict>
    <key>Sockets</key>
    <dict>
    <key>Listeners</key>
    <dict>
    <key>SockServiceName</key>
    <string>2224</string>
    <key>SockNodeName</key>
    <string>127.0.0.1</string>
    </dict>
    </dict>
    </dict>
    </plist>
    ```

    #### `~/Library/LaunchAgents/pbpaste.plist`
    ```
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Label</key>
    <string>localhost.pbpaste</string>
    <key>ProgramArguments</key>
    <array>
    <string>/usr/bin/pbpaste</string>
    </array>
    <key>inetdCompatibility</key>
    <dict>
    <key>Wait</key>
    <false/>
    </dict>
    <key>Sockets</key>
    <dict>
    <key>Listeners</key>
    <dict>
    <key>SockServiceName</key>
    <string>2225</string>
    <key>SockNodeName</key>
    <string>127.0.0.1</string>
    </dict>
    </dict>
    </dict>
    </plist>
    ```

    #### `~/.ssh/config`
    ```
    Host myhost
    HostName 192.168.1.123
    User myname
    RemoteForward 2224 127.0.0.1:2224
    RemoteForward 2225 127.0.0.1:2225
    ```

    **After adding the PLists above, you'll have to run:**

    ```
    launchctl load ~/Library/LaunchAgents/pbcopy.plist
    launchctl load ~/Library/LaunchAgents/pbpaste.plist
    ```

    ## Remote (Linux) Side

    #### `~/.tmux.conf`
    ```
    if-shell 'test "$(uname)" = "Linux"' 'source ~/.tmux-linux.conf'
    ```

    #### `~/.tmux-linux.conf`
    ```
    bind C-c run "tmux save-buffer - | pbcopy-remote"
    bind C-v run "tmux set-buffer $(pbpaste-remote); tmux paste-buffer"
    ```

    #### `~/bin/pbpaste-remote`
    ```
    #!/bin/sh
    nc localhost 2225
    ```

    #### `~/bin/pbcopy-remote`
    ```
    #!/bin/sh
    cat | nc -q1 localhost 2224
    ```