Keep an eye on those revision descriptions.
1# `jj-log.nvim`
2
3*Watch your revision messages.*
4
5This 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.
6
7## Requirements
8
9- Neovim 0.10 or newer
10- `jj` installed and available on `PATH`
11
12## How do I use it?
13
14Once 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!
15
16## Example with NvChad
17
18```lua
19-- NvChad statusbar configuration
20
21-- ...things...
22M.ui = {
23 statusline = {
24 enabled = true,
25 theme = "default",
26 separator_style = "block",
27 order = { ..., "jj_msg", ... },
28
29 modules = {
30 jj_msg = function()
31 local result = vim.b.jj_desc -- The variable you need
32
33 if not result then -- Null handling - just don't display anything
34 return ""
35 end
36
37 -- May look bad online - I am using a Nerd Font commit icon here
38 return "%#St_JJ_Text# " .. result .. " " -- Decorating the description
39 end,
40 }
41 }
42}
43-- ...things continue...
44
45```
46
47And here comes the result!
48
49
50
51## Setup
52
53**Lazy**
54```lua
55{
56 'https://tangled.org/bpavuk.neocities.org/jj-log.nvim',
57 opts = {
58 -- these are default options
59 out_waiting = "...",
60 out_no_jj_repo = "~no_jj_repo~",
61 out_no_desc = "~no_desc~",
62 max_desc_length = 47, -- including truncation dots, that's 50
63 },
64}
65```
66
67I'll be happy to add other package manager instructions! Hit me up, open an issue, or send a PR
68
69## Contributing?
70
71You can do so much to help me develop this plugin:
72
73- Try to break it and open an issue
74- Try to fix it and open a PR
75- Most importantly, spread the word about it