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,536 @@
1
+ *mini.splitjoin* Split and join arguments
2
+
3
+ MIT License Copyright (c) 2023 Evgeni Chasnovski
4
+
5
+ ------------------------------------------------------------------------------
6
+ *MiniSplitjoin*
7
+ Features:
8
+ - Mappings and Lua functions that modify arguments (regions inside brackets
9
+ between allowed separators) under cursor.
10
+
11
+ Supported actions:
12
+ - Toggle - split if arguments are on single line, join otherwise.
13
+ Main supported function of the module. See |MiniSplitjoin.toggle()|.
14
+ - Split - make every argument separator be on end of separate line.
15
+ See |MiniSplitjoin.split()|.
16
+ - Join - make all arguments be on single line.
17
+ See |MiniSplitjoin.join()|.
18
+
19
+ - Mappings are dot-repeatable in Normal mode and work in Visual mode.
20
+
21
+ - Customizable argument detection (see |MiniSplitjoin.config.detect|):
22
+ - Which brackets can contain arguments.
23
+ - Which strings can separate arguments.
24
+ - Which regions are excluded when looking for separators (like inside
25
+ nested brackets or quotes).
26
+
27
+ - Customizable pre and post hooks for both split and join. See `split` and
28
+ `join` in |MiniSplitjoin.config|. There are several built-in ones
29
+ in |MiniSplitjoin.gen_hook|.
30
+
31
+ - Works inside comments by using modified notion of indent.
32
+ See |MiniSplitjoin.get_indent_part()|.
33
+
34
+ - Provides low-level Lua functions for split and join at positions.
35
+ See |MiniSplitjoin.split_at()| and |MiniSplitjoin.join_at()|.
36
+
37
+ Notes:
38
+ - Search for arguments is done using Lua patterns (regex-like approach).
39
+ Certain amount of false positives is to be expected.
40
+
41
+ - This module is mostly designed around |MiniSplitjoin.toggle()|. If target
42
+ split positions are on different lines, join first and then split.
43
+
44
+ - Actions can be done on Visual mode selection, which mostly present as
45
+ a safety route in case of incorrect detection of initial region.
46
+ It uses |MiniSplitjoin.get_visual_region()| which treats selection as full
47
+ brackets (include brackets in selection).
48
+
49
+ # Setup ~
50
+
51
+ This module needs a setup with `require('mini.splitjoin').setup({})` (replace
52
+ `{}` with your `config` table). It will create global Lua table `MiniSplitjoin`
53
+ which you can use for scripting or manually (with `:lua MiniSplitjoin.*`).
54
+
55
+ See |MiniSplitjoin.config| for available config settings.
56
+
57
+ You can override runtime config settings (like action hooks) locally to
58
+ buffer inside `vim.b.minisplitjoin_config` which should have same structure
59
+ as `MiniSplitjoin.config`. See |mini.nvim-buffer-local-config| for more details.
60
+
61
+ # Comparisons ~
62
+
63
+ - [FooSoft/vim-argwrap](https://github.com/FooSoft/vim-argwrap):
64
+ - Mostly has the same design as this module.
65
+ - Doesn't work inside comments, while this module does.
66
+ - Has more built-in ways to control split and join, while this module
67
+ intentionally provides only handful.
68
+ - [AndrewRadev/splitjoin.vim](https://github.com/AndrewRadev/splitjoin.vim):
69
+ - More oriented towards language-depended transformations, while this
70
+ module intntionally deals with more generic text-related functionality.
71
+ - [Wansmer/treesj](https://github.com/Wansmer/treesj):
72
+ - Operates based on tree-sitter nodes. This is more accurate in
73
+ some edge cases, but REQUIRES tree-sitter parser.
74
+ - Doesn't work inside comments or strings.
75
+
76
+ # Disabling ~
77
+
78
+ To disable, set `g:minisplitjoin_disable` (globally) or `b:minisplitjoin_disable`
79
+ (for a buffer) to `v:true`. Considering high number of different scenarios
80
+ and customization intentions, writing exact rules for disabling module's
81
+ functionality is left to user. See |mini.nvim-disabling-recipes| for common
82
+ recipes.
83
+
84
+ ------------------------------------------------------------------------------
85
+ *MiniSplitjoin-glossary*
86
+ POSITION ~
87
+ Table with fields <line> and <col> containing line and column numbers
88
+ respectively. Both are 1-indexed. Example: `{ line = 2, col = 1 }`.
89
+
90
+ REGION ~
91
+ Table representing region in a buffer. Fields: <from> and <to> for
92
+ inclusive start and end positions. Example: >lua
93
+
94
+ { from = { line = 1, col = 1 }, to = { line = 2, col = 1 } }
95
+ <
96
+ ------------------------------------------------------------------------------
97
+ *MiniSplitjoin.setup()*
98
+ `MiniSplitjoin.setup`({config})
99
+ Module setup
100
+
101
+ Parameters ~
102
+ {config} `(table|nil)` Module config table. See |MiniSplitjoin.config|.
103
+
104
+ Usage ~
105
+ >lua
106
+ require('mini.splitjoin').setup() -- use default config
107
+ -- OR
108
+ require('mini.splitjoin').setup({}) -- replace {} with your config table
109
+ <
110
+ ------------------------------------------------------------------------------
111
+ *MiniSplitjoin.config*
112
+ `MiniSplitjoin.config`
113
+ Defaults ~
114
+ >lua
115
+ MiniSplitjoin.config = {
116
+ -- Module mappings. Use `''` (empty string) to disable one.
117
+ -- Created for both Normal and Visual modes.
118
+ mappings = {
119
+ toggle = 'gS',
120
+ split = '',
121
+ join = '',
122
+ },
123
+
124
+ -- Detection options: where split/join should be done
125
+ detect = {
126
+ -- Array of Lua patterns to detect region with arguments.
127
+ -- Default: { '%b()', '%b[]', '%b{}' }
128
+ brackets = nil,
129
+
130
+ -- String Lua pattern defining argument separator
131
+ separator = ',',
132
+
133
+ -- Array of Lua patterns for sub-regions to exclude separators from.
134
+ -- Enables correct detection in presence of nested brackets and quotes.
135
+ -- Default: { '%b()', '%b[]', '%b{}', '%b""', "%b''" }
136
+ exclude_regions = nil,
137
+ },
138
+
139
+ -- Split options
140
+ split = {
141
+ hooks_pre = {},
142
+ hooks_post = {},
143
+ },
144
+
145
+ -- Join options
146
+ join = {
147
+ hooks_pre = {},
148
+ hooks_post = {},
149
+ },
150
+ }
151
+ <
152
+ # Detection ~
153
+ *MiniSplitjoin.config.detect*
154
+
155
+ The table at `config.detect` controls how arguments are detected using Lua
156
+ patterns. General idea is to convert whole buffer into a single line,
157
+ perform string search, and convert results back into 2d positions.
158
+
159
+ Example configuration: >lua
160
+
161
+ require('mini.splitjoin').setup({
162
+ detect = {
163
+ -- Detect only inside balanced parenthesis
164
+ brackets = { '%b()' },
165
+
166
+ -- Allow both `,` and `;` to separate arguments
167
+ separator = '[,;]',
168
+
169
+ -- Make any separator define an argument
170
+ exclude_regions = {},
171
+ },
172
+ })
173
+ <
174
+ ## Outer brackets ~
175
+
176
+ `detect.brackets` is an array of Lua patterns used to find enclosing region.
177
+ It is done by traversing whole buffer to find the smallest region matching
178
+ any supplied pattern.
179
+
180
+ Default: `nil`, inferred as `{ '%b()', '%b[]', '%b{}' }`.
181
+ So an argument can be inside a balanced `()`, `[]`, or `{}`.
182
+
183
+ Example: `brackets = { '%b()' }` will search for arguments only inside
184
+ balanced `()`.
185
+
186
+ ## Separator ~
187
+
188
+ `detect.separator` is a single Lua pattern defining which strings should be
189
+ treated as argument separators.
190
+
191
+ Empty string in `detect.separator` will result in only surrounding brackets
192
+ used as separators.
193
+
194
+ Only end of pattern match will be used as split/join positions.
195
+
196
+ Default: `','`. So an argument can be separated only with comma.
197
+
198
+ Example: `separator = { '[,;]' }` will treat both `,` and `;` as separators.
199
+
200
+ ## Excluded regions ~
201
+
202
+ `detect.exclude_regions` is an array of Lua patterns for sub-regions from which
203
+ to exclude separators. Enables correct detection in case of nested brackets
204
+ and quotes.
205
+
206
+ Default: `nil`; inferred as `{ '%b()', '%b[]', '%b{}', '%b""', "%b''" }`.
207
+ So a separator CAN NOT be inside a balanced `()`, `[]`, `{}` (representing
208
+ nested argument regions) or `""`, `''` (representing strings).
209
+
210
+ Example: `exclude_regions = {}` will not exclude any regions. So in case of
211
+ `f(a, { b, c })` it will detect both commas as argument separators.
212
+
213
+ # Hooks ~
214
+
215
+ `split.hooks_pre`, `split.hooks_post`, `join.hooks_pre`, and `join.hooks_post`
216
+ are arrays of hook functions. If empty (default) no hook is applied.
217
+
218
+ Hooks should take and return array of positions. See |MiniSplitjoin-glossary|.
219
+
220
+ They can be used to tweak actions:
221
+
222
+ - Pre-hooks are called before action. Each is applied on the output of
223
+ previous one. Input of first hook are detected split/join positions.
224
+ Output of last one is actually used to perform split/join.
225
+
226
+ - Post-hooks are called after action. Each is applied on the output of
227
+ previous one. Input of first hook are split/join positions from actual
228
+ action plus its region's right end as last position (for easier hook code).
229
+ Output of last one is used as action return value.
230
+
231
+ For more specific details see |MiniSplitjoin.split()| and |MiniSplitjoin.join()|.
232
+
233
+ See |MiniSplitjoin.gen_hook| for generating common hooks with examples.
234
+
235
+ ------------------------------------------------------------------------------
236
+ *MiniSplitjoin.toggle()*
237
+ `MiniSplitjoin.toggle`({opts})
238
+ Toggle arguments
239
+
240
+ Overview:
241
+ - Detect region at input position: either by using supplied `opts.region` or
242
+ by finding smallest bracketed region surrounding position.
243
+ See |MiniSplitjoin.config.detect| for more details.
244
+ - If region spans single line, use |MiniSplitjoin.split()| with found region.
245
+ Otherwise use |MiniSplitjoin.join()|.
246
+
247
+ Parameters ~
248
+ {opts} `(table|nil)` Options. Has structure from |MiniSplitjoin.config|
249
+ inheriting its default values.
250
+
251
+ Following extra optional fields are allowed:
252
+ - <position> `(table)` - position at which to find smallest bracket region.
253
+ See |MiniSplitjoin-glossary| for the structure.
254
+ Default: cursor position.
255
+ - <region> `(table)` - region at which to perform action. Assumes inclusive
256
+ both start at left bracket and end at right bracket.
257
+ See |MiniSplitjoin-glossary| for the structure.
258
+ Default: `nil` to automatically detect region.
259
+
260
+ Return ~
261
+ `(any)` Output of chosen `split()` or `join()` action.
262
+
263
+ ------------------------------------------------------------------------------
264
+ *MiniSplitjoin.split()*
265
+ `MiniSplitjoin.split`({opts})
266
+ Split arguments
267
+
268
+ Overview:
269
+ - Detect region: either by using supplied `opts.region` or by finding smallest
270
+ bracketed region surrounding input position (cursor position by default).
271
+ See |MiniSplitjoin.config.detect| for more details.
272
+
273
+ - Find separator positions using `separator` and `exclude_regions` from `opts`.
274
+ Both brackets are treated as separators.
275
+ See |MiniSplitjoin.config.detect| for more details.
276
+ Note: stop if no separator positions are found.
277
+
278
+ - Modify separator positions to represent split positions. Last split position
279
+ (which is inferred from right bracket) is moved one column to left so that
280
+ right bracket would move on new line.
281
+
282
+ - Apply all hooks from `opts.split.hooks_pre`. Each is applied on the output of
283
+ previous one. Input of first hook is split positions from previous step.
284
+ Output of last one is used as split positions in next step.
285
+
286
+ - Split and update split positions with |MiniSplitjoin.split_at()|.
287
+
288
+ - Apply all hooks from `opts.split.hooks_post`. Each is applied on the output of
289
+ previous one. Input of first hook is split positions from previous step plus
290
+ region's right end (for easier hook code).
291
+ Output of last one is used as function return value.
292
+
293
+ Note:
294
+ - By design, it doesn't detect if argument SHOULD be split, so application
295
+ on arguments spanning multiple lines can lead to undesirable result.
296
+
297
+ Parameters ~
298
+ {opts} `(table|nil)` Options. Has structure from |MiniSplitjoin.config|
299
+ inheriting its default values.
300
+
301
+ Following extra optional fields are allowed:
302
+ - <position> `(table)` - position at which to find smallest bracket region.
303
+ See |MiniSplitjoin-glossary| for the structure.
304
+ Default: cursor position.
305
+ - <region> `(table)` - region at which to perform action. Assumes inclusive
306
+ both start at left bracket and end at right bracket.
307
+ See |MiniSplitjoin-glossary| for the structure.
308
+ Default: `nil` to automatically detect region.
309
+
310
+ Return ~
311
+ `(any)` Output of last `opts.split.hooks_post` or `nil` if no split positions
312
+ found. Default: return value of |MiniSplitjoin.split_at()| application.
313
+
314
+ ------------------------------------------------------------------------------
315
+ *MiniSplitjoin.join()*
316
+ `MiniSplitjoin.join`({opts})
317
+ Join arguments
318
+
319
+ Overview:
320
+ - Detect region: either by using supplied `opts.region` or by finding smallest
321
+ bracketed region surrounding input position (cursor position by default).
322
+ See |MiniSplitjoin.config.detect| for more details.
323
+
324
+ - Compute join positions to be line ends of all but last region lines.
325
+ Note: stop if no join positions are found.
326
+
327
+ - Apply all hooks from `opts.join.hooks_pre`. Each is applied on the output
328
+ of previous one. Input of first hook is join positions from previous step.
329
+ Output of last one is used as join positions in next step.
330
+
331
+ - Join and update join positions with |MiniSplitjoin.join_at()|.
332
+
333
+ - Apply all hooks from `opts.join.hooks_post`. Each is applied on the output
334
+ of previous one. Input of first hook is join positions from previous step
335
+ plus region's right end for easier hook code.
336
+ Output of last one is used as function return value.
337
+
338
+ Parameters ~
339
+ {opts} `(table|nil)` Options. Has structure from |MiniSplitjoin.config|
340
+ inheriting its default values.
341
+
342
+ Following extra optional fields are allowed:
343
+ - <position> `(table)` - position at which to find smallest bracket region.
344
+ See |MiniSplitjoin-glossary| for the structure.
345
+ Default: cursor position.
346
+ - <region> `(table)` - region at which to perform action. Assumes inclusive
347
+ both start at left bracket and end at right bracket.
348
+ See |MiniSplitjoin-glossary| for the structure.
349
+ Default: `nil` to automatically detect region.
350
+
351
+ Return ~
352
+ `(any)` Output of last `opts.split.hooks_post` or `nil` of no join positions
353
+ found. Default: return value of |MiniSplitjoin.join_at()| application.
354
+
355
+ ------------------------------------------------------------------------------
356
+ *MiniSplitjoin.gen_hook*
357
+ `MiniSplitjoin.gen_hook`
358
+ Generate common hooks
359
+
360
+ This is a table with function elements. Call to actually get hook.
361
+
362
+ All generated post-hooks return updated versions of their input reflecting
363
+ changes done inside hook.
364
+
365
+ Example for `lua` filetype (place it in `lua.lua` filetype plugin, |ftplugin|): >lua
366
+
367
+ local gen_hook = MiniSplitjoin.gen_hook
368
+ local curly = { brackets = { '%b{}' } }
369
+
370
+ -- Add trailing comma when splitting inside curly brackets
371
+ local add_comma_curly = gen_hook.add_trailing_separator(curly)
372
+
373
+ -- Delete trailing comma when joining inside curly brackets
374
+ local del_comma_curly = gen_hook.del_trailing_separator(curly)
375
+
376
+ -- Pad curly brackets with single space after join
377
+ local pad_curly = gen_hook.pad_brackets(curly)
378
+
379
+ -- Create buffer-local config
380
+ vim.b.minisplitjoin_config = {
381
+ split = { hooks_post = { add_comma_curly } },
382
+ join = { hooks_post = { del_comma_curly, pad_curly } },
383
+ }
384
+ <
385
+ ------------------------------------------------------------------------------
386
+ *MiniSplitjoin.gen_hook.pad_brackets()*
387
+ `MiniSplitjoin.gen_hook.pad_brackets`({opts})
388
+ Generate hook to pad brackets
389
+
390
+ This is a join post-hook. Use in `join.hooks_post` of |MiniSplitjoin.config|.
391
+
392
+ Parameters ~
393
+ {opts} `(table|nil)` Options. Possible fields:
394
+ - <pad> `(string)` - pad to add after first and before last join positions.
395
+ Default: `' '` (single space).
396
+ - <brackets> `(table)` - array of bracket patterns indicating on which
397
+ brackets action should be made. Has same structure as `brackets`
398
+ in |MiniSplitjoin.config.detect|.
399
+ Default: `MiniSplitjoin.config.detect.brackets`.
400
+
401
+ Return ~
402
+ `(function)` A hook which adds inner pad to first and last join positions and
403
+ returns updated input join positions.
404
+
405
+ ------------------------------------------------------------------------------
406
+ *MiniSplitjoin.gen_hook.add_trailing_separator()*
407
+ `MiniSplitjoin.gen_hook.add_trailing_separator`({opts})
408
+ Generate hook to add trailing separator
409
+
410
+ This is a split post-hook. Use in `split.hooks_post` of |MiniSplitjoin.config|.
411
+
412
+ Parameters ~
413
+ {opts} `(table|nil)` Options. Possible fields:
414
+ - <sep> `(string)` - separator to add before last split position.
415
+ Default: `','`.
416
+ - <brackets> `(table)` - array of bracket patterns indicating on which
417
+ brackets action should be made. Has same structure as `brackets`
418
+ in |MiniSplitjoin.config.detect|.
419
+ Default: `MiniSplitjoin.config.detect.brackets`.
420
+
421
+ Return ~
422
+ `(function)` A hook which adds separator before last split position and
423
+ returns updated input split positions.
424
+
425
+ ------------------------------------------------------------------------------
426
+ *MiniSplitjoin.gen_hook.del_trailing_separator()*
427
+ `MiniSplitjoin.gen_hook.del_trailing_separator`({opts})
428
+ Generate hook to delete trailing separator
429
+
430
+ This is a join post-hook. Use in `join.hooks_post` of |MiniSplitjoin.config|.
431
+
432
+ Parameters ~
433
+ {opts} `(table|nil)` Options. Possible fields:
434
+ - <sep> `(string)` - separator to remove before last join position.
435
+ Default: `','`.
436
+ - <brackets> `(table)` - array of bracket patterns indicating on which
437
+ brackets action should be made. Has same structure as `brackets`
438
+ in |MiniSplitjoin.config.detect|.
439
+ Default: `MiniSplitjoin.config.detect.brackets`.
440
+
441
+ Return ~
442
+ `(function)` A hook which adds separator before last split position and
443
+ returns updated input split positions.
444
+
445
+ ------------------------------------------------------------------------------
446
+ *MiniSplitjoin.split_at()*
447
+ `MiniSplitjoin.split_at`({positions})
448
+ Split at positions
449
+
450
+ Overview:
451
+ - For each position move all characters after it to next line and make it have
452
+ same indent as current one (see |MiniSplitjoin.get_indent_part()|).
453
+ Also remove trailing whitespace at position line.
454
+
455
+ - Increase indent of inner lines by a single pad: tab in case of |'noexpandtab'|
456
+ or |shiftwidth()| number of spaces otherwise.
457
+
458
+ Notes:
459
+ - Cursor is adjusted to follow text updates.
460
+ - Use output of this function to keep track of input positions.
461
+
462
+ Parameters ~
463
+ {positions} `(table)` Array of positions at which to perform split.
464
+ See |MiniSplitjoin-glossary| for their structure. Note: they don't have
465
+ to be ordered, but first and last ones will be used to infer lines for
466
+ which indent will be increased.
467
+
468
+ Return ~
469
+ `(table)` Array of new positions to where input `positions` were moved.
470
+
471
+ ------------------------------------------------------------------------------
472
+ *MiniSplitjoin.join_at()*
473
+ `MiniSplitjoin.join_at`({positions})
474
+ Join at positions
475
+
476
+ Overview:
477
+ - For each position join its line with the next line. Joining is done by
478
+ replacing trailing whitespace of the line and indent of its next line
479
+ (see |MiniSplitjoin.get_indent_part()|) with a pad string (single space except
480
+ empty string for first and last positions). To adjust this, use hooks
481
+ (for example, see |MiniSplitjoin.gen_hook.pad_brackets()|).
482
+
483
+ Notes:
484
+ - Cursor is adjusted to follow text updates.
485
+ - Use output of this function to keep track of input positions.
486
+
487
+ Parameters ~
488
+ {positions} `(table)` Array of positions at which to perform join.
489
+ See |MiniSplitjoin-glossary| for their structure. Note: they don't have
490
+ to be ordered, but first and last ones will have different pad string.
491
+
492
+ Return ~
493
+ `(table)` Array of new positions to where input `positions` were moved.
494
+
495
+ ------------------------------------------------------------------------------
496
+ *MiniSplitjoin.get_visual_region()*
497
+ `MiniSplitjoin.get_visual_region`()
498
+ Get previous visual region
499
+
500
+ Get previous visual selection using |'<| and |'>| marks in the format of
501
+ region (see |MiniSplitjoin-glossary|). Used in Visual mode mappings.
502
+
503
+ Note:
504
+ - Both marks are included in region.
505
+ - In linewise mode start is at column 1 and end is at line's last character.
506
+
507
+ Return ~
508
+ `(table)` A region. See |MiniSplitjoin-glossary| for exact structure.
509
+
510
+ ------------------------------------------------------------------------------
511
+ *MiniSplitjoin.get_indent_part()*
512
+ `MiniSplitjoin.get_indent_part`({line}, {respect_comments})
513
+ Get string's indent part
514
+
515
+ Parameters ~
516
+ {line} `(string)` String for which to compute indent.
517
+ {respect_comments} `(boolean|nil)` Whether to respect comments as indent part.
518
+ Default: `true`.
519
+
520
+ Return ~
521
+ `(string)` Part of input representing line's indent. Can be empty string.
522
+ Use `string.len()` to compute indent in bytes.
523
+
524
+ ------------------------------------------------------------------------------
525
+ *MiniSplitjoin.operator()*
526
+ `MiniSplitjoin.operator`({task})
527
+ Operator for Normal mode mappings
528
+
529
+ Main function to be used in expression mappings. No need to use it
530
+ directly, everything is setup in |MiniSplitjoin.setup()|.
531
+
532
+ Parameters ~
533
+ {task} `(string)` Name of task.
534
+
535
+
536
+ vim:tw=78:ts=8:noet:ft=help:norl: