retrovim 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/.conda/retrovim.yaml +259 -0
  2. package/.conda/terax.icns +0 -0
  3. package/.conda/terax.ico +0 -0
  4. package/.conda/terax.png +0 -0
  5. package/.github/workflows/release.yml +95 -0
  6. package/.gitmodules +3 -0
  7. package/.npm/kanata_touchcursor.js +28 -0
  8. package/.npm/nvim.js +26 -0
  9. package/.npm/yazi.js +26 -0
  10. package/.npm/zsh.js +17 -0
  11. package/.pip/kanata_touchcursor/__init__.py +28 -0
  12. package/.pip/nvim/__init__.py +31 -0
  13. package/.pip/yazi/__init__.py +31 -0
  14. package/.pip/zsh/__init__.py +22 -0
  15. package/CHANGELOG.md +26 -0
  16. package/LICENSE +674 -0
  17. package/README.md +336 -0
  18. package/kanata/touchcursor.kbd +164 -0
  19. package/nvim/init.lua +813 -0
  20. package/nvim/plugins/mini.nvim/.github/DISCUSSION_TEMPLATE/q-a.yml +72 -0
  21. package/nvim/plugins/mini.nvim/.github/ISSUE_TEMPLATE/bug-report.yml +136 -0
  22. package/nvim/plugins/mini.nvim/.github/ISSUE_TEMPLATE/config.yml +5 -0
  23. package/nvim/plugins/mini.nvim/.github/ISSUE_TEMPLATE/feature-request.yml +75 -0
  24. package/nvim/plugins/mini.nvim/.github/PULL_REQUEST_TEMPLATE.md +2 -0
  25. package/nvim/plugins/mini.nvim/.github/workflows/quality-control.yml +150 -0
  26. package/nvim/plugins/mini.nvim/.pre-commit-config.yaml +20 -0
  27. package/nvim/plugins/mini.nvim/.stylua.toml +7 -0
  28. package/nvim/plugins/mini.nvim/.styluaignore +1 -0
  29. package/nvim/plugins/mini.nvim/CHANGELOG.md +1894 -0
  30. package/nvim/plugins/mini.nvim/CODE_OF_CONDUCT.md +132 -0
  31. package/nvim/plugins/mini.nvim/CONTRIBUTING.md +331 -0
  32. package/nvim/plugins/mini.nvim/LICENSE +21 -0
  33. package/nvim/plugins/mini.nvim/MAINTAINING.md +330 -0
  34. package/nvim/plugins/mini.nvim/Makefile +51 -0
  35. package/nvim/plugins/mini.nvim/README.md +261 -0
  36. package/nvim/plugins/mini.nvim/TESTING.md +1011 -0
  37. package/nvim/plugins/mini.nvim/benchmarks/starter/README.md +35 -0
  38. package/nvim/plugins/mini.nvim/benchmarks/starter/benchmark.sh +56 -0
  39. package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_dashboard-alpha.lua +21 -0
  40. package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_dashboard-original.lua +17 -0
  41. package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_dashboard-starter.lua +18 -0
  42. package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_empty.lua +4 -0
  43. package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_starter-default.lua +7 -0
  44. package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_startify-alpha.lua +10 -0
  45. package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_startify-original.lua +7 -0
  46. package/nvim/plugins/mini.nvim/benchmarks/starter/init-files/init_startify-starter.lua +20 -0
  47. package/nvim/plugins/mini.nvim/benchmarks/starter/install.sh +10 -0
  48. package/nvim/plugins/mini.nvim/benchmarks/starter/make_summary.py +68 -0
  49. package/nvim/plugins/mini.nvim/benchmarks/starter/startup-summary.md +10 -0
  50. package/nvim/plugins/mini.nvim/colors/miniautumn.lua +55 -0
  51. package/nvim/plugins/mini.nvim/colors/minicyan.lua +95 -0
  52. package/nvim/plugins/mini.nvim/colors/minischeme.lua +95 -0
  53. package/nvim/plugins/mini.nvim/colors/minispring.lua +53 -0
  54. package/nvim/plugins/mini.nvim/colors/minisummer.lua +49 -0
  55. package/nvim/plugins/mini.nvim/colors/miniwinter.lua +51 -0
  56. package/nvim/plugins/mini.nvim/colors/randomhue.lua +16 -0
  57. package/nvim/plugins/mini.nvim/doc/mini-ai.txt +889 -0
  58. package/nvim/plugins/mini.nvim/doc/mini-align.txt +923 -0
  59. package/nvim/plugins/mini.nvim/doc/mini-animate.txt +937 -0
  60. package/nvim/plugins/mini.nvim/doc/mini-base16.txt +285 -0
  61. package/nvim/plugins/mini.nvim/doc/mini-basics.txt +359 -0
  62. package/nvim/plugins/mini.nvim/doc/mini-bracketed.txt +622 -0
  63. package/nvim/plugins/mini.nvim/doc/mini-bufremove.txt +123 -0
  64. package/nvim/plugins/mini.nvim/doc/mini-clue.txt +760 -0
  65. package/nvim/plugins/mini.nvim/doc/mini-cmdline.txt +392 -0
  66. package/nvim/plugins/mini.nvim/doc/mini-colors.txt +880 -0
  67. package/nvim/plugins/mini.nvim/doc/mini-comment.txt +230 -0
  68. package/nvim/plugins/mini.nvim/doc/mini-completion.txt +477 -0
  69. package/nvim/plugins/mini.nvim/doc/mini-cursorword.txt +105 -0
  70. package/nvim/plugins/mini.nvim/doc/mini-deps.txt +590 -0
  71. package/nvim/plugins/mini.nvim/doc/mini-diff.txt +661 -0
  72. package/nvim/plugins/mini.nvim/doc/mini-doc.txt +434 -0
  73. package/nvim/plugins/mini.nvim/doc/mini-extra.txt +856 -0
  74. package/nvim/plugins/mini.nvim/doc/mini-files.txt +1018 -0
  75. package/nvim/plugins/mini.nvim/doc/mini-fuzzy.txt +160 -0
  76. package/nvim/plugins/mini.nvim/doc/mini-git.txt +425 -0
  77. package/nvim/plugins/mini.nvim/doc/mini-hipatterns.txt +489 -0
  78. package/nvim/plugins/mini.nvim/doc/mini-hues.txt +420 -0
  79. package/nvim/plugins/mini.nvim/doc/mini-icons.txt +508 -0
  80. package/nvim/plugins/mini.nvim/doc/mini-indentscope.txt +485 -0
  81. package/nvim/plugins/mini.nvim/doc/mini-input.txt +932 -0
  82. package/nvim/plugins/mini.nvim/doc/mini-jump.txt +202 -0
  83. package/nvim/plugins/mini.nvim/doc/mini-jump2d.txt +525 -0
  84. package/nvim/plugins/mini.nvim/doc/mini-keymap.txt +449 -0
  85. package/nvim/plugins/mini.nvim/doc/mini-map.txt +717 -0
  86. package/nvim/plugins/mini.nvim/doc/mini-misc.txt +431 -0
  87. package/nvim/plugins/mini.nvim/doc/mini-move.txt +181 -0
  88. package/nvim/plugins/mini.nvim/doc/mini-notify.txt +434 -0
  89. package/nvim/plugins/mini.nvim/doc/mini-nvim.txt +431 -0
  90. package/nvim/plugins/mini.nvim/doc/mini-operators.txt +472 -0
  91. package/nvim/plugins/mini.nvim/doc/mini-pairs.txt +346 -0
  92. package/nvim/plugins/mini.nvim/doc/mini-pick.txt +1535 -0
  93. package/nvim/plugins/mini.nvim/doc/mini-sessions.txt +239 -0
  94. package/nvim/plugins/mini.nvim/doc/mini-snippets.txt +1291 -0
  95. package/nvim/plugins/mini.nvim/doc/mini-splitjoin.txt +536 -0
  96. package/nvim/plugins/mini.nvim/doc/mini-starter.txt +618 -0
  97. package/nvim/plugins/mini.nvim/doc/mini-statusline.txt +361 -0
  98. package/nvim/plugins/mini.nvim/doc/mini-surround.txt +863 -0
  99. package/nvim/plugins/mini.nvim/doc/mini-tabline.txt +151 -0
  100. package/nvim/plugins/mini.nvim/doc/mini-test.txt +966 -0
  101. package/nvim/plugins/mini.nvim/doc/mini-trailspace.txt +91 -0
  102. package/nvim/plugins/mini.nvim/doc/mini-visits.txt +937 -0
  103. package/nvim/plugins/mini.nvim/logo.png +0 -0
  104. package/nvim/plugins/mini.nvim/lua/mini/ai.lua +2244 -0
  105. package/nvim/plugins/mini.nvim/lua/mini/align.lua +2076 -0
  106. package/nvim/plugins/mini.nvim/lua/mini/animate.lua +2127 -0
  107. package/nvim/plugins/mini.nvim/lua/mini/base16.lua +1752 -0
  108. package/nvim/plugins/mini.nvim/lua/mini/basics.lua +772 -0
  109. package/nvim/plugins/mini.nvim/lua/mini/bracketed.lua +2013 -0
  110. package/nvim/plugins/mini.nvim/lua/mini/bufremove.lua +283 -0
  111. package/nvim/plugins/mini.nvim/lua/mini/clue.lua +2096 -0
  112. package/nvim/plugins/mini.nvim/lua/mini/cmdline.lua +1182 -0
  113. package/nvim/plugins/mini.nvim/lua/mini/colors.lua +2483 -0
  114. package/nvim/plugins/mini.nvim/lua/mini/comment.lua +586 -0
  115. package/nvim/plugins/mini.nvim/lua/mini/completion.lua +2094 -0
  116. package/nvim/plugins/mini.nvim/lua/mini/cursorword.lua +311 -0
  117. package/nvim/plugins/mini.nvim/lua/mini/deps.lua +1660 -0
  118. package/nvim/plugins/mini.nvim/lua/mini/diff.lua +1938 -0
  119. package/nvim/plugins/mini.nvim/lua/mini/doc.lua +1371 -0
  120. package/nvim/plugins/mini.nvim/lua/mini/extra.lua +2290 -0
  121. package/nvim/plugins/mini.nvim/lua/mini/files.lua +3145 -0
  122. package/nvim/plugins/mini.nvim/lua/mini/fuzzy.lua +356 -0
  123. package/nvim/plugins/mini.nvim/lua/mini/git.lua +1737 -0
  124. package/nvim/plugins/mini.nvim/lua/mini/hipatterns.lua +1042 -0
  125. package/nvim/plugins/mini.nvim/lua/mini/hues.lua +2088 -0
  126. package/nvim/plugins/mini.nvim/lua/mini/icons.lua +2254 -0
  127. package/nvim/plugins/mini.nvim/lua/mini/indentscope.lua +1158 -0
  128. package/nvim/plugins/mini.nvim/lua/mini/init.lua +427 -0
  129. package/nvim/plugins/mini.nvim/lua/mini/input.lua +2183 -0
  130. package/nvim/plugins/mini.nvim/lua/mini/jump.lua +609 -0
  131. package/nvim/plugins/mini.nvim/lua/mini/jump2d.lua +1244 -0
  132. package/nvim/plugins/mini.nvim/lua/mini/keymap.lua +880 -0
  133. package/nvim/plugins/mini.nvim/lua/mini/map.lua +1709 -0
  134. package/nvim/plugins/mini.nvim/lua/mini/misc.lua +969 -0
  135. package/nvim/plugins/mini.nvim/lua/mini/move.lua +509 -0
  136. package/nvim/plugins/mini.nvim/lua/mini/notify.lua +938 -0
  137. package/nvim/plugins/mini.nvim/lua/mini/operators.lua +1349 -0
  138. package/nvim/plugins/mini.nvim/lua/mini/pairs.lua +657 -0
  139. package/nvim/plugins/mini.nvim/lua/mini/pick.lua +3876 -0
  140. package/nvim/plugins/mini.nvim/lua/mini/sessions.lua +689 -0
  141. package/nvim/plugins/mini.nvim/lua/mini/snippets.lua +2828 -0
  142. package/nvim/plugins/mini.nvim/lua/mini/splitjoin.lua +1132 -0
  143. package/nvim/plugins/mini.nvim/lua/mini/starter.lua +1599 -0
  144. package/nvim/plugins/mini.nvim/lua/mini/statusline.lua +686 -0
  145. package/nvim/plugins/mini.nvim/lua/mini/surround.lua +2388 -0
  146. package/nvim/plugins/mini.nvim/lua/mini/tabline.lua +564 -0
  147. package/nvim/plugins/mini.nvim/lua/mini/test.lua +2516 -0
  148. package/nvim/plugins/mini.nvim/lua/mini/trailspace.lua +215 -0
  149. package/nvim/plugins/mini.nvim/lua/mini/visits.lua +1577 -0
  150. package/nvim/plugins/mini.nvim/readmes/mini-ai.md +190 -0
  151. package/nvim/plugins/mini.nvim/readmes/mini-align.md +203 -0
  152. package/nvim/plugins/mini.nvim/readmes/mini-animate.md +214 -0
  153. package/nvim/plugins/mini.nvim/readmes/mini-base16.md +198 -0
  154. package/nvim/plugins/mini.nvim/readmes/mini-basics.md +184 -0
  155. package/nvim/plugins/mini.nvim/readmes/mini-bracketed.md +193 -0
  156. package/nvim/plugins/mini.nvim/readmes/mini-bufremove.md +139 -0
  157. package/nvim/plugins/mini.nvim/readmes/mini-clue.md +260 -0
  158. package/nvim/plugins/mini.nvim/readmes/mini-cmdline.md +183 -0
  159. package/nvim/plugins/mini.nvim/readmes/mini-colors.md +169 -0
  160. package/nvim/plugins/mini.nvim/readmes/mini-comment.md +183 -0
  161. package/nvim/plugins/mini.nvim/readmes/mini-completion.md +217 -0
  162. package/nvim/plugins/mini.nvim/readmes/mini-cursorword.md +137 -0
  163. package/nvim/plugins/mini.nvim/readmes/mini-deps.md +271 -0
  164. package/nvim/plugins/mini.nvim/readmes/mini-diff.md +289 -0
  165. package/nvim/plugins/mini.nvim/readmes/mini-doc.md +198 -0
  166. package/nvim/plugins/mini.nvim/readmes/mini-extra.md +158 -0
  167. package/nvim/plugins/mini.nvim/readmes/mini-files.md +247 -0
  168. package/nvim/plugins/mini.nvim/readmes/mini-fuzzy.md +134 -0
  169. package/nvim/plugins/mini.nvim/readmes/mini-git.md +168 -0
  170. package/nvim/plugins/mini.nvim/readmes/mini-hipatterns.md +176 -0
  171. package/nvim/plugins/mini.nvim/readmes/mini-hues.md +285 -0
  172. package/nvim/plugins/mini.nvim/readmes/mini-icons.md +183 -0
  173. package/nvim/plugins/mini.nvim/readmes/mini-indentscope.md +191 -0
  174. package/nvim/plugins/mini.nvim/readmes/mini-input.md +163 -0
  175. package/nvim/plugins/mini.nvim/readmes/mini-jump.md +161 -0
  176. package/nvim/plugins/mini.nvim/readmes/mini-jump2d.md +197 -0
  177. package/nvim/plugins/mini.nvim/readmes/mini-keymap.md +205 -0
  178. package/nvim/plugins/mini.nvim/readmes/mini-map.md +191 -0
  179. package/nvim/plugins/mini.nvim/readmes/mini-misc.md +145 -0
  180. package/nvim/plugins/mini.nvim/readmes/mini-move.md +163 -0
  181. package/nvim/plugins/mini.nvim/readmes/mini-notify.md +175 -0
  182. package/nvim/plugins/mini.nvim/readmes/mini-operators.md +193 -0
  183. package/nvim/plugins/mini.nvim/readmes/mini-pairs.md +158 -0
  184. package/nvim/plugins/mini.nvim/readmes/mini-pick.md +340 -0
  185. package/nvim/plugins/mini.nvim/readmes/mini-sessions.md +164 -0
  186. package/nvim/plugins/mini.nvim/readmes/mini-snippets.md +373 -0
  187. package/nvim/plugins/mini.nvim/readmes/mini-splitjoin.md +194 -0
  188. package/nvim/plugins/mini.nvim/readmes/mini-starter.md +176 -0
  189. package/nvim/plugins/mini.nvim/readmes/mini-statusline.md +155 -0
  190. package/nvim/plugins/mini.nvim/readmes/mini-surround.md +190 -0
  191. package/nvim/plugins/mini.nvim/readmes/mini-tabline.md +156 -0
  192. package/nvim/plugins/mini.nvim/readmes/mini-test.md +175 -0
  193. package/nvim/plugins/mini.nvim/readmes/mini-trailspace.md +137 -0
  194. package/nvim/plugins/mini.nvim/readmes/mini-visits.md +243 -0
  195. package/nvim/plugins/mini.nvim/scripts/dual_log.sh +13 -0
  196. package/nvim/plugins/mini.nvim/scripts/dual_push.sh +15 -0
  197. package/nvim/plugins/mini.nvim/scripts/dual_release.sh +102 -0
  198. package/nvim/plugins/mini.nvim/scripts/dual_sync.sh +115 -0
  199. package/nvim/plugins/mini.nvim/scripts/init-deps-example.lua +59 -0
  200. package/nvim/plugins/mini.nvim/scripts/lint-filename-length.sh +16 -0
  201. package/nvim/plugins/mini.nvim/scripts/lintcommit-ci.sh +18 -0
  202. package/nvim/plugins/mini.nvim/scripts/lintcommit.lua +393 -0
  203. package/nvim/plugins/mini.nvim/scripts/minidoc.lua +57 -0
  204. package/nvim/plugins/mini.nvim/scripts/minimal_init.lua +28 -0
  205. package/nvim/plugins/mini.nvim/scripts/minitest.lua +4 -0
  206. package/package.json +16 -0
  207. package/pyproject.toml +43 -0
  208. package/yazi/init.lua +12 -0
  209. package/yazi/keymap.toml +114 -0
  210. package/yazi/lesskey +5 -0
  211. package/yazi/plugins/bookmarks.yazi/main.lua +86 -0
  212. package/yazi/plugins/cd-git-root.yazi/main.lua +31 -0
  213. package/yazi/plugins/smart-enter.yazi/main.lua +11 -0
  214. package/yazi/theme.toml +26 -0
  215. package/yazi/yazi.toml +15 -0
  216. package/zsh/.zshrc +145 -0
  217. package/zsh/starship.toml +20 -0
  218. package/zsh/zsh-patina.toml +2 -0
@@ -0,0 +1,434 @@
1
+ *mini.doc* Generate Neovim help files
2
+
3
+ MIT License Copyright (c) 2022 Evgeni Chasnovski
4
+
5
+ ------------------------------------------------------------------------------
6
+ *MiniDoc*
7
+ Key design ideas:
8
+ - Keep documentation next to code by writing EmmyLua-like annotation
9
+ comments. They will be parsed as is, so formatting should follow built-in
10
+ guide in |help-writing|. However, custom hooks are allowed at many
11
+ generation stages for more granular management of output help file.
12
+
13
+ - Generation is done by processing a set of ordered files line by line.
14
+ Each line can either be considered as a part of documentation block (if
15
+ it matches certain configurable pattern) or not (considered to be an
16
+ "afterline" of documentation block). See |MiniDoc.generate()| for more
17
+ details.
18
+
19
+ - Processing is done by using nested data structures (section, block, file,
20
+ doc) describing certain parts of help file. See |MiniDoc-data-structures|
21
+ for more details.
22
+
23
+ - Project specific script can be written as plain Lua file with
24
+ configuratble path. See |MiniDoc.generate()| for more details.
25
+
26
+ What it doesn't do:
27
+ - It doesn't support markdown or other markup language inside annotations.
28
+ - It doesn't use treesitter in favor of Lua string manipulation for basic
29
+ tasks (parsing annotations, formatting, auto-generating tags, etc.). This
30
+ is done to manage complexity and be dependency free.
31
+
32
+ # Setup ~
33
+
34
+ This module needs a setup with `require('mini.doc').setup({})` (replace
35
+ `{}` with your `config` table). It will create global Lua table `MiniDoc`
36
+ which you can use for scripting or manually (with `:lua MiniDoc.*`).
37
+
38
+ See |MiniDoc.config| for available config settings.
39
+
40
+ You can override runtime config settings locally to buffer inside
41
+ `vim.b.minidoc_config` which should have same structure as `MiniDoc.config`.
42
+ See |mini.nvim-buffer-local-config| for more details.
43
+
44
+ To stop module from showing non-error feedback, set `config.silent = true`.
45
+
46
+ # Tips ~
47
+
48
+ - Some settings tips that might make writing annotation comments easier:
49
+ - Set up appropriate |'comments'| for `lua` file type to respect
50
+ EmmyLua-like's `---` comment leader. Value `:---,:--` seems to work.
51
+ - Set up appropriate |'formatoptions'| (see also |fo-table|). Consider
52
+ adding `j`, `n`, `q`, and `r` flags.
53
+ - Set up appropriate |'formatlistpat'| to help auto-formatting lists (if
54
+ `n` flag is added to |'formatoptions'|). One suggestion (not entirely
55
+ ideal) is a value `^\s*[0-9\-\+\*]\+[\.\)]*\s\+`. This reads as "at
56
+ least one special character (digit, `-`, `+`, `*`) possibly followed
57
+ by some punctuation (`.` or `)`) followed by at least one space is a
58
+ start of list item".
59
+ - Probably one of the most reliable resources for what is considered to be
60
+ best practice when using this module is this whole plugin. Look at source
61
+ code for the reference.
62
+
63
+ # Comparisons ~
64
+
65
+ - [tjdevries/tree-sitter-lua](https://github.com/tjdevries/tree-sitter-lua):
66
+ - Its key design is to use treesitter grammar to parse both Lua code
67
+ and annotation comments. This makes it not easy to install,
68
+ customize, and support.
69
+ - It takes more care about automating output formatting (like auto
70
+ indentation and line width fit). This plugin leans more to manual
71
+ formatting with option to supply customized post-processing hooks.
72
+
73
+ ------------------------------------------------------------------------------
74
+ *MiniDoc-data-structures*
75
+ Data structures
76
+
77
+ Data structures are basically arrays of other structures accompanied with
78
+ some fields (keys with data values) and methods (keys with function
79
+ values):
80
+ - `Section structure` is an array of string lines describing one aspect
81
+ (determined by section id like `@param`, `@return`, `@text`) of an
82
+ annotation subject. All lines will be used directly in help file.
83
+ - `Block structure` is an array of sections describing one annotation
84
+ subject like function, table, concept.
85
+ - `File structure` is an array of blocks describing certain file on disk.
86
+ Basically, file is split into consecutive blocks: annotation lines go
87
+ inside block, non-annotation - inside `block_afterlines` element of info.
88
+ - `Doc structure` is an array of files describing a final help file. Each
89
+ string line from section (when traversed in depth-first fashion) goes
90
+ directly into output file.
91
+
92
+ All structures have these keys:
93
+ - Fields:
94
+ - `info` - contains additional information about current structure.
95
+ For more details see next section.
96
+ - `parent` - table of parent structure (if exists).
97
+ - `parent_index` - index of this structure in its parent's array. Useful
98
+ for adding to parent another structure near current one.
99
+ - `type` - string with structure type (section, block, file, doc).
100
+ - Methods (use them as `x:method(args)`):
101
+ - `insert(self, [index,] child)` - insert `child` to `self` at position
102
+ `index` (optional; if not supplied, child will be appended to end).
103
+ Basically, a `table.insert()`, but adds `parent` and `parent_index`
104
+ fields to `child` while properly updating `self`.
105
+ - `remove(self [,index])` - remove from `self` element at position
106
+ `index`. Basically, a `table.remove()`, but properly updates `self`.
107
+ - `has_descendant(self, predicate)` - whether there is a descendant
108
+ (structure or string) for which `predicate` returns `true`. In case of
109
+ success also returns the first such descendant as second value.
110
+ - `has_lines(self)` - whether structure has any lines (even empty ones)
111
+ to be put in output file. For section structures this is equivalent to
112
+ `#self`, but more useful for higher order structures.
113
+ - `clear_lines(self)` - remove all lines from structure. As a result,
114
+ this structure won't contribute to output help file.
115
+
116
+ Description of `info` fields per structure type:
117
+ - `Section`:
118
+ - `id` - captured section identifier. Can be empty string meaning no
119
+ identifier is captured.
120
+ - `line_begin` - line number inside file at which section begins (-1 if
121
+ not generated from file).
122
+ - `line_end` - line number inside file at which section ends (-1 if not
123
+ generated from file).
124
+ - `Block`:
125
+ - `afterlines` - array of strings which were parsed from file after
126
+ this annotation block (up until the next block or end of file).
127
+ Useful for making automated decisions about what is being documented.
128
+ - `line_begin` - line number inside file at which block begins (-1 if
129
+ not generated from file).
130
+ - `line_end` - line number inside file at which block ends (-1 if not
131
+ generated from file).
132
+ - `File`:
133
+ - `path` - absolute path to a file (`''` if not generated from file).
134
+ - `Doc`:
135
+ - `input` - array of input file paths (as in |MiniDoc.generate()|).
136
+ - `output` - output path (as in |MiniDoc.generate()|).
137
+ - `config` - configuration used (as in |MiniDoc.generate()|).
138
+
139
+ ------------------------------------------------------------------------------
140
+ *MiniDoc.setup()*
141
+ `MiniDoc.setup`({config})
142
+ Module setup
143
+
144
+ Parameters ~
145
+ {config} `(table|nil)` Module config table. See |MiniDoc.config|.
146
+
147
+ Usage ~
148
+ >lua
149
+ require('mini.doc').setup() -- use default config
150
+ -- OR
151
+ require('mini.doc').setup({}) -- replace {} with your config table
152
+ <
153
+ ------------------------------------------------------------------------------
154
+ *MiniDoc.config*
155
+ `MiniDoc.config`
156
+ Defaults ~
157
+ >lua
158
+ MiniDoc.config = {
159
+ -- Function which extracts part of line used to denote annotation.
160
+ -- For more information see 'Notes' in |MiniDoc.config|.
161
+ annotation_extractor = function(l) return string.find(l, '^%-%-%-(%S*) ?') end,
162
+
163
+ -- Identifier of block annotation lines until first captured identifier
164
+ default_section_id = '@text',
165
+
166
+ -- Hooks to be applied at certain stage of document life cycle. Should
167
+ -- modify its input in place (and not return new one).
168
+ hooks = {
169
+ -- Applied to block before anything else
170
+ block_pre = --<function: infers header sections (tag and/or signature)>,
171
+
172
+ -- Applied to section before anything else
173
+ section_pre = --<function: replaces current aliases>,
174
+
175
+ -- Applied if section has specified captured id
176
+ sections = {
177
+ ['@alias'] = --<function: registers alias in MiniDoc.current.aliases>,
178
+ ['@class'] = --<function>,
179
+ ['@diagnostic'] = --<function: ignores any section content>,
180
+ -- For most typical usage see |MiniDoc.afterlines_to_code|
181
+ ['@eval'] = --<function: evaluates lines; replaces with their return>,
182
+ ['@field'] = --<function>,
183
+ ['@overload'] = --<function>,
184
+ ['@param'] = --<function>,
185
+ ['@private'] = --<function: registers block for removal>,
186
+ ['@return'] = --<function>,
187
+ ['@seealso'] = --<function>,
188
+ ['@signature'] = --<function: formats signature of documented object>,
189
+ ['@tag'] = --<function: turns its line in proper tag lines>,
190
+ ['@text'] = --<function: purposefully does nothing>,
191
+ ['@toc'] = --<function: clears all section lines>,
192
+ ['@toc_entry'] = --<function: registers lines for table of contents>,
193
+ ['@type'] = --<function>,
194
+ ['@usage'] = --<function>,
195
+ },
196
+
197
+ -- Applied to section after all previous steps
198
+ section_post = --<function: currently does nothing>,
199
+
200
+ -- Applied to block after all previous steps
201
+ block_post = --<function: does many things>,
202
+
203
+ -- Applied to file after all previous steps
204
+ file = --<function: adds separator>,
205
+
206
+ -- Applied to doc after all previous steps
207
+ doc = --<function: adds modeline>,
208
+
209
+ -- Applied before output file is written. Takes lines array as argument.
210
+ write_pre = --<function: removes delimiters at the top>,
211
+
212
+ -- Applied after output help file is written. Takes doc as argument.
213
+ write_post = --<function: various convenience actions>,
214
+ },
215
+
216
+ -- Path (relative to current directory) to script which handles project
217
+ -- specific help file generation (like custom input files, hooks, etc.).
218
+ script_path = 'scripts/minidoc.lua',
219
+
220
+ -- Whether to disable showing non-error feedback
221
+ silent = false,
222
+ }
223
+ <
224
+ # Notes ~
225
+
226
+ - `annotation_extractor` takes single string line as input. Output
227
+ describes what makes an input to be an annotation (if anything). It
228
+ should be similar to `string.find` with one capture group: start and end
229
+ of annotation indicator (whole part will be removed from help line) with
230
+ third value being string of section id (if input describes first line of
231
+ section; `nil` or empty string otherwise). Output should be `nil` if line
232
+ is not part of annotation.
233
+ Default value means that annotation line should:
234
+ - Start with `---` at first column.
235
+ - Any non-whitespace after `---` will be treated as new section id.
236
+ - Single whitespace at the start of main text will be ignored.
237
+ - Hooks are expected to be functions. Their default values might do many
238
+ things which might change over time, so for more information please look
239
+ at source code. Some more information can be found in
240
+ |MiniDoc.default_hooks|.
241
+
242
+ ------------------------------------------------------------------------------
243
+ *MiniDoc.current*
244
+ `MiniDoc.current`
245
+ Table with information about current state of auto-generation
246
+
247
+ It is reset at the beginning and end of `MiniDoc.generate()`.
248
+
249
+ At least these keys are supported:
250
+ - {aliases} - table with keys being alias name and values - alias
251
+ description and single string (using `\n` to separate lines).
252
+ - {eval_section} - input section of `@eval` section hook. Can be used for
253
+ information about current block, etc.
254
+ - {toc} - array with table of contents entries. Each entry is a whole
255
+ `@toc_entry` section.
256
+
257
+ ------------------------------------------------------------------------------
258
+ *MiniDoc.default_hooks*
259
+ `MiniDoc.default_hooks`
260
+ Default hooks
261
+
262
+ This is default value of `MiniDoc.config.hooks`. Use it if only a little
263
+ tweak is needed.
264
+
265
+ Some more insight about their behavior:
266
+ - Default inference of documented object metadata (tag and object signature
267
+ at the moment) is done in `block_pre`. Inference is based on string
268
+ pattern matching, so can lead to false results, although works in most
269
+ cases. It intentionally works only if first line after block has no
270
+ indentation and contains all necessary information to determine if
271
+ inference should happen.
272
+ - Hooks for sections describing some "variable-like" object (`@class`,
273
+ `@field`, `@param`) automatically enclose first word in `{}`.
274
+ - Hooks for sections which supposed to have "type-like" data (`@field`,
275
+ `@param`, `@return`, `@type`) automatically enclose FIRST FOUND type-like
276
+ word and its neighbor characters in `(<type>)` (expect false positives).
277
+ Algorithm is far from being 100% correct, but seems to work with present
278
+ allowed type annotation. For allowed types see
279
+ https://github.com/sumneko/lua-language-server/wiki/EmmyLua-Annotations#types-and-type
280
+ or, better yet, look in source code of this module.
281
+ - Automated creation of table of contents (TOC) is done in the following way:
282
+ - Put section with `@toc_entry` id in the annotation block. Section's
283
+ lines will be registered as TOC entry.
284
+ - Put `@toc` section where you want to insert rendered table of
285
+ contents. TOC entries will be inserted on the left, references for
286
+ their respective tag section (only first, if present) on the right.
287
+ Render is done in default `doc` hook (because it should be done after
288
+ processing all files).
289
+ - The `write_post` hook executes some actions convenient for iterative
290
+ annotations writing:
291
+ - Generate `:helptags` for directory containing output file.
292
+ - Silently reload buffer containing output file (if such exists).
293
+ - Display notification message about result.
294
+
295
+ ------------------------------------------------------------------------------
296
+ *MiniDoc.generate()*
297
+ `MiniDoc.generate`({input}, {output}, {config})
298
+ Generate help file
299
+
300
+ # Algorithm ~
301
+
302
+ - Main parameters for help generation are an array of input file paths and
303
+ path to output help file.
304
+ - Parse all inputs:
305
+ - For each file, lines are processed top to bottom in order to create an
306
+ array of documentation blocks. Each line is tested whether it is an
307
+ annotation by applying `MiniDoc.config.annotation_extractor`: if
308
+ anything is extracted, it is considered to be an annotation. Annotation
309
+ line goes to "current block" after removing extracted annotation
310
+ indicator, otherwise - to afterlines of "current block".
311
+ - Each block's annotation lines are processed top to bottom. If line had
312
+ captured section id, it is a first line of "current section" (first
313
+ block lines are allowed to not specify section id; by default it is
314
+ `@text`). All subsequent lines without captured section id go into
315
+ "current section".
316
+ - Apply structure hooks (they should modify its input in place, which is
317
+ possible due to "table nature" of all inputs):
318
+ - Each block is processed by `MiniDoc.config.hooks.block_pre`. This is a
319
+ designated step for auto-generation of sections from described
320
+ annotation subject (like sections with id `@tag`, `@type`).
321
+ - Each section is processed by `MiniDoc.config.hooks.section_pre`.
322
+ - Each section is processed by corresponding
323
+ `MiniDoc.config.hooks.sections` function (table key equals to section
324
+ id). This is a step where most of formatting should happen (like
325
+ wrap first word of `@param` section with `{` and `}`, append empty
326
+ line to section, etc.).
327
+ - Each section is processed by `MiniDoc.config.hooks.section_post`.
328
+ - Each block is processed by `MiniDoc.config.hooks.block_post`. This is
329
+ a step for processing block after formatting is done (like add first
330
+ line with `----` delimiter).
331
+ - Each file is processed by `MiniDoc.config.hooks.file`. This is a step
332
+ for adding any file-related data (like add first line with `====`
333
+ delimiter).
334
+ - Doc is processed by `MiniDoc.config.hooks.doc`. This is a step for
335
+ adding any helpfile-related data (maybe like table of contents).
336
+ - Collect all strings from sections in depth-first fashion (equivalent to
337
+ nested "for all files -> for all blocks -> for all sections -> for all
338
+ strings -> add string to output"). Strings can have `\n` character
339
+ indicating start of new line.
340
+ - Modify collected strings with `MiniDoc.config.write_pre`. Takes strings
341
+ from previous step as input and should return array of strings.
342
+ - Write modified strings to output file.
343
+ - Execute `MiniDoc.config.write_post` hook. This is useful for showing some
344
+ feedback and making actions involving newly updated help file (like
345
+ generate tags, etc.).
346
+
347
+ # Project specific script ~
348
+
349
+ If all arguments have default `nil` values, first there is an attempt to
350
+ source project specific script. This is basically a
351
+ `luafile <MiniDoc.config.script_path>` with current Lua runtime while caching
352
+ and restoring current `MiniDoc.config`. Its successful execution stops any
353
+ further generation actions while error means proceeding generation as if no
354
+ script was found.
355
+
356
+ Typical script content might include definition of custom hooks, input and
357
+ output files with eventual call to `require('mini.doc').generate()` (with
358
+ or without arguments).
359
+
360
+ Parameters ~
361
+ {input} `(table|nil)` Array of file paths which will be processed in supplied
362
+ order. Default: all `.lua` files from current directory following by all
363
+ such files in these subdirectories: `lua/`, `after/`, `colors/`. Note:
364
+ any `init.lua` file is placed before other files from the same directory.
365
+ {output} `(string|nil)` Path for output help file. Default:
366
+ `doc/<current-directory>.txt` (designed to be used for generating help
367
+ file for plugin).
368
+ {config} `(table|nil)` Configuration overriding parts of |MiniDoc.config|.
369
+
370
+ Return ~
371
+ `(table)` Document structure which was generated and used for output
372
+ help file. In case `MiniDoc.config.script_path` was successfully used,
373
+ this is a return from the latest call of this function.
374
+
375
+ ------------------------------------------------------------------------------
376
+ *MiniDoc.afterlines_to_code()*
377
+ `MiniDoc.afterlines_to_code`({struct})
378
+ Convert afterlines to code
379
+
380
+ This function is designed to be used together with `@eval` section to
381
+ automate documentation of certain values (notably default values of a
382
+ table). It processes afterlines based on certain directives and makes
383
+ output look like a Lua code block.
384
+
385
+ Most common usage is by adding the following section in your annotation: >
386
+
387
+ ---@eval return MiniDoc.afterlines_to_code(MiniDoc.current.eval_section)
388
+ <
389
+ # Directives ~
390
+
391
+ Directives are special comments that are processed using Lua string pattern
392
+ capabilities (so beware of false positives). Each directive should be put
393
+ on its separate line. Supported directives:
394
+ - `--minidoc_afterlines_end` denotes a line at afterlines end. Only all
395
+ lines before it will be considered as afterlines. Useful if there is
396
+ extra code in afterlines which shouldn't be used.
397
+ - `--minidoc_replace_start <replacement>` and `--minidoc_replace_end`
398
+ denote lines between them which should be replaced with `<replacement>`.
399
+ Useful for manually changing what should be placed in output like in case
400
+ of replacing function body with something else.
401
+
402
+ Here is an example. Suppose having these afterlines: >lua
403
+
404
+ --minidoc_replace_start {
405
+ M.config = {
406
+ --minidoc_replace_end
407
+ param_one = 1,
408
+ --minidoc_replace_start param_fun = --<function>
409
+ param_fun = function(x)
410
+ return x + 1
411
+ end
412
+ --minidoc_replace_end
413
+ }
414
+ --minidoc_afterlines_end
415
+
416
+ return M
417
+ <
418
+ After adding `@eval` section those will be formatted as: >
419
+
420
+ {
421
+ param_one = 1,
422
+ param_fun = --<function>
423
+ }
424
+ <
425
+ Parameters ~
426
+ {struct} `(table)` Block or section structure which after lines will be
427
+ converted to code.
428
+
429
+ Return ~
430
+ `(string|nil)` Single string (using `\n` to separate lines) describing
431
+ afterlines as Lua code block in help file. If `nil`, input is not valid.
432
+
433
+
434
+ vim:tw=78:ts=8:noet:ft=help:norl: