🔄 A Neovim plugin for syncing your configuration across multiple devices using GitHub.
- 🚀 One-time setup: Ask for GitHub repository once and store configuration locally
- 🔄 Auto-sync on startup: Automatically sync your configuration when Neovim starts
- 📱 Multi-device support: Keep your configuration in sync across all your machines
- ⚙️ Configurable: Customize sync behavior, commit messages, and more
- 🔧 Easy management: Simple commands for manual sync operations
- 🔒 Privacy-focused: Repository settings stored locally (not synced)
Using Lazy.nvim (Recommended)
Add to your plugin configuration:
{
"pedroresende/nvim-sync.nvim",
lazy = false,
priority = 1000,
opts = {
-- Optional configuration
auto_sync = false, -- Set to true for automatic sync on save
sync_on_startup = true, -- Sync on Neovim startup
branch = "main", -- Git branch to use
},
}Using Packer.nvim
use {
'pedroresende/nvim-sync.nvim',
config = function()
require('nvim-sync').setup({
-- your configuration here
})
end
}git clone https://github.com/pedroresende/nvim-sync.nvim.git ~/.local/share/nvim/site/pack/packer/start/nvim-sync.nvim- Install the plugin using your preferred method above
- Restart Neovim
- First-time setup: You'll be prompted for:
- GitHub username
- Repository name (defaults to "nvim-config")
- Done! Your configuration will now sync automatically
| Command | Description |
|---|---|
:NvimSyncStatus |
Show Git status of your configuration |
:NvimSyncPull |
Pull changes from remote repository |
:NvimSyncPush |
Push local changes to remote repository |
:NvimSync |
Full sync (pull then push) |
:NvimSyncCommit |
Commit changes with a timestamped message |
:NvimSyncConfigure |
Reconfigure GitHub repository settings |
:NvimSyncInit |
Initialize a new Git repository |
:NvimSyncCleanup |
Clean up git lock files and resolve issues |
| Key | Action |
|---|---|
<leader>gs |
Git Status |
<leader>gpl |
Git Pull |
<leader>gps |
Git Push |
<leader>gy |
Git Sync (Pull + Push) |
# 1. Clone your nvim config
git clone https://github.com/yourusername/nvim-config ~/.config/nvim
# 2. Start Neovim (plugin will be installed via your package manager)
nvim
# 3. Plugin automatically syncs your latest configuration- Make changes to your configuration
- Restart Neovim → automatic sync
- Or manually run
:NvimSync
require('nvim-sync').setup({
auto_sync = false, -- Auto-sync on file save
sync_on_startup = true, -- Sync when Neovim starts
commit_message_template = "Auto-sync - %s", -- Commit message template
branch = "main", -- Git branch to use
config_file_name = "sync-config.lua", -- Local config file name
})To switch to a different repository:
:NvimSyncConfigureThis will prompt for new GitHub username and repository name.
The plugin provides direct access to git operations:
:NvimSyncStatus " Check what files have changed
:NvimSyncPull " Pull latest changes
:NvimSyncPush " Push your changes
:NvimSyncCommit " Commit changes with a timestamped message
:NvimSyncCleanup " Clean up git lock files if you encounter issuesIf you encounter errors like "could not lock config file .git/config: File exists", the plugin automatically cleans up lock files before each operation. However, you can also manually run:
:NvimSyncCleanup- HTTPS Authentication: If you're using HTTPS URLs and getting authentication prompts, consider switching to SSH
- SSH Setup: Make sure you have SSH keys set up with GitHub for seamless authentication
- Repository Access: Ensure you have push access to the configured repository
- Check if the plugin loaded: Look for "Nvim Sync plugin loaded successfully!" message
- Verify git is installed: The plugin requires git to be available in your PATH
- Check configuration: Run
:NvimSyncStatusto see current repository status
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see LICENSE file for details.