Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/coffebar/transfer.nvim
Syncing files with remote server using rsync and OpenSSH
https://github.com/coffebar/transfer.nvim
neovim neovim-plugin rsync ssh
Last synced: about 2 months ago
JSON representation
Syncing files with remote server using rsync and OpenSSH
- Host: GitHub
- URL: https://github.com/coffebar/transfer.nvim
- Owner: coffebar
- Created: 2023-10-24T20:29:16.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2023-10-31T19:42:58.000Z (7 months ago)
- Last Synced: 2024-01-24T10:42:34.450Z (4 months ago)
- Topics: neovim, neovim-plugin, rsync, ssh
- Language: Lua
- Homepage:
- Size: 60.5 KB
- Stars: 35
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Lists
- awesome-neovim - coffebar/transfer.nvim - Sync and diff with remote server using rsync and OpenSSH. (Deployment / Quickfix)
- awesome-neovim - coffebar/transfer.nvim - Sync and diff with remote server using rsync and OpenSSH. (Deployment / Quickfix)
- awesome-neovim - coffebar/transfer.nvim - Sync and diff with remote server using rsync and OpenSSH. (Deployment / Quickfix)
README
# transfer.nvim
## Description
Transfer.nvim is a Neovim plugin for syncing files with remote server using rsync and OpenSSH.
It supports mapping multiple local and remote paths, excluded path, and more.
## Install
### Lazy.nvim
```lua
{
"coffebar/transfer.nvim",
lazy = true,
cmd = { "TransferInit", "DiffRemote", "TransferUpload", "TransferDownload", "TransferDirDiff", "TransferRepeat" },
opts = {},
},
```## Commands
- `TransferInit` - create a config file and open it. Just edit if it already exists.
- `DiffRemote` - open a diff view with the remote file.
- `TransferRepeat` - repeat the last transfer command (except TransferInit, DiffRemote).
- `TransferUpload [path]` - upload the given file or directory.
- `TransferDownload [path]` - download the given file or directory.
- `TransferDirDiff [path]` - diff the directory with the remote one and display the changed files in the quickfix.## Deployment config example
```lua
-- .nvim/deployment.lua
return {
["example_name"] = {
host = "myhost",
username = "web", -- optional
mappings = {
{
["local"] = "live", -- path relative to project root
["remote"] = "/var/www/example.com", -- absolute path or relative to user home
},
{
["local"] = "test",
["remote"] = "/var/www/test.example.com",
},
},
excludedPaths = { -- optional
"live/src/", -- local path relative to project root
"test/src/",
},
},
}
```Example `~/.ssh/config` for passwordless auth:
```ssh
Host myhost
HostName 127.1.177.12
User web
IdentityFile ~/.ssh/myhost_keyHost server2
...
```## Suggested mappings
### Neo-tree
```lua
{
window = {
mappings = {
-- upload (sync files)
uu = {
function(state)
vim.cmd("TransferUpload " .. state.tree:get_node().path)
end,
desc = "upload file or directory",
nowait = true,
},
-- download (sync files)
ud = {
function(state)
vim.cmd("TransferDownload" .. state.tree:get_node().path)
end,
desc = "download file or directory",
nowait = true,
},
-- diff directory with remote
uf = {
function(state)
local node = state.tree:get_node()
local context_dir = node.path
if node.type ~= "directory" then
-- if not a directory
-- one level up
context_dir = context_dir:gsub("/[^/]*$", "")
end
vim.cmd("TransferDirDiff " .. context_dir)
vim.cmd("Neotree close")
end,
desc = "diff with remote",
},
},
},
}
```### Which-key
```lua
require("which-key").register({
[""] = {
u = {
name = "Upload / Download",
d = { "TransferDownload", "Download from remote server (scp)" },
u = { "TransferUpload", "Upload to remote server (scp)" },
f = { "DiffRemote", "Diff file with remote server (scp)" },
i = { "TransferInit", "Init/Edit Deployment config" },
r = { "TransferRepeat", "Repeat transfer command" },
},
}
})
```## Recommended to use with
- [rcarriga/nvim-notify](https://github.com/rcarriga/nvim-notify) - animated popup notifications.
- [nvim-neo-tree/neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim) - file explorer.
- [coffebar/neovim-project](https://github.com/coffebar/neovim-project) - project management.## Migration from JetBrains config
[Check this repo](https://github.com/coffebar/jetbrains-deployment-config-to-lua) for converting you config from JetBrains projects.
## Config
[Look at defaults](https://github.com/coffebar/transfer.nvim/blob/main/lua/transfer/config.lua) and overwrite anything in your opts.
## Demo video
https://github.com/coffebar/transfer.nvim/assets/3100053/32cb642a-9040-47dd-a661-4058869c79f1
## Not tested or not working:
- Windows paths;
- SSH Auth that is not passwordless.## Contributing
Feel free to contribute, open issues, and submit pull requests to help us improve transfer.nvim.
Run tests with `make test`.
## Similar projects
- [KenN7/vim-arsync](https://github.com/KenN7/vim-arsync)
- [OscarCreator/rsync.nvim](https://github.com/OscarCreator/rsync.nvim)