A Neovim plugin for handling Ansible vault encrypted files.
- Automatically detects Ansible vault encrypted files
- Decrypts vault files using vault password file
- Supports saving encrypted files with
:w
command - Maintains encryption when saving files
- Supports custom vault password file patterns
- Integrates with Ansible vault commands
Using lazy.nvim:
{
"apayu/nvim-ansible-vault",
config = function()
require("ansible-vault").setup({
-- Optional custom configuration
vault_password_files = {'.vault_pass', '.vault-pass'},
patterns = {'*/host_vars/*/vault.yml', '*/group_vars/*/vault.yml'},
vault_id = 'default'
})
end,
event = "BufReadPre */vault.yml", -- Load only when opening vault files
}
Default configuration:
{
-- Patterns for vault password files to look for
vault_password_files = {'.vault_pass', '.vault-pass'},
-- File patterns to trigger the plugin
patterns = {'*/host_vars/*/vault.yml', '*/group_vars/*/vault.yml'},
-- Default vault ID to use
vault_id = 'default'
}
- Neovim >= 0.8.0
- Ansible vault command line tool
- Place your vault password in a
.vault_pass
or.vault-pass
file in your project directory - Open an encrypted vault file
- The plugin will automatically detect and decrypt the file
- Edit the file normally
- Save with
:w
to encrypt and save the file
Contributions are welcome! Please feel free to submit a Pull Request.