Skip to content

Commit e1019c9

Browse files
authored
docs: add lazy.nvim usage (#15)
* docs: add lazy.nvim usage * docs: clarify pending selection commands * docs: remove visual default mapping rows
1 parent 38fe8be commit e1019c9

1 file changed

Lines changed: 140 additions & 0 deletions

File tree

README.md

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# bullets.nvim
2+
3+
Neovim Lua plugin for continuing, renumbering, promoting, demoting, and toggling bullet lists.
4+
5+
## Installation
6+
7+
With [lazy.nvim](https://github.com/folke/lazy.nvim):
8+
9+
```lua
10+
{
11+
"bullets-vim/bullets.nvim",
12+
opts = {},
13+
}
14+
```
15+
16+
Configure options through `opts`:
17+
18+
```lua
19+
{
20+
"bullets-vim/bullets.nvim",
21+
opts = {
22+
enabled_file_types = { "markdown", "text", "gitcommit" },
23+
mapping_leader = "",
24+
},
25+
}
26+
```
27+
28+
Without a plugin manager, call setup from Lua:
29+
30+
```lua
31+
require("bullets").setup({})
32+
```
33+
34+
Vim is unsupported. Vimscript configuration, including `vim.g.bullets_*` variables, is unsupported.
35+
Configure this plugin only with `require("bullets").setup({})` or lazy.nvim `opts`.
36+
37+
## Options
38+
39+
Defaults from `lua/bullets/config.lua`:
40+
41+
```lua
42+
{
43+
enabled_file_types = { "markdown", "text", "gitcommit" },
44+
enable_in_empty_buffers = false,
45+
set_mappings = true,
46+
mapping_leader = "",
47+
custom_mappings = {},
48+
delete_last_bullet_if_empty = 1,
49+
line_spacing = 1,
50+
pad_right = true,
51+
max_alpha_characters = 2,
52+
enable_roman_list = true,
53+
list_item_styles = { "-", "*+", ".+", "#.", "+", "\\item" },
54+
outline_levels = { "ROM", "ABC", "num", "abc", "rom", "std-", "std*", "std+" },
55+
renumber_on_change = true,
56+
nested_checkboxes = true,
57+
enable_wrapped_lines = true,
58+
checkbox_markers = " .oOX",
59+
checkbox_partials_toggle = 1,
60+
auto_indent_after_colon = true,
61+
}
62+
```
63+
64+
`custom_mappings` entries are passed to `vim.keymap.set` as `{ mode, lhs, rhs }` for each configured buffer.
65+
66+
## Commands
67+
68+
The plugin defines these commands:
69+
70+
| Command | Action |
71+
| ---------------------- | ---------------------------------------- |
72+
| `:InsertNewBullet` | Insert a continued list item. |
73+
| `:RenumberList` | Renumber the current list. |
74+
| `:RenumberSelection` | Renumber the selected range. |
75+
| `:ToggleCheckbox` | Toggle the checkbox on the current item. |
76+
| `:RecomputeCheckboxes` | Recompute nested checkbox states. |
77+
| `:BulletDemote` | Demote the current item. |
78+
| `:BulletPromote` | Promote the current item. |
79+
| `:BulletDemoteVisual` | Demote the selected range. |
80+
| `:BulletPromoteVisual` | Promote the selected range. |
81+
82+
These selection commands are registered but not implemented yet: `:SelectCheckbox`,
83+
`:SelectCheckboxInside`, `:SelectBullet`, and `:SelectBulletText`.
84+
85+
## Mappings
86+
87+
Default mappings are buffer-local for `enabled_file_types` when `set_mappings = true`.
88+
Each left-hand side is prefixed with `mapping_leader`, which defaults to an empty string.
89+
90+
| Mode | Mapping | Action |
91+
| ------ | ----------- | ---------------------------------------- |
92+
| Insert | `<CR>` | Insert a continued list item. |
93+
| Insert | `<C-CR>` | Insert a plain newline. |
94+
| Normal | `o` | Insert a continued list item. |
95+
| Normal | `gN` | Renumber the current list. |
96+
| Visual | `gN` | Renumber the selected range. |
97+
| Normal | `<leader>x` | Toggle the checkbox on the current item. |
98+
| Insert | `<C-t>` | Demote the current item. |
99+
| Normal | `>>` | Demote the current item. |
100+
| Insert | `<C-d>` | Promote the current item. |
101+
| Normal | `<<` | Promote the current item. |
102+
103+
The plugin also defines these `<Plug>` mappings for custom mappings:
104+
105+
| Mapping | Modes |
106+
| -------------------------------------- | ---------------------- |
107+
| `<Plug>(bullets-newline)` | Insert, Normal |
108+
| `<Plug>(bullets-renumber)` | Normal, Visual |
109+
| `<Plug>(bullets-toggle-checkbox)` | Normal |
110+
| `<Plug>(bullets-recompute-checkboxes)` | Normal |
111+
| `<Plug>(bullets-demote)` | Insert, Normal, Visual |
112+
| `<Plug>(bullets-promote)` | Insert, Normal, Visual |
113+
114+
## Development
115+
116+
Install tools with mise:
117+
118+
```sh
119+
mise install
120+
```
121+
122+
Format files:
123+
124+
```sh
125+
mise run fmt
126+
```
127+
128+
Check formatting:
129+
130+
```sh
131+
mise run fmt:check
132+
```
133+
134+
Run tests:
135+
136+
```sh
137+
mise run test
138+
```
139+
140+
The test task runs each `test/*_spec.lua` file in headless Neovim with plenary.

0 commit comments

Comments
 (0)