A Neovim plugin for deploying files to multiple servers using rsync. Replicates JetBrains IDE deployment functionality with parallel deployment support.
- 🚀 Parallel Deployments: Deploy to multiple servers simultaneously
- 📁 File-level Deployments: Deploy individual files or entire projects
- 🔧 Flexible Configuration: Support for both single and multi-configuration setups
- 🎯 rsync Integration: Uses rsync for efficient file synchronization
- 📊 Progress Tracking: Real-time deployment progress and summaries
- ⚡ Fast Performance: Asynchronous operations with timeout support
- 🔍 Debug Mode: Built-in debugging for troubleshooting
Using lazy.nvim
{
"dmbhatti/deployment.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
-- Optional: for better key binding descriptions
"folke/which-key.nvim",
},
config = function()
require("deployment").setup({
-- Optional configuration
keymaps = true, -- Enable default keymaps (default: true)
debug = false, -- Enable debug mode (default: false)
})
end,
cmd = {
"Deploy", "DeployAll", "DeployList", "DeployInit",
"DeployFile", "DeployFileAll", "DeployFilePath",
"DeployConfigs", "DeploySetActive", "DeployDebug"
},
}Using packer.nvim
use {
"dmbhatti/deployment.nvim",
requires = { "nvim-lua/plenary.nvim" },
config = function()
require("deployment").setup()
end
}Using vim-plug
Plug 'nvim-lua/plenary.nvim'
Plug 'dmbhatti/deployment.nvim'Then in your init.lua:
require("deployment").setup()require("deployment").setup({
-- Deployment file name (default: ".deployment")
deployment_file = ".deployment",
-- Default rsync options (default: {"-avz", "--exclude=.git/", "--exclude=.DS_Store", "--exclude=node_modules/"})
rsync_options = {
"-avz",
"--exclude=.git/",
"--exclude=.DS_Store",
"--exclude=node_modules/",
},
-- Maximum parallel jobs (default: 5)
parallel_jobs = 5,
-- Timeout in milliseconds (default: 30000)
timeout = 30000,
-- Enable debug mode (default: false)
debug = false,
-- Delete remote files that don't exist locally (default: false)
delete_remote_files = false,
-- Enable default keymaps (default: true)
keymaps = true,
})Create a .deployment file in your project root:
# Deployment configuration (YAML format)
servers:
staging:
host: user@staging.example.com
remote_path: /var/www/html
local_path: .
production:
host: deploy@prod.example.com
remote_path: /var/www/html
local_path: ./dist
# Exclude patterns
exclude:
- "*.log"
- "tmp/"
- ".env*"
# Include patterns (processed before excludes)
include:
- "important.log"
# Additional rsync options
options:
- "--compress-level=6"
- "--partial"# Multi-configuration deployment file
active: development
configurations:
development:
servers:
dev1:
host: dev@dev1.example.com
remote_path: /var/www/dev
local_path: .
dev2:
host: dev@dev2.example.com
remote_path: /var/www/dev
local_path: .
exclude:
- "*.log"
- "node_modules/"
options:
- "--dry-run"
production:
servers:
prod1:
host: deploy@prod1.example.com
remote_path: /var/www/html
local_path: ./dist
prod2:
host: deploy@prod2.example.com
remote_path: /var/www/html
local_path: ./dist
exclude:
- "*.log"
- "*.tmp"
options:
- "--compress-level=9"| Command | Description |
|---|---|
:Deploy [server] |
Deploy to specific server or all servers |
:DeployAll |
Deploy to all configured servers |
:DeployList |
List configured deployment servers |
:DeployInit [multi] |
Create example .deployment file |
:DeployFile [server] |
Deploy current file to server(s) |
:DeployFileAll |
Deploy current file to all servers |
:DeployFilePath <path> [server] |
Deploy specific file by path |
:DeployConfigs |
List all configurations (multi-config) |
:DeploySetActive <config> |
Set active configuration |
:DeployDebug |
Toggle debug mode |
:DeployDebugParse |
Debug deployment file parsing |
Default keymaps (prefix: <leader>t):
| Keymap | Command | Description |
|---|---|---|
<leader>ta |
Deploy to all servers | Full deployment to all configured servers |
<leader>ts |
Deploy to specific server | Select server interactively |
<leader>tl |
List servers | Show configured deployment servers |
<leader>ti |
Create .deployment file | Interactive creation |
<leader>tf |
Deploy current file (all) | Deploy current file to all servers |
<leader>tF |
Deploy current file (specific) | Select server for current file |
<leader>tc |
List configurations | Show available configurations |
<leader>tC |
Set active configuration | Select active configuration |
To disable default keymaps:
require("deployment").setup({
keymaps = false
})-
Create a
.deploymentfile in your project root::DeployInit
-
Edit the file to configure your servers
-
Deploy to all servers:
:DeployAll
or use the keymap:
<leader>ta -
Deploy to a specific server:
:Deploy staging
or use the keymap:
<leader>ts
Deploy just the current file:
:DeployFile
# or
<leader>tfDeploy a specific file:
:DeployFilePath src/main.js staging-
Create a multi-config deployment file:
:DeployInit multi
-
List available configurations:
:DeployConfigs
-
Set active configuration:
:DeploySetActive production
-
Deploy using active configuration:
:DeployAll
Add deployment status to your lualine:
require('lualine').setup {
sections = {
lualine_x = {
require("deployment").lualine_component(),
'encoding',
'fileformat',
'filetype'
},
}
}For other status line plugins:
local deployment_status = require("deployment").lualine_component()- Neovim >= 0.7.0
- plenary.nvim
rsynccommand available in PATH- SSH access to target servers
Make sure your SSH key is added to the target servers and your SSH agent is running:
ssh-add ~/.ssh/your_key
ssh user@your-server.com # Test connectionAdd patterns to the exclude section in your .deployment file:
exclude:
- ".env*"
- "*.secret"
- "config/database.yml"
- "node_modules/"-
Enable debug mode:
:DeployDebug
-
Test deployment file parsing:
:DeployDebugParse
-
Check the deployment file syntax and server connectivity
Yes! Configure different local_path for each server:
servers:
staging:
host: user@staging.com
remote_path: /var/www/html
local_path: .
production:
host: user@prod.com
remote_path: /var/www/html
local_path: ./dist # Different local pathContributions are welcome! Please feel free to submit a Pull Request.
MIT License. See LICENSE file for details.
- transfer.nvim - Similar rsync-based deployment
- vim-rsync - Vim plugin for rsync