A NeoVim plugin written in Lua that integrates with chezmoi.
- Neovim
- chezmoi
- plenary.nvim
- telescope.nvim
- Interface for chezmoi commands.
- Sets the appropriate filetype for a source file based on the target file name.
- Preview the executed template in a new window.
- Apply all files or specified ones.
- telescope extensions for files in source directory.
First, ensure that chezmoi is in your PATH.
Then, install nvim-chezmoi
with your favorite plugin manager. You'll need both plenary and telescope installed too.
return {
"andre-kotake/nvim-chezmoi",
dependencies = {
{ "nvim-lua/plenary.nvim" },
{ "nvim-telescope/telescope.nvim" },
},
opts = {
-- Your custom config
},
config = function(_, opts)
require("nvim-chezmoi").setup(opts)
end,
}
Default configuration values for nvim-chezmoi
:
{
-- Show extra debug messages.
debug = false,
-- chezmoi source path. Defaults to the result of `chezmoi source-path`
-- Change this only if your dotfiles live in a different directory.
source_path = nil,
edit = {
-- Automatically apply file on save. Can be one of: "auto", "confirm" or "never"
apply_on_save = "never",
},
window = {
-- Changes the layout for executed template window.
execute_template = {
relative = "editor",
width = vim.o.columns,
height = vim.o.lines,
row = 0,
col = 0,
style = "minimal",
border = "single",
},
},
}
:ChezmoiApply [file...]
: Applies changes to source files. You may specify optionalfile
args to apply them only.:ChezmoiEdit [file...]
: Opens the source file from current buffer target file.You may specify optional[file]
argument if you want to open that instead. Example::ChezmoiEdit ~/.bashrc
Encrypted files have partial supported. Tested and working fine for gpg encryption as long as you haveargs: ["--quiet"]
in your chezmoi configuration.:ChezmoiManaged
: List source managed files with telescope.:ChezmoiFiles
: List special chezmoi files in source directory with telescope.
:ChezmoiExecuteTemplate
: Preview the executed template in a new buffer. Only applies for files with the ".tmpl" extension.:ChezmoiDetectFileType
: Detects the correct filetype for the opened source file. Not really much use since it does it by default whenever you open a file.
:Telescope nvim-chezmoi managed
: Lists managed files. Same as:ChezmoiManaged
.:Telescope nvim-chezmoi special_files
: Lists all chezmoi special files under source directory. Same asChezmoiFiles
.
- Refactor Telescope extension.
Stuff that helped me or inspired this:
For cool alternatives:
All contributions and suggestions are welcome; Feel free to open an issue or pull request.
MIT