Keep an eye on those revision descriptions.

jj-log.nvim#

Watch your revision messages.

This plugin retrieves the latest revision description (commit message) from jj and lets you use it through a global variable. It's nice to see the description of what you are working on at the moment.

Requirements#

  • Neovim 0.10 or newer
  • jj installed and available on PATH

How do I use it?#

Once you connect a plugin, it will automatically set the vim.b.jj_desc variable, which contains the description or nil. If your currently open buffer is not a file, (e.g. terminal) vim.b.jj_desc will return nil. Make sure to handle that case in your configuration!

Example with NvChad#

-- NvChad statusbar configuration

-- ...things...
M.ui = {
  statusline = {
    enabled = true,
    theme = "default",
    separator_style = "block",
    order = { ..., "jj_msg", ... },

    modules = {
      jj_msg = function()
        local result = vim.b.jj_desc -- The variable you need

        if not result then -- Null handling - just don't display anything
          return ""
        end
        
        -- May look bad online - I am using a Nerd Font commit icon here
        return "%#St_JJ_Text# 󰜘 " .. result .. " " -- Decorating the description
      end,
    }
  }
}
-- ...things continue...

And here comes the result!

NvChad statusbar showcase

Setup#

Lazy

{
  'https://tangled.org/bpavuk.neocities.org/jj-log.nvim',
  opts = {
    -- these are default options 
    out_waiting = "...",
    out_no_jj_repo = "~no_jj_repo~",
    out_no_desc = "~no_desc~",
    max_desc_length = 47, -- including truncation dots, that's 50
  },
}

I'll be happy to add other package manager instructions! Hit me up, open an issue, or send a PR

Contributing?#

You can do so much to help me develop this plugin:

  • Try to break it and open an issue
  • Try to fix it and open a PR
  • Most importantly, spread the word about it