Skip to content

Commit

Permalink
feat(pack): add Chezmoi pack (#1102)
Browse files Browse the repository at this point in the history
  • Loading branch information
mehalter committed Jul 9, 2024
1 parent eece4c6 commit ccb2f57
Show file tree
Hide file tree
Showing 2 changed files with 135 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lua/astrocommunity/pack/chezmoi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Chezmoi Pack

This plugin pack does the following:

- [chezmoi.vim](https://github.com/alker0/chezmoi.vim) for syntax highlighting of Chezmoi templates
- [chezmoi.nvim](https://github.com/xvzc/chezmoi.nvim) searching and applying Chezmoi configurations
- Adds the [TOML Language Pack](https://github.com/AstroNvim/astrocommunity/tree/main/lua/astrocommunity/pack/toml) for editing Chezmoi configuration file
128 changes: 128 additions & 0 deletions lua/astrocommunity/pack/chezmoi/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
return {
{ import = "astrocommunity.pack.toml" },
{
"alker0/chezmoi.vim",
lazy = false,
specs = {
{
"AstroNvim/astrocore",
opts = {
options = {
g = {
["chezmoi#use_tmp_buffer"] = 1,
["chezmoi#source_dir_path"] = os.getenv "HOME" .. "/.local/share/chezmoi",
},
},
},
},
},
},
{
"xvzc/chezmoi.nvim",
opts = {
edit = {
watch = false,
force = false,
},
notification = {
on_open = true,
on_apply = true,
on_watch = false,
},
telescope = {
select = { "<CR>" },
},
},
specs = {
{
"AstroNvim/astrocore",
---@type AstroCoreOpts
opts = {
autocmds = {
chezmoi = {
{
event = { "BufRead", "BufNewFile" },
pattern = { os.getenv "HOME" .. "/.local/share/chezmoi/*" },
callback = function() vim.schedule(require("chezmoi.commands.__edit").watch) end,
},
},
},
},
},
{
"nvim-telescope/telescope.nvim",
optional = true,
dependencies = {
"xvzc/chezmoi.nvim",
{
"AstroNvim/astrocore",
opts = {
mappings = {
n = {
["<Leader>f."] = {
function() require("telescope").extensions.chezmoi.find_files() end,
desc = "Find chezmoi config",
},
},
},
},
},
},
opts = function() require("telescope").load_extension "chezmoi" end,
},
},
{
"ibhagwan/fzf-lua",
optional = true,
dependencies = {
{
"AstroNvim/astrocore",
---@type AstroCoreOpts
opts = {
commands = {
ChezmoiFzf = {
function()
require("fzf-lua").fzf_exec(require("chezmoi.commands").list(), {
actions = {
["default"] = function(selected, _)
require("chezmoi.commands").edit {
targets = { "~/" .. selected[1] },
args = { "--watch" },
}
end,
},
})
end,
desc = "Search Chezmoi configuration with FZF",
},
},
mappings = {
n = {
["<Leader>f."] = { function() vim.cmd.ChezmoiFzf() end, desc = "Find chezmoi config" },
},
},
},
},
},
},
},
{
"echasnovski/mini.icons",
optional = true,
opts = {
file = {
[".chezmoiignore"] = { glyph = "", hl = "MiniIconsGrey" },
[".chezmoiremove"] = { glyph = "", hl = "MiniIconsGrey" },
[".chezmoiroot"] = { glyph = "", hl = "MiniIconsGrey" },
[".chezmoiversion"] = { glyph = "", hl = "MiniIconsGrey" },
["bash.tmpl"] = { glyph = "", hl = "MiniIconsGrey" },
["json.tmpl"] = { glyph = "", hl = "MiniIconsGrey" },
["ps1.tmpl"] = { glyph = "󰨊", hl = "MiniIconsGrey" },
["sh.tmpl"] = { glyph = "", hl = "MiniIconsGrey" },
["toml.tmpl"] = { glyph = "", hl = "MiniIconsGrey" },
["yaml.tmpl"] = { glyph = "", hl = "MiniIconsGrey" },
["zsh.tmpl"] = { glyph = "", hl = "MiniIconsGrey" },
},
},
},
}

0 comments on commit ccb2f57

Please sign in to comment.