Skip to content

Commit

Permalink
pack(jj): Add lazyjj
Browse files Browse the repository at this point in the history
  • Loading branch information
Cretezy committed May 24, 2024
1 parent a34848c commit a4e6a3d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions lua/astrocommunity/pack/jj/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ This plugin pack does the following:
- `<Leader>jd` for files with changes, like `jj diff`
- `<Leader>jc` for files with conflicts, like `jj resolve --list`
- Adds syntax highlighting for `.jjdescription` files (for use with `jj describe`) with [vim-jjdescription](https://github.com/avm99963/vim-jjdescription)
- Adds a [lazyjj](https://github.com/Cretezy/lazyjj) (TUI for jj) terminal with `<Leader>jl` when `lazyjj` is in `$PATH`
19 changes: 19 additions & 0 deletions lua/astrocommunity/pack/jj/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,23 @@ return {
},
},
{ "avm99963/vim-jjdescription", lazy = false },
{
"AstroNvim/astrocore",
---@param opts AstroCoreOpts
opts = function(_, opts)
local maps = assert(opts.mappings)

if vim.fn.executable "lazyjj" == 1 then
maps.n["<Leader>jl"] = {
function()
local astro = require "astrocore"
local worktree = astro.file_worktree()
local flags = worktree and ("--path '%s'"):format(worktree.toplevel, worktree.gitdir) or ""
astro.toggle_term_cmd("lazyjj " .. flags)
end,
desc = "lazyjj",
}
end
end,
},
}

0 comments on commit a4e6a3d

Please sign in to comment.