Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/OscarCreator/rsync.nvim

neovim plugin which synchronises project with rsync on save.
https://github.com/OscarCreator/rsync.nvim

async lua neovim neovim-plugin neovim-plugins nvim nvim-plugin rsync

Last synced: about 2 months ago
JSON representation

neovim plugin which synchronises project with rsync on save.

Lists

README

        

[![codecov](https://codecov.io/gh/OscarCreator/rsync.nvim/branch/master/graph/badge.svg?token=GYELY6KJZ6)](https://codecov.io/gh/OscarCreator/rsync.nvim)

# rsync.nvim

Asynchronously transfer your files with `rsync` on save.

![output](https://github.com/OscarCreator/rsync.nvim/assets/53407525/c5c402bd-98ac-4899-9ce0-ebf27db28d29)

## Dependencies

- [cargo](https://www.rust-lang.org/tools/install)
- rsync

## Installation

```lua
-- packer.nvim
use {
'OscarCreator/rsync.nvim',
run = 'make',
requires = {'nvim-lua/plenary.nvim'},
config = function()
require("rsync").setup()
end
}
-- lazy.nvim
{
'OscarCreator/rsync.nvim',
build = 'make',
dependencies = 'nvim-lua/plenary.nvim',
config = function()
require("rsync").setup()
end,
}
```

## Usage

**rsync.nvim** looks for `.nvim/rsync.toml` file by default in the root of your
project. The path can also be set with the `project_config_path` key in the
plugin configuration.

The current options available:

```toml
# this is the path to the remote. Can be either a local/remote filepath.
remote_path = "../copy/"
# or if using ssh
remote_path = "user@host:/home/user/path/"

# specifying a file(s) which should be synced "down" but are on ignore files.
# this is a workaround to sync down files which are included on ignore files.
remote_includes = "build.log"
# or using an array if multiple files are needed.
remote_includes = ["build.log", "build/generated.json"]

# specifying an gitignore file(s). Files matching patterns in ignore files are
# excluded from "SyncUp" and "SyncDown" except ones specified in `remote_includes`.
# For example, to exclude file(s) in the global gitignore and the project gitignore:
ignorefile_paths = ["~/.gitignore", ".gitignore"]
```

## Commands

| Name | Action |
| ------------------ | ----------------------------------------------------------------------------------------- |
| RsyncDown | Sync all files from remote\* to local folder. |
| RsyncDownFile | Sync specified or current file from remote to local folder. |
| RsyncUp | Sync all files from local\* to remote folder. |
| RsyncUpFile | Sync specified or current file from local to remote. This requires rsync version >= 3.2.3 |
| RsyncLog | Open log file for rsync.nvim. |
| RsyncConfig | Print out user config. |
| RsyncProjectConfig | Print or reload current project config. |
| RsyncSaveSync | Temporarily disable/enable/toggle sync when saving. |

\*: Files which are excluded are, everything in .gitignore and .nvim folder.

## Configuration

Global configuration settings with the default values

```lua
---@type RsyncConfig
{
-- triggers `RsyncUp` when fugitive thinks something might have changed in the repo.
fugitive_sync = false,
-- triggers `RsyncUp` when you save a file.
sync_on_save = true,
-- the path to the project configuration
project_config_path = ".nvim/rsync.toml",
-- called when the rsync command exits, provides the exit code and the used command
on_exit = function(code, command)
end,
-- called when the rsync command prints to stderr, provides the data and the used command
on_stderr = function(data, command)
end,
}
```

## Similar projects

- [coffebar/transfer.nvim](https://github.com/coffebar/transfer.nvim)
- [KenN7/vim-arsync](https://github.com/KenN7/vim-arsync)