Skip to content

Commit ca1fc45

Browse files
committed
docs(readme): extend documentation
Signed-off-by: Guennadi Maximov C <g.maxc.fox@protonmail.com>
1 parent da0ce06 commit ca1fc45

1 file changed

Lines changed: 44 additions & 1 deletion

File tree

README.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ https://github.com/user-attachments/assets/b3f7124a-736e-425c-9c08-f3e0504c238f
1818
- [LuaRocks](#luarocks)
1919
- [Configuration](#configuration)
2020
- [Defaults](#defaults)
21+
- [Usage](#usage)
22+
- [Keymaps](#keymaps)
2123
- [License](#license)
2224

2325
---
@@ -135,7 +137,7 @@ By default, `setup()` loads with the following options:
135137
auto_write = false,
136138

137139
-- A list of strings with the filetypes for which this plugin will be deactivated
138-
ignore_ft = {}
140+
ignore_ft = {},
139141

140142
-- Normal mode keymaps
141143
--
@@ -157,6 +159,47 @@ By default, `setup()` loads with the following options:
157159

158160
---
159161

162+
## Usage
163+
164+
You must place your cursor at any character of the boolean value. Supported boolean words are:
165+
166+
- `true` / `false`
167+
- `True` / `False`
168+
- `TRUE` / `FALSE`
169+
170+
### Keymaps
171+
172+
You can use a Normal mode keymap, either created in `setup()` or manually (read below).
173+
174+
<details>
175+
<summary>Through setup</summary>
176+
177+
```lua
178+
-- THIS IS JUST AN EXAMPLE, MODIFY AT WILL.
179+
-- TO DISABLE ONE OF THE KEYMAPS, SET THEM TO `nil`
180+
require('boolean-toggle').setup({
181+
keymaps = {
182+
toggle = '<CR>', -- Toggle on ENTER
183+
to_false = '<BS>', -- Set to `false` by pressing Backspace
184+
to_true = '<C-BS>', -- Set to `false` by pressing CTRL + Backspace
185+
},
186+
})
187+
```
188+
189+
</details>
190+
<details>
191+
<summary>Manually</summary>
192+
193+
| Function | Description | `setup()` Option |
194+
|-----------------------------------------------------|---------------------------------|-------------------|
195+
| `require('boolean-toggle').cursor_toggle_boolean()` | Toggles between boolean values. | `keymap.toggle` |
196+
| `require('boolean-toggle').cursor_set_to_true()` | Sets boolean to `true`. | `keymap.to_false` |
197+
| `require('boolean-toggle').cursor_set_to_false()` | Sets boolean to `false`. | `keymap.to_true` |
198+
199+
</details>
200+
201+
---
202+
160203
## License
161204

162205
[GPLv2](https://github.com/DrKJeff16/boolean-toggle.nvim/blob/main/LICENSE)

0 commit comments

Comments
 (0)