Skip to content

Seamlessly synchronize clipboard contents between a remote server and your local machine. Ideal for developers and sysadmins working in remote environments, enabling easy copy-pasting of text, code, or logs from tools like nvim on a server to a local system.

Notifications You must be signed in to change notification settings

Abraxas-365/r_clip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RClip

Overview

Remote Clipboard Sync is a tool designed to synchronize clipboard contents between a remote server and a local machine. This project is particularly useful for developers and system administrators who frequently work with remote environments using tools like nvim and need to copy-paste text between the remote server and their local machine. Whether it's copying error logs, code snippets, or configuration settings, Remote Clipboard Sync makes the process seamless and efficient.

Features

  • Cross-platform support for macOS and Linux.
  • Real-time synchronization of clipboard contents between a remote server and a local machine.
  • Easy to set up and use with minimal configuration.

Installation

Prerequisites

Rust and Cargo (Rust's package manager) must be installed on both the server and the local machine. Network connectivity between the local machine and the remote server.

  1. Clone the Repository:
git clone https://github.com/Abraxas-365/r_clip
cd remote-clipboard-sync
  1. Build the Project: On both the server and the local machine, run:
cargo build --release

Executable: The executable will be available under target/release/.

Usage

On the Server

you can acces the help meny by:

./r_clip --help

Start the server component on your remote machine:

./r_clip -r server -a <server-address> -p <port> -c <filepath-for-the-pseado-clipboard>
  • example
./r_clip  rclip -r server -a 0.0.0.0 -p 12345 -c ~/yankfile.txt

Replace with the server's IP address or hostname and with the port number you want to use.

On the Local Machine

Connect the client component to your server:

./r_clip client -a <server-address> -p <port>

Setting Up Neovim and Vim for Remote Clipboard Sync

Neovim/Vim Configuration To enable clipboard synchronization with Neovim or Vim, you need to configure an autocommand to write the yanked text to a file. This file will be monitored by the Remote Clipboard Sync tool on the server.

  1. Configure Neovim/Vim: Open your init.vim/init.lua file for Neovim or .vimrc file for Vim and add the following lines:
" Autocommand that triggers when text is yanked
augroup YankToFile
  autocmd!
  autocmd TextYankPost * call writefile([@0], '/path/to/your/yankfile.txt')
augroup END

Replace /path/to/your/yankfile.txt with the actual path to the file that Remote Clipboard Sync will monitor.

  • Example
" Autocommand that triggers when text is yanked
augroup YankToFile
  autocmd!
  autocmd TextYankPost * call writefile([@0], '/home/ubuntu/yankfile.txt')
augroup END
  1. Ensure File Accessibility: Make sure that the file specified in clipboard_file is accessible and writable by both Neovim/Vim and the Remote Clipboard Sync tool.

Using with Remote Clipboard Sync Once you have configured Neovim/Vim as described above, any text yanked (copied) in Neovim/Vim will be written to the specified file. The Remote Clipboard Sync tool running on your server will monitor this file and synchronize the clipboard contents accordingly.

About

Seamlessly synchronize clipboard contents between a remote server and your local machine. Ideal for developers and sysadmins working in remote environments, enabling easy copy-pasting of text, code, or logs from tools like nvim on a server to a local system.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages