irongit

Configure synchronization of files and directories through a plugin.

syncmap.nvim/README.md
136 lines3.1 KBMarkdown
1# syncmap.nvim
2
3A lightweight Neovim plugin that keeps directories in sync using `inotifywait`, `rsync`, and some clever Vimscript + Lua integration.
4
5## Motivation
6
7- Dotfiles
8
9## Features
10
11- Automatically sync source → destination directories on file changes
12- Uses `inotifywait`, `pgrep`, `pkill`, and `rsync`
13- Supports `.gitignore`-like exclusions via `--exclude-from`
14- Reverse sync on startup (optional)
15- Logs and restarts lost watchers automatically
16- Fully typed config for autocompletion and inline docs
17- Automatically expands paths in the config
18
19## Requirements
20
21- Linux (uses `inotifywait`)
22- Neovim 0.8+
23- Tools:
24 - `inotifywait` (from `inotify-tools`)
25 - `rsync`
26 - `pgrep` and `pkill` (from `procps-ng`)
27
28## Installation
29
30Using [lazy.nvim]https://github.com/folke/lazy.nvim:
31
32```lua
33{
34 dir = vim.fn.expand("~/code/nvim-plugins/syncmap/"),
35 name = "syncmap.nvim",
36 opts = {
37 map = {
38 { "~/.dotfiles/test/", "~/.config/test/" },
39 },
40 log_level = "info",
41 },
42}
43````
44
45## Default Options
46
47```lua
48{
49 map = {
50 { "~/.dotfiles/nvim/", "~/.config/nvim/" },
51 },
52 reverse_sync_on_startup = true,
53 rsync = { "-a", "--delete" },
54 log_level = "error",
55}
56```
57
58## Type Hints
59
60For inline type hints and autocomplete, annotate your `opts` using:
61
62```lua
63if false then
64 require("syncmap.types")
65 require("lazy.types")
66end
67---@type LazySpec
68return {
69 "huncholane/syncmap.nvim",
70 ---@type SyncmapOpts
71 opts = {
72 map = {
73 { "~/.dotfiles/nvim/", "~/.config/nvim/" },
74 { "~/.dotfiles/tmux/", "~/.config/tmux/" },
75 },
76 },
77}
78```
79
80or ...
81
82```lua
83if false then
84 require("syncmap.types")
85 require("lazy.types")
86end
87return {
88 ---@type LazySpec
89 {
90 "huncholane/syncmap.nvim",
91 ---@type SyncmapOpts
92 opts = {
93 map = {
94 { "~/.dotfiles/nvim/", "~/.config/nvim/" },
95 { "~/.dotfiles/tmux/", "~/.config/tmux/" },
96 },
97 },
98 }
99}
100```
101
102## Type Sample
103
104![type-sample]./doc/type.png
105
106This gives you full visibility into available options and correct types.
107
108---
109
110### LICENSE
111
112```txt
113MIT License
114
115Copyright (c) 2025 huncholane
116
117Permission is hereby granted, free of charge, to any person obtaining a copy
118of this software and associated documentation files (the "Software"), to deal
119in the Software without restriction, including without limitation the rights
120to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
121copies of the Software, and to permit persons to whom the Software is
122furnished to do so, subject to the following conditions:
123
124The above copyright notice and this permission notice shall be included in all
125copies or substantial portions of the Software.
126
127THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
128IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
129FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
130AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
131LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
132OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
133SOFTWARE.
134```
135
136---