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,449 @@
1
+ *mini.keymap* Special key mappings
2
+
3
+ MIT License Copyright (c) 2025 Evgeni Chasnovski
4
+
5
+ ------------------------------------------------------------------------------
6
+ *MiniKeymap*
7
+ Features:
8
+
9
+ - Map keys to perform configurable multi-step actions: if condition for step
10
+ one is true - execute step one action, else check step two, and so on until
11
+ falling back to executing original keys. This is usually referred to as
12
+ "smart" keys (like "smart tab"). See |MiniKeymap.map_multistep()|.
13
+
14
+ There are many built-in steps targeted for Insert mode mappings of special
15
+ keys like <Tab>, <S-Tab>, <CR>, and <BS>:
16
+ - Navigate and accept |popupmenu-completion|. Useful for |mini.completion|.
17
+ - Navigate and expand |mini.snippets|.
18
+ - Execute <CR> and <BS> respecting |mini.pairs|.
19
+ - Jump before/after current tree-sitter node.
20
+ - Jump before opening and after closing characters (brackets and quotes).
21
+ - Increase/decrease indent when cursor is inside of it.
22
+ - Delete all whitespace to the left ("hungry backspace").
23
+ - Navigate |vim.snippet|.
24
+ - Navigate and accept in [hrsh7th/nvim-cmp](https://github.com/hrsh7th/nvim-cmp) completion.
25
+ - Navigate and accept in [Saghen/blink.cmp](https://github.com/Saghen/blink.cmp) completion.
26
+ - Navigate and expand [L3MON4D3/LuaSnip](https://github.com/L3MON4D3/LuaSnip) snippets.
27
+ - Execute <CR> and <BS> respecting [windwp/nvim-autopairs](https://github.com/windwp/nvim-autopairs).
28
+
29
+ - Map keys as "combo": each key acts immediately plus execute extra action if
30
+ all are typed within configurable delay between each other.
31
+ See |MiniKeymap.map_combo()|. Some of the common use cases include:
32
+ - Map insertable keys (like "jk", "kj") in Insert and Command-line mode
33
+ to exit into Normal mode.
34
+ - Fight against bad habits of pressing the same navigation key by showing
35
+ a notification if there are too many of them pressed in a row.
36
+
37
+ Sources with more details:
38
+ - |MiniKeymap-examples|
39
+
40
+ # Setup ~
41
+
42
+ This module doesn't need setup, but it can be done to improve usability.
43
+ Setup with `require('mini.keymap').setup({})` (replace `{}` with your `config`
44
+ table). It will create global Lua table `MiniKeymap` which you can use for
45
+ scripting or manually (with `:lua MiniKeymap.*`).
46
+
47
+ See |MiniKeymap.config| for `config` structure and default values.
48
+
49
+ This module doesn't have runtime options, so using `vim.b.minikeymap_config`
50
+ will have no effect here.
51
+
52
+ # Comparisons ~
53
+
54
+ - [max397574/better-escape.nvim](https://github.com/max397574/better-escape.nvim):
55
+ - Mostly similar to |MiniKeymap.map_combo()| with a different approach
56
+ to creating mappings.
57
+ - Mostly targeted for Insert mode mappings as pressed keys get removed
58
+ automatically after typed. This module allows more general cases while
59
+ requiring explicit removal of keys (usually via explicit `<BS><BS>`).
60
+
61
+ - [abecodes/tabout.nvim](https://github.com/abecodes/tabout.nvim):
62
+ - Similar general idea as in `'jump_{after,before}_tsnode'` steps
63
+ of |MiniKeymap.map_multistep()|.
64
+ - Works only with enabled tree-sitter parser. This module provides
65
+ fallback via `'jump_after_close'` and `'jump_before_open'` that work
66
+ without tree-sitter parser.
67
+ - `tabout.nvim` has finer control of how the tree-sitter node movement
68
+ is done, while this module has "jump outside of current node" behavior.
69
+
70
+ # Disabling ~
71
+
72
+ To disable acting in mappings, set `vim.g.minikeymap_disable` (globally) or
73
+ `vim.b.minikeymap_disable` (for a buffer) to `true`. Considering high number
74
+ of different scenarios and customization intentions, writing exact rules
75
+ for disabling module's functionality is left to user.
76
+ See |mini.nvim-disabling-recipes| for common recipes.
77
+
78
+ ------------------------------------------------------------------------------
79
+ *MiniKeymap-examples*
80
+ # Multi-step ~
81
+
82
+ See |MiniKeymap.map_multistep()| for a general description of how multi-step
83
+ mappings work and what built-in steps are available.
84
+
85
+ Setup that works well with |mini.completion| and |mini.pairs|: >lua
86
+
87
+ local map_multistep = require('mini.keymap').map_multistep
88
+ map_multistep('i', '<Tab>', { 'pmenu_next' })
89
+ map_multistep('i', '<S-Tab>', { 'pmenu_prev' })
90
+ map_multistep('i', '<CR>', { 'pmenu_accept', 'minipairs_cr' })
91
+ map_multistep('i', '<BS>', { 'minipairs_bs' })
92
+ <
93
+ Use <Tab> / <S-Tab> to also navigate and expand |mini.snippets|: >lua
94
+
95
+ local map_multistep = require('mini.keymap').map_multistep
96
+
97
+ local tab_steps = { 'minisnippets_next','minisnippets_expand','pmenu_next' }
98
+ map_multistep('i', '<Tab>', tab_steps)
99
+
100
+ local shifttab_steps = { 'minisnippets_prev', 'pmenu_prev' }
101
+ map_multistep('i', '<S-Tab>', shifttab_steps)
102
+ <
103
+ An extra smart <Tab> and <S-Tab>: >lua
104
+
105
+ local map_multistep = require('mini.keymap').map_multistep
106
+
107
+ -- NOTE: this will never insert tab, press <C-v><Tab> for that
108
+ local tab_steps = {
109
+ 'minisnippets_next', 'minisnippets_expand', 'pmenu_next',
110
+ 'jump_after_tsnode', 'jump_after_close',
111
+ }
112
+ map_multistep('i', '<Tab>', tab_steps)
113
+
114
+ local shifttab_steps = {
115
+ 'minisnippets_prev', 'pmenu_prev',
116
+ 'jump_before_tsnode', 'jump_before_open',
117
+ }
118
+ map_multistep('i', '<S-Tab>', shifttab_steps)
119
+ <
120
+ Navigation in active |vim.snippet| session also requires mapping in |Select-mode|: >lua
121
+
122
+ local map_multistep = require('mini.keymap').map_multistep
123
+ map_multistep({ 'i', 's' }, '<Tab>', { 'vimsnippet_next', 'pmenu_next' })
124
+ map_multistep({ 'i', 's' }, '<S-Tab>', { 'vimsnippet_prev', 'pmenu_prev' })
125
+ <
126
+ # Combos ~
127
+
128
+ See |MiniKeymap.map_combo()| for a general description of what is a combo and
129
+ more caveats about its usage.
130
+
131
+ All combos require their left hand side keys to be typed relatively quickly.
132
+ To adjust the delay between keys, add `{ delay = 500 }` (use custom value) as
133
+ fourth argument.
134
+
135
+ ## "Better escape" to Normal mode ~
136
+
137
+ Leave into |Normal-mode| without having to reach for <Esc> key: >lua
138
+
139
+ -- Support most common modes. This can also contain 't', but would
140
+ -- only mean to press `<Esc>` inside terminal.
141
+ local mode = { 'i', 'c', 'x', 's' }
142
+ require('mini.keymap').map_combo(mode, 'jk', '<BS><BS><Esc>')
143
+
144
+ -- To not have to worry about the order of keys, also map "kj"
145
+ require('mini.keymap').map_combo(mode, 'kj', '<BS><BS><Esc>')
146
+
147
+ -- Escape into Normal mode from Terminal mode
148
+ require('mini.keymap').map_combo('t', 'jk', '<BS><BS><C-\\><C-n>')
149
+ require('mini.keymap').map_combo('t', 'kj', '<BS><BS><C-\\><C-n>')
150
+ <
151
+ ## Show bad navigation habits ~
152
+
153
+ Show notification if there is too much movement by repeating same key: >lua
154
+
155
+ local notify_many_keys = function(key)
156
+ local lhs = string.rep(key, 5)
157
+ local action = function() vim.notify('Too many ' .. key) end
158
+ require('mini.keymap').map_combo({ 'n', 'x' }, lhs, action)
159
+ end
160
+ notify_many_keys('h')
161
+ notify_many_keys('j')
162
+ notify_many_keys('k')
163
+ notify_many_keys('l')
164
+ <
165
+ ## Fix previous spelling mistake ~
166
+
167
+ Fix previous spelling mistake (see |[s| and |z=|) without manually leaving
168
+ Insert mode: >lua
169
+
170
+ local action = '<BS><BS><Esc>[s1z=gi<Right>'
171
+ require('mini.keymap').map_combo('i', 'kk', action)
172
+ <
173
+ ## Hide search highlighting ~
174
+
175
+ Use double <Esc><Esc> to execute |:nohlsearch|. Although this can also be done
176
+ with `nmap <Esc> <Cmd>nohl<CR>`, the combo approach also exists and can be used
177
+ to free <Esc> mapping in Normal mode for something else. >lua
178
+
179
+ local action = function() vim.cmd('nohlsearch') end
180
+ require('mini.keymap').map_combo({ 'n','i','x','c' }, '<Esc><Esc>', action)
181
+ <
182
+ ## Buffer navigation ~
183
+
184
+ Replace some movements with easier to type alternatives: >lua
185
+
186
+ local map_combo = require('mini.keymap').map_combo
187
+ map_combo({ 'n', 'x' }, 'll', 'g$')
188
+ map_combo({ 'n', 'x' }, 'hh', 'g^')
189
+ map_combo({ 'n', 'x' }, 'jj', '}')
190
+ map_combo({ 'n', 'x' }, 'kk', '{')
191
+ <
192
+ ------------------------------------------------------------------------------
193
+ *MiniKeymap.setup()*
194
+ `MiniKeymap.setup`({config})
195
+ Module setup
196
+
197
+ Parameters ~
198
+ {config} `(table|nil)` Module config table. See |MiniKeymap.config|.
199
+
200
+ Usage ~
201
+ >lua
202
+ require('mini.keymap').setup({}) -- replace {} with your config table
203
+ -- needs `keymap` field present
204
+ <
205
+ ------------------------------------------------------------------------------
206
+ *MiniKeymap.config*
207
+ `MiniKeymap.config`
208
+ Defaults ~
209
+ >lua
210
+ MiniKeymap.config = {}
211
+ <
212
+ ------------------------------------------------------------------------------
213
+ *MiniKeymap.map_multistep()*
214
+ `MiniKeymap.map_multistep`({mode}, {lhs}, {steps}, {opts})
215
+ Map multi-step action
216
+
217
+ Mapping of a multi-step action is an expression mapping (|:map-expression|).
218
+ Executing a multi-step action is essentially:
219
+ - Check condition for step one. If `true` - execute step one action and stop.
220
+ - Check condition for step two, and so on.
221
+ - If there is no more steps, fall back to returning mapped key.
222
+
223
+ For better user experience there are many built-in steps mostly designed
224
+ to create Insert mode "smart" mappings of <Tab>, <S-Tab>, <CR>, and <BS>.
225
+ Available built-in steps ("For key" is a suggestion, any can be used):
226
+ >
227
+ ┌─────────────────────┬────────────────┬──────────────────────────┬─────────┐
228
+ │ Step name │ Condition │ Action │ For key │
229
+ ├─────────────────────┴────────────────┴──────────────────────────┴─────────┤
230
+ ├┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ |ins-completion-menu| ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┤
231
+ │ pmenu_next │ Pmenu visible │ Select next (as <C-n>) │ <Tab> │
232
+ │ pmenu_prev │ Pmenu visible │ Select prev (as <C-p>) │ <S-Tab> │
233
+ │ pmenu_accept │ Item selected │ Accept (as <C-y>) │ <CR> │
234
+ ├┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ |mini.snippets| ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┤
235
+ │ minisnippets_next │ Session active │ Jump to next tabstop │ <Tab> │
236
+ │ minisnippets_prev │ Session active │ Jump to prev tabstop │ <S-Tab> │
237
+ │ minisnippets_expand │ Can expand │ Expand snippet at cursor │ <Tab> │
238
+ ├┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ |mini.pairs| ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┤
239
+ │ minipairs_cr │ Module set up │ <CR> respecting pairs │ <CR> │
240
+ │ minipairs_bs │ Module set up │ <BS> respecting pairs │ <BS> │
241
+ ├┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ Jump around in Insert mode ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┤
242
+ │ jump_after_tsnode │ TS parser │ Jump after node end │ <Tab> │
243
+ │ jump_before_tsnode │ TS parser │ Jump before node start │ <S-Tab> │
244
+ │ jump_after_close │ Insert mode │ Jump after )]}"'` │ <Tab> │
245
+ │ jump_before_open │ Insert mode │ Jump before ([{"'` │ <S-Tab> │
246
+ ├┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ Work with whitespace ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┤
247
+ │ increase_indent │ Is on indent │ Increase indent │ <Tab> │
248
+ │ decrease_indent │ Is on indent │ Decrease indent │ <S-Tab> │
249
+ │ hungry_bs │ Space to left │ Delete all space to left │ <BS> │
250
+ ├┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ |vim.snippet| ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┤
251
+ │ vimsnippet_next │ Session active │ Jump to next tabstop │ <Tab> │
252
+ │ vimsnippet_prev │ Session active │ Jump to prev tabstop │ <S-Tab> │
253
+ ├┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ 'hrsh7th/nvim-cmp' ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┤
254
+ │ cmp_next │ Menu visible │ Select next item │ <Tab> │
255
+ │ cmp_prev │ Menu visible │ Select prev item │ <S-Tab> │
256
+ │ cmp_accept │ Item selected │ Accept selected item │ <CR> │
257
+ ├┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ 'Saghen/blink.cmp' ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┤
258
+ │ blink_next │ Menu visible │ Select next item │ <Tab> │
259
+ │ blink_prev │ Menu visible │ Select prev item │ <S-Tab> │
260
+ │ blink_accept │ Item selected │ Accept selected item │ <CR> │
261
+ ├┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ 'L3MON4D3/LuaSnip' ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┤
262
+ │ luasnip_next │ Session active │ Jump to next tabstop │ <Tab> │
263
+ │ luasnip_prev │ Session active │ Jump to prev tabstop │ <S-Tab> │
264
+ │ luasnip_expand │ Can expand │ Expand snippet at cursor │ <Tab> │
265
+ ├┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈ 'windwp/nvim-autopairs' ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┤
266
+ │ nvimautopairs_cr │ Module present │ <CR> respecting pairs │ <CR> │
267
+ │ nvimautopairs_bs │ Module present │ <BS> respecting pairs │ <BS> │
268
+ └─────────────────────┴────────────────┴──────────────────────────┴─────────┘
269
+ <
270
+ Notes:
271
+ - Executing action has limitations of |:map-expression| (like not allowed text
272
+ or buffer changes, etc.). To execute complex lua code, use |vim.schedule()|
273
+ inside action, return the code as string in |:map-cmd| format, or return
274
+ a function to be later executed. See usage examples.
275
+
276
+ - Some mapped keys (like <Tab>, <CR>) might require disabling smart presets
277
+ in plugins (like `nvim-cmp`, `blink-cmp`, `nvim-autopairs`).
278
+
279
+ Parameters ~
280
+ {mode} `(string|table)` Same as for |vim.keymap.set()|.
281
+ {lhs} `(string)` Same as for |vim.keymap.set()|.
282
+ {steps} `(table)` Array of steps. Each step can be a string with the name
283
+ of built-in step or a table with two callable methods (will be called
284
+ without arguments):
285
+ - <condition> - return `true` if the action should be executed.
286
+ - <action> - action to be executed if <condition> returns `true`.
287
+ For more flexibility, it can also return a value which can be:
288
+ - String - will be returned as expression output. Can be something like
289
+ `"<Tab>"` (treat as <Tab> key) or `"<Cmd>lua vim.notify('Hello')<CR>"`.
290
+ Should not escape keycodes (i.e. return "<Tab>" and not "\t").
291
+ To undo already done escape, use |keytrans()|.
292
+ - Function - will be executed as if `"<Cmd>lua f()<CR>"`, but does not
293
+ need to create a global function for that.
294
+ - `false` - do not stop going through steps.
295
+ {opts} `(table|nil)` Same as for |vim.keymap.set()|.
296
+
297
+ Usage ~
298
+ See |MiniKeymap-examples| for practical examples.
299
+
300
+ Some illustrative examples: >lua
301
+
302
+ _G.log = {}
303
+ local steps = {}
304
+ steps[1] = {
305
+ condition = function() table.insert(_G.log, 'C1'); return _G.cond1 end,
306
+ -- Compute and return keys. Will be emulated as pressed.
307
+ action = function() table.insert(_G.log, 'A1'); return 'hello' end,
308
+ }
309
+
310
+ steps[2] = {
311
+ condition = function() table.insert(_G.log, 'C2'); return _G.cond2 end,
312
+ -- Perform action immediately, return `false` to keep asking other steps
313
+ action = function() table.insert(_G.log, 'A2'); return false end,
314
+ }
315
+
316
+ steps[3] = {
317
+ condition = function() table.insert(_G.log, 'C3'); return _G.cond3 end,
318
+ -- Perform action later (to overcom expression mapping limitations)
319
+ action = function()
320
+ table.insert(_G.log, 'A3_1')
321
+ return function() table.insert(_G.log, 'A3_2') end
322
+ end,
323
+ }
324
+
325
+ -- Make Insert mode <Tab> mapping
326
+ require('mini.keymap').map_multistep('i', '<Tab>', steps)
327
+
328
+ -- Pressing <Tab> inserts fallback `\t`; logs C1+C2+C3
329
+ _G.cond1, _G.cond2, _G.cond3 = false, false, false
330
+
331
+ -- Pressing <Tab> inserts `hello`; logs C1+A1
332
+ _G.cond1, _G.cond2, _G.cond3 = true, false, false
333
+
334
+ -- Pressing <Tab> inserts nothing; logs C1+C2+A2+C3+A3_1+A3_2
335
+ _G.cond1, _G.cond2, _G.cond3 = false, true, true
336
+ <
337
+ ------------------------------------------------------------------------------
338
+ *MiniKeymap.gen_step*
339
+ `MiniKeymap.gen_step`
340
+ Generate step for multi-step mappings
341
+
342
+ This is a table with function elements. Call to actually get a step.
343
+
344
+ ------------------------------------------------------------------------------
345
+ *MiniKeymap.gen_step.search_pattern()*
346
+ `MiniKeymap.gen_step.search_pattern`({pattern}, {flags}, {opts})
347
+ Search pattern step
348
+
349
+ Use |search()| to jump to pattern match. Possibly adjust final position to
350
+ be just to the right of the match (useful in Insert mode).
351
+
352
+ Parameters ~
353
+ {pattern} `(string)` Same as for |search()|.
354
+ {flags} `(string|nil)` Same as for |search()|.
355
+ {opts} `(table|nil)` Options. Possible fields:
356
+ - <side> `(string)` - one of `"before"` (default) or `"after"`.
357
+ - <stopline> `(number|function)` - forwarded to |search()| (as number or
358
+ as function's output after calling it before every search).
359
+ - <timeout> `(number)` - forwarded to |search()|.
360
+ - <skip> `(string|function)` - forwarded to |search()|.
361
+
362
+ Return ~
363
+ `(table)` Step which searches pattern.
364
+
365
+ Usage ~
366
+ Built-in |MiniKeymap.map_multistep()| steps "jump_after_close" and
367
+ "jump_before_open" use this, but only in Insert mode.
368
+
369
+ Steps that jump before/after all consecutive brackets in several modes: >lua
370
+
371
+ local keymap = require('mini.keymap')
372
+ local tab_step_insert = keymap.gen_step.search_pattern(
373
+ -- Need to use 'c' flag and 'after' side for robust "chaining"
374
+ [=[[)\]}]\+]=], 'ceW', { side = 'after' }
375
+ )
376
+ keymap.map_multistep('i', '<Tab>', { tab_step_insert })
377
+ local tab_step = keymap.gen_step.search_pattern([=[[)\]}]\+]=], 'eW')
378
+ keymap.map_multistep({ 'n', 'x' }, '<Tab>', { tab_step })
379
+
380
+ local stab_step = keymap.gen_step.search_pattern([=[[(\[{]\+]=], 'bW')
381
+ keymap.map_multistep({ 'i', 'n', 'x' }, '<S-Tab>', { stab_step })
382
+ <
383
+ ------------------------------------------------------------------------------
384
+ *MiniKeymap.map_combo()*
385
+ `MiniKeymap.map_combo`({mode}, {lhs}, {action}, {opts})
386
+ Map combo post action
387
+
388
+ Create a combo: sequence of keys where each acts immediately plus execute
389
+ an extra action if all are typed within configurable delay between each other.
390
+
391
+ Example for Insert mode "better escape" `jk` combo with `<BS><BS><Esc>` action:
392
+ - Press `j`. It is visible immediately without any side effects.
393
+ - Quickly (no more than default 200 ms after) press `k`. This triggers the
394
+ action which is equivalent to typing <BS><BS> (delete already present `jk`)
395
+ and <Esc> to exit into Normal mode.
396
+
397
+ Notes:
398
+ - IMPORTANT! Combo is not a regular mapping but a separate key tracking
399
+ with |vim.on_key()|. This is important as combos will not be visible and
400
+ can not be managed as regular mappings. Instead each combo is associated
401
+ with a dedicated |namespace| (named for human readability). However, it is not
402
+ really expected to manage them on the fly after they are created.
403
+
404
+ - String action is executed with |nvim_input()|, i.e. emulated keys will
405
+ respect custom mappings.
406
+
407
+ - Different combos are tracked and act independent of each other. For example,
408
+ if there are combos for `jjk` and `jk` keys, fast typing `jjk` will execute both.
409
+
410
+ - Neovim>=0.11 is recommended due to |vim.on_key()| improvement to allow
411
+ watching for keys as they are typed and not as if coming from mappings.
412
+ For example, this matters when creating a `jk` combo for Visual mode while
413
+ also having `xnoremap j gj` style of remaps. On Neovim<0.11 the fix is to
414
+ use `gjgk` as combo's left hand side.
415
+
416
+ - Each combo adds very small but non-zero overhead on each keystroke.
417
+ Usually about 1-3 microseconds (i.e. 0.001-0.003 ms), which should be
418
+ fast enough for most setups. For a "normal, real world" coding session
419
+ with a total of ~20000 keystrokes it results in extra ~40ms of overhead
420
+ for a single created combo. Create many combos with caution.
421
+
422
+ Parameters ~
423
+ {mode} `(string|table)` String or array of string mode id (like "n", "i", etc.).
424
+ Array of several modes is more performant than several single mode combos.
425
+ {lhs} `(string|table)` String with tracked key sequence or an array of
426
+ tracked keys (one element - one key).
427
+ {action} `(string|function)` Action to perform after key sequence is detected.
428
+ If string, treated as keys and emulated with |nvim_input()|.
429
+ If function, executed in |vim.schedule()|. Can return string keys which will
430
+ be emulated.
431
+ {opts} `(table|nil)` Options. Possible fields:
432
+ - <delay> `(number)` - delay in milliseconds within which keys should be
433
+ pressed to detect a key sequence. Default: 200.
434
+
435
+ Usage ~
436
+ See |MiniKeymap-examples| for practical examples.
437
+
438
+ Some illustrative examples: >lua
439
+
440
+ local map_combo = require('mini.keymap').map_combo
441
+
442
+ -- In Insert mode pressing `x` followed by `x` within 1 second logs 'A'
443
+ -- and emulates extra pressing of `yy`
444
+ _G.log = {}
445
+ local action = function() table.insert(_G.log, 'A'); return 'yy' end
446
+ map_combo('i', 'xx', action, { delay = 1000 })
447
+ <
448
+
449
+ vim:tw=78:ts=8:noet:ft=help:norl: