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,661 @@
1
+ *mini.diff* Work with diff hunks
2
+
3
+ MIT License Copyright (c) 2024 Evgeni Chasnovski
4
+
5
+ ------------------------------------------------------------------------------
6
+ *MiniDiff*
7
+ Features:
8
+
9
+ - Visualize difference between buffer text and its configurable reference
10
+ interactively (updates as you type). This is done per line showing whether
11
+ it is inside added, changed, or deleted part of difference (called hunk).
12
+ Visualization can be with customizable colored signs or line numbers.
13
+
14
+ - Special toggleable overlay view with more hunk details inside text area.
15
+ See |MiniDiff.toggle_overlay()|.
16
+
17
+ - Completely configurable per buffer source(s) of reference text used to keep
18
+ it up to date and define interactions with it. Can be array of sources which
19
+ are attempted to attach in order. See |MiniDiff-source-specification|.
20
+ By default uses Git source. See |MiniDiff.gen_source.git()|.
21
+
22
+ - Configurable mappings to manage diff hunks:
23
+ - Apply and reset hunks inside region (selected visually or with
24
+ a dot-repeatable operator).
25
+ - "Hunk range under cursor" textobject to be used as operator target.
26
+ - Navigate to first/previous/next/last hunk. See |MiniDiff.goto_hunk()|.
27
+
28
+ What it doesn't do:
29
+
30
+ - Provide functionality to work directly with Git outside of visualizing
31
+ and staging (applying) hunks with (default) Git source. In particular,
32
+ unstaging hunks is not supported. See |MiniDiff.gen_source.git()|.
33
+
34
+ Sources with more details:
35
+ - |MiniDiff-overview|
36
+ - |MiniDiff-source-specification|
37
+ - |MiniDiff-hunk-specification|
38
+ - |MiniDiff-diff-summary|
39
+
40
+ # Setup ~
41
+
42
+ This module needs a setup with `require('mini.diff').setup({})` (replace
43
+ `{}` with your `config` table). It will create global Lua table `MiniDiff`
44
+ which you can use for scripting or manually (with `:lua MiniDiff.*`).
45
+
46
+ See |MiniDiff.config| for `config` structure and default values.
47
+
48
+ You can override runtime config settings locally to buffer inside
49
+ `vim.b.minidiff_config` which should have same structure as
50
+ `MiniDiff.config`. See |mini.nvim-buffer-local-config| for more details.
51
+
52
+ # Comparisons ~
53
+
54
+ - [lewis6991/gitsigns.nvim](https://github.com/lewis6991/gitsigns.nvim):
55
+ - Main inspiration for this module, so there are many similarities.
56
+ - Can display only Git hunks, while this module has extensible design.
57
+ - Provides more functionality to work with Git outside of hunks.
58
+ This module does not (by design).
59
+
60
+ # Highlight groups ~
61
+ *MiniDiff-hl-groups*
62
+
63
+ - `MiniDiffSignAdd` - "add" hunk lines visualization.
64
+ - `MiniDiffSignChange` - "change" hunk lines visualization.
65
+ - `MiniDiffSignDelete` - "delete" hunk lines visualization.
66
+ - `MiniDiffOverAdd` - added buffer text shown in overlay.
67
+ - `MiniDiffOverChange` - changed reference text shown in overlay.
68
+ - `MiniDiffOverChangeBuf` - changed buffer text shown in overlay.
69
+ - `MiniDiffOverContext` - context of a change shown in reference overlay.
70
+ - `MiniDiffOverContextBuf` - context of a change shown in buffer overlay.
71
+ - `MiniDiffOverDelete` - deleted reference text shown in overlay.
72
+
73
+ To change any highlight group, set it directly with |nvim_set_hl()|.
74
+
75
+ # Disabling ~
76
+
77
+ To temporarily disable features without relying on |MiniDiff.disable()|,
78
+ set `vim.g.minidiff_disable` (globally) or `vim.b.minidiff_disable` (for
79
+ a buffer) to `true`. Considering high number of different scenarios and
80
+ customization intentions, writing exact rules for disabling module's
81
+ functionality is left to user.
82
+ See |mini.nvim-disabling-recipes| for common recipes.
83
+
84
+ ------------------------------------------------------------------------------
85
+ *MiniDiff-overview*
86
+ # Diffs and hunks ~
87
+
88
+ The "diff" (short for "difference") is a result of computing how two text
89
+ strings differ from one another. This is done on per line basis, i.e. the
90
+ goal is to compute sequences of lines common to both files, interspersed
91
+ with groups of differing lines (called "hunks").
92
+
93
+ Although computing diff is a general concept (used on its own, in Git, etc.),
94
+ this module computes difference between current text in a buffer and some
95
+ reference text which is kept up to date specifically for that buffer.
96
+ For example, default reference text is computed as file content in Git index.
97
+ This can be customized in `config.source` (see |MiniDiff-source-specification|).
98
+
99
+ # Hunk specification ~
100
+ *MiniDiff-hunk-specification*
101
+
102
+ Hunk describes two sets (one from buffer text, one - from reference) of
103
+ consecutive lines which are different. In this module hunk is stored as
104
+ a table with the following fields:
105
+
106
+ - <buf_start> `(number)` - start of hunk buffer lines. First line is 1.
107
+ Can be 0 if first reference lines are deleted.
108
+
109
+ - <buf_count> `(number)` - number of consecutive buffer lines. Can be 0 in
110
+ case reference lines are deleted.
111
+
112
+ - <ref_start> `(number)` - start of hunk reference lines. First line is 1.
113
+ Can be 0 if lines are added before first reference line.
114
+
115
+ - <ref_count> `(number)` - number of consecutive reference lines. Can be 0 in
116
+ case buffer lines are added.
117
+
118
+ - <type> `(string)` - hunk type. Can be one of:
119
+ - "add" - lines are present in buffer but absent in reference.
120
+ - "change" - lines are present in both buffer and reference.
121
+ - "delete" - lines are absent in buffer but present in reference.
122
+
123
+ # Life cycle ~
124
+
125
+ - When entering proper (not already enabled, valid, showing text) buffer,
126
+ it is attempted to be enabled for diff processing.
127
+ - During enabling, attempt attaching the source. This should set up how
128
+ reference text is kept up to date.
129
+ - On every text change, diff computation is scheduled in debounced fashion
130
+ after customizable delay (200 ms by default).
131
+ - After the diff is computed, do the following:
132
+ - Update visualization based on configurable style: either by placing
133
+ colored text in sign column or coloring line numbers. Colors for both
134
+ styles are defined per hunk type in corresponding `MiniDiffSign*`
135
+ highlight group (see |mini.diff|) and sign text for "sign" style can
136
+ be configured in `view.signs` of |MiniDiff.config|.
137
+ - Update overlay view (if it is enabled).
138
+ - Update `vim.b.minidiff_summary` and `vim.b.minidiff_summary_string`
139
+ buffer-local variables. These can be used, for example, in statusline.
140
+ - *MiniDiff-update-event* Trigger `MiniDiffUpdated` `User` event.
141
+ See |MiniDiff-diff-summary| for example of how to use it.
142
+
143
+ Notes:
144
+ - Use |:edit| to reset (disable and re-enable) current buffer.
145
+ - To work with BOM bytes, set |'bomb'| and have `ucs-bom` in |'fileencodings'|.
146
+
147
+ # Overlay ~
148
+
149
+ Along with basic visualization, there is a special view called "overlay".
150
+ Although it is meant for temporary overview of diff details and can be
151
+ manually toggled via |MiniDiff.toggle_overlay()|, text can be changed with
152
+ overlay reacting accordingly.
153
+
154
+ It shows more diff details inside text area:
155
+
156
+ - Added buffer lines are highlighted with `MiniDiffOverAdd` highlight group.
157
+
158
+ - Deleted reference lines are shown as virtual lines and highlighted with
159
+ `MiniDiffOverDelete` highlight group.
160
+
161
+ - "Change" hunks with equal number of buffer/reference lines show "word diff".
162
+ This is usually the case when `options.linematch` is enabled (as by default).
163
+ Reference line is shown next to its buffer counterpart. Changed parts are
164
+ highlighted with `MiniDiffOverChange` and `MiniDiffOverChangeBuf` in reference
165
+ and buffer lines. The rest of lines have `MiniDiffOverContext`
166
+ and `MiniDiffOverContextBuf` highlighting.
167
+
168
+ Change with unequal number of buffer/reference lines is shown with reference
169
+ part as virtual lines highlighted with `MiniDiffOverChange` group.
170
+ Corresponding buffer lines are treated as context for the change and are
171
+ highlighted with `MiniDiffOverContextBuf` group.
172
+
173
+ Notes:
174
+ - Word diff has non-zero context width. This means if changed characters
175
+ are close enough, whole range between them is also colored. This usually
176
+ reduces visual noise.
177
+ - Virtual lines above line 1 (like deleted or changed lines) need manual
178
+ scroll to become visible (with |CTRL-Y|).
179
+
180
+ # Mappings ~
181
+
182
+ This module provides mappings for common actions with diffs, like:
183
+ - Apply and reset hunks.
184
+ - "Hunk range under cursor" textobject.
185
+ - Go to first/previous/next/last hunk range.
186
+
187
+ Examples:
188
+ - `vip` followed by `gh` / `gH` applies/resets hunks inside current paragraph.
189
+ Same can be achieved in operator form `ghip` / `gHip`, which has the
190
+ advantage of being dot-repeatable (see |single-repeat|).
191
+ - `gh_` / `gH_` applies/resets current line (even if it is not a full hunk).
192
+ - `ghgh` / `gHgh` applies/resets hunk range under cursor.
193
+ - `dgh` deletes hunk range under cursor.
194
+ - `[H` / `[h` / `]h` / `]H` navigate cursor to the first / previous / next / last
195
+ hunk range of the current buffer.
196
+
197
+ Mappings for some functionality are assumed to be done manually.
198
+ See |MiniDiff.operator()|.
199
+
200
+ # Buffer-local variables ~
201
+ *MiniDiff-diff-summary*
202
+
203
+ Each enabled buffer has the following buffer-local variables which can be
204
+ used in custom statusline to show an overview of hunks in current buffer:
205
+
206
+ - `vim.b.minidiff_summary` is a table with the following fields:
207
+ - `source_name` - name of the active source. This is the only present field
208
+ if buffer's reference text is not (yet) set.
209
+ - `n_ranges` - number of hunk ranges (sequences of contiguous hunks).
210
+ - `add` - number of added lines.
211
+ - `change` - number of changed lines.
212
+ - `delete` - number of deleted lines.
213
+
214
+ - `vim.b.minidiff_summary_string` is a string representation of summary
215
+ with a fixed format. Empty string if there is no reference text (yet).
216
+ It is expected to be used as is. To achieve different formatting, use
217
+ `vim.b.minidiff_summary` to construct one. The best way to do this is by
218
+ overriding `vim.b.minidiff_summary_string` inside |MiniDiff-update-event|: >lua
219
+
220
+ local format_summary = function(data)
221
+ local summary = vim.b[data.buf].minidiff_summary
222
+ local t = {}
223
+ if summary.add > 0 then table.insert(t, '+' .. summary.add) end
224
+ if summary.change > 0 then table.insert(t, '~' .. summary.change) end
225
+ if summary.delete > 0 then table.insert(t, '-' .. summary.delete) end
226
+ vim.b[data.buf].minidiff_summary_string = table.concat(t, ' ')
227
+ end
228
+ local au_opts = { pattern = 'MiniDiffUpdated', callback = format_summary }
229
+ vim.api.nvim_create_autocmd('User', au_opts)
230
+ <
231
+ ------------------------------------------------------------------------------
232
+ *MiniDiff.setup()*
233
+ `MiniDiff.setup`({config})
234
+ Module setup
235
+
236
+ Parameters ~
237
+ {config} `(table|nil)` Module config table. See |MiniDiff.config|.
238
+
239
+ Usage ~
240
+ >lua
241
+ require('mini.diff').setup() -- use default config
242
+ -- OR
243
+ require('mini.diff').setup({}) -- replace {} with your config table
244
+ <
245
+ ------------------------------------------------------------------------------
246
+ *MiniDiff.config*
247
+ `MiniDiff.config`
248
+ Defaults ~
249
+ >lua
250
+ MiniDiff.config = {
251
+ -- Options for how hunks are visualized
252
+ view = {
253
+ -- Visualization style. Possible values are 'sign' and 'number'.
254
+ -- Default: 'number' if line numbers are enabled, 'sign' otherwise.
255
+ style = vim.go.number and 'number' or 'sign',
256
+
257
+ -- Signs used for hunks with 'sign' view
258
+ signs = { add = '▒', change = '▒', delete = '▒' },
259
+
260
+ -- Priority of used visualization extmarks
261
+ priority = 199,
262
+ },
263
+
264
+ -- Source(s) for how reference text is computed/updated/etc
265
+ -- Uses content from Git index by default
266
+ source = nil,
267
+
268
+ -- Delays (in ms) defining asynchronous processes
269
+ delay = {
270
+ -- How much to wait before update following every text change
271
+ text_change = 200,
272
+ },
273
+
274
+ -- Module mappings. Use `''` (empty string) to disable one.
275
+ mappings = {
276
+ -- Apply hunks inside a visual/operator region
277
+ apply = 'gh',
278
+
279
+ -- Reset hunks inside a visual/operator region
280
+ reset = 'gH',
281
+
282
+ -- Hunk range textobject to be used inside operator
283
+ -- Works also in Visual mode if mapping differs from apply and reset
284
+ textobject = 'gh',
285
+
286
+ -- Go to hunk range in corresponding direction
287
+ goto_first = '[H',
288
+ goto_prev = '[h',
289
+ goto_next = ']h',
290
+ goto_last = ']H',
291
+ },
292
+
293
+ -- Various options
294
+ options = {
295
+ -- Diff algorithm (see `:h vim.text.diff()`)
296
+ algorithm = 'histogram',
297
+
298
+ -- Whether to use "indent heuristic" (see `:h vim.text.diff()`)
299
+ indent_heuristic = true,
300
+
301
+ -- The amount of second-stage diff to align lines
302
+ linematch = 60,
303
+
304
+ -- Whether to wrap around edges during hunk navigation
305
+ wrap_goto = false,
306
+ },
307
+ }
308
+ <
309
+ # View ~
310
+
311
+ `config.view` contains settings for how diff hunks are visualized.
312
+ Example of using custom signs: >lua
313
+
314
+ require('mini.diff').setup({
315
+ view = {
316
+ style = 'sign',
317
+ signs = { add = '+', change = '~', delete = '-' },
318
+ },
319
+ })
320
+ <
321
+ `view.style` is a string defining visualization style. Can be one of "sign"
322
+ (as a colored sign in a |sign-column|) or "number" (colored line number).
323
+ Default: "number" if |'number'| option is enabled, "sign" otherwise.
324
+ Note: with "sign" style it is better to have |'signcolumn'| always shown.
325
+
326
+ `view.signs` is a table with one or two character strings used as signs for
327
+ corresponding ("add", "change", "delete") hunks.
328
+ Default: all hunks use "▒" character resulting in a contiguous colored lines.
329
+
330
+ `view.priority` is a number with priority used for visualization and
331
+ overlay |extmarks|.
332
+ Default: 199 which is one less than `user` in |vim.hl.priorities| (on Neovim<0.11
333
+ see |vim.hl.priorities|) to have higher priority than automated
334
+ extmarks but not as in user enabled ones.
335
+
336
+ # Source ~
337
+ *MiniDiff-source-specification*
338
+
339
+ `config.source` is a table with single source or array of them. Single source
340
+ defines how reference text is managed in a particular buffer. Sources in array
341
+ are attempted to attach in order; call |MiniDiff.disable()| if none attaches.
342
+
343
+ A single source table can have the following fields:
344
+
345
+ - <attach> `(function)` - callable which defines how and when reference text
346
+ is updated inside a particular buffer. It is used inside |MiniDiff.enable()|
347
+ with a buffer identifier as a single argument.
348
+
349
+ Should execute logic which results into calling |MiniDiff.set_ref_text()|
350
+ when reference text for buffer needs to be updated. Like inside callback
351
+ for an |autocommand| or file watcher (see |watch-file|).
352
+
353
+ For example, default Git source watches when ".git/index" file is changed
354
+ and computes reference text as the one from Git index for current file.
355
+
356
+ Can return `false` to indicate that attach has failed. If attach fail can
357
+ not be inferred immediately (for example, due to asynchronous execution),
358
+ should explicitly call |MiniDiff.fail_attach()| with appropriate arguments.
359
+ This is important to properly process array of sources.
360
+
361
+ No default value, should be always supplied.
362
+
363
+ - <name> `(string|nil)` - source name. String `"unknown"` is used if not supplied.
364
+
365
+ - <detach> `(function|nil)` - callable with cleanup action to be done when
366
+ buffer is disabled. It is called inside |MiniDiff.disable()| with a buffer
367
+ identifier as a single argument.
368
+
369
+ If not supplied, nothing is done during detaching.
370
+
371
+ - <apply_hunks> `(function|nil)` - callable which defines how hunks are applied.
372
+ It is called with buffer identifier as first argument and array of hunks
373
+ (see |MiniDiff-hunk-specification|) as second. It should eventually update
374
+ reference text: either by explicitly calling |MiniDiff.set_ref_text()| or
375
+ performing action triggering its call.
376
+
377
+ For example, default Git source computes patch based on the hunks and
378
+ applies it inside file's git repo.
379
+
380
+ If not supplied, applying hunks throws an error.
381
+
382
+ Default: a single |MiniDiff.gen_source.git()|.
383
+
384
+ # Delay ~
385
+
386
+ `config.delay` contains settings for delays in asynchronous processes.
387
+
388
+ `delay.text_change` is a number (in ms) defining how long to wait after latest
389
+ text change (in debounced fashion) before updating diff and visualization.
390
+ Default: 200.
391
+
392
+ # Mappings ~
393
+
394
+ `config.mappings` contains keys which are mapped during |MiniDiff.setup()|.
395
+
396
+ `mappings.apply` keys can be used to apply hunks inside visual/operator region.
397
+ What exactly "apply hunks" means depends on the source and its `apply_hunks()`.
398
+ For example, in default Git source it means stage hunks.
399
+
400
+ `mappings.reset` keys can be used to reset hunks inside visual/operator region.
401
+ Reset means replacing buffer text in region with corresponding reference text.
402
+
403
+ `mappings.textobject` keys define "hunk range under cursor" textobject
404
+ which can be used in Operator-pending mode as target for operator (like
405
+ |d|, |y|, apply/reset hunks, etc.). It is also set up in Visual mode if
406
+ keys do not conflict with `mappings.apply` and `mappings.reset`.
407
+ "Hunk range" is used in a sense that contiguous (back-to-back) hunks are
408
+ considered as parts of a same hunk range.
409
+
410
+ `mappings.goto_first` / `mappings.goto_prev` / `mappings.goto_next` /
411
+ `mappings.goto_last` keys can be used to navigate to first / previous / next /
412
+ last hunk range in the current buffer.
413
+
414
+ # Options ~
415
+
416
+ `config.options` contains various customization options.
417
+
418
+ `options.algorithm` is a string defining which diff algorithm to use.
419
+ Default: "histogram". See |vim.text.diff()| (|vim.diff()| on Neovim<=0.11)
420
+ for possible values.
421
+
422
+ `options.indent_heuristic` is a boolean defining whether to use indent
423
+ heuristic for a (possibly) more naturally aligned hunks.
424
+ Default: `true`.
425
+
426
+ `options.linematch` is a number defining hunk size for which a second
427
+ stage diff is executed for a better aligned and more granular hunks.
428
+ Default: 60. See |vim.text.diff()| (|vim.diff()| on Neovim<=0.11) and |'diffopt'|
429
+ for more details.
430
+
431
+ `options.wrap_goto` is a boolean indicating whether to wrap around edges during
432
+ hunk navigation (with |MiniDiff.goto_hunk()| or `goto_*` mappings). Like if
433
+ cursor is after the last hunk, going "next" will put cursor on the first hunk.
434
+ Default: `false`.
435
+
436
+ ------------------------------------------------------------------------------
437
+ *MiniDiff.enable()*
438
+ `MiniDiff.enable`({buf_id})
439
+ Enable diff processing in buffer
440
+
441
+ Parameters ~
442
+ {buf_id} `(number)` Target buffer identifier. Default: 0 for current buffer.
443
+
444
+ ------------------------------------------------------------------------------
445
+ *MiniDiff.disable()*
446
+ `MiniDiff.disable`({buf_id})
447
+ Disable diff processing in buffer
448
+
449
+ Parameters ~
450
+ {buf_id} `(number)` Target buffer identifier. Default: 0 for current buffer.
451
+
452
+ ------------------------------------------------------------------------------
453
+ *MiniDiff.toggle()*
454
+ `MiniDiff.toggle`({buf_id})
455
+ Toggle diff processing in buffer
456
+
457
+ Enable if disabled, disable if enabled.
458
+
459
+ Parameters ~
460
+ {buf_id} `(number)` Target buffer identifier. Default: 0 for current buffer.
461
+
462
+ ------------------------------------------------------------------------------
463
+ *MiniDiff.toggle_overlay()*
464
+ `MiniDiff.toggle_overlay`({buf_id})
465
+ Toggle overlay view in buffer
466
+
467
+ Parameters ~
468
+ {buf_id} `(number)` Target buffer identifier. Default: 0 for current buffer.
469
+
470
+ ------------------------------------------------------------------------------
471
+ *MiniDiff.export()*
472
+ `MiniDiff.export`({format}, {opts})
473
+ Export hunks
474
+
475
+ Get and convert hunks from current/all buffers. Example of using it: >lua
476
+
477
+ -- Set quickfix list from all available hunks
478
+ vim.fn.setqflist(MiniDiff.export('qf'))
479
+ <
480
+ Parameters ~
481
+ {format} `(string)` Output format. Currently only `'qf'` value is supported.
482
+ {opts} `(table|nil)` Options. Possible fields:
483
+ - <scope> `(string)` - scope defining from which buffers to use hunks.
484
+ One of "all" (all enabled buffers) or "current".
485
+
486
+ Return ~
487
+ `(table)` Result of export. Depends on the `format`:
488
+ - If "qf", an array compatible with |setqflist()| and |setloclist()|.
489
+
490
+ ------------------------------------------------------------------------------
491
+ *MiniDiff.get_buf_data()*
492
+ `MiniDiff.get_buf_data`({buf_id})
493
+ Get buffer data
494
+
495
+ Parameters ~
496
+ {buf_id} `(number)` Target buffer identifier. Default: 0 for current buffer.
497
+
498
+ Return ~
499
+ `(table|nil)` Table with buffer diff data or `nil` if buffer is not enabled.
500
+ Table has the following fields:
501
+ - <config> `(table)` - config used for this particular buffer.
502
+ - <hunks> `(table)` - array of hunks. See |MiniDiff-hunk-specification|.
503
+ - <overlay> `(boolean)` - whether an overlay view is shown.
504
+ - <ref_text> `(string|nil)` - current value of reference text. Lines are
505
+ separated with newline character (`'\n'`). Can be `nil` indicating that
506
+ reference text was not yet set (for example, if source did not yet react).
507
+ - <summary> `(table)` - overall diff summary. See |MiniDiff-diff-summary|.
508
+
509
+ ------------------------------------------------------------------------------
510
+ *MiniDiff.set_ref_text()*
511
+ `MiniDiff.set_ref_text`({buf_id}, {text})
512
+ Set reference text for the buffer
513
+
514
+ Note: this will call |MiniDiff.enable()| for target buffer if it is not
515
+ already enabled.
516
+
517
+ Parameters ~
518
+ {buf_id} `(number)` Target buffer identifier. Default: 0 for current buffer.
519
+ {text} `(string|table)` New reference text. Either a string with `\n` used to
520
+ separate lines or array of lines. Use empty table to unset current
521
+ reference text (results into no hunks shown). Default: `{}`.
522
+ Note: newline character is appended at the end (if it is not there already)
523
+ for better diffs.
524
+
525
+ ------------------------------------------------------------------------------
526
+ *MiniDiff.gen_source*
527
+ `MiniDiff.gen_source`
528
+ Generate builtin sources
529
+
530
+ This is a table with function elements. Call to actually get source.
531
+ Examples: >lua
532
+
533
+ local diff = require('mini.diff')
534
+
535
+ -- Single `save` source
536
+ diff.setup({ source = diff.gen_source.save() })
537
+
538
+ -- Multiple sources (attempted to attach in order)
539
+ diff.setup({ source = { diff.gen_source.git(), diff.gen_source.save() } })
540
+ <
541
+ ------------------------------------------------------------------------------
542
+ *MiniDiff.gen_source.git()*
543
+ `MiniDiff.gen_source.git`()
544
+ Git source
545
+
546
+ Default source. Uses file text from Git index as reference. This results in:
547
+ - "Add" hunks represent text present in current buffer, but not in index.
548
+ - "Change" hunks represent modified text already present in index.
549
+ - "Delete" hunks represent text deleted from index.
550
+
551
+ Applying hunks means staging, a.k.a adding to index.
552
+ Notes:
553
+ - Requires Git version at least 2.38.0.
554
+ - There is no capability for unstaging hunks. Use full Git client for that.
555
+
556
+ Return ~
557
+ `(table)` Source. See |MiniDiff-source-specification|.
558
+
559
+ ------------------------------------------------------------------------------
560
+ *MiniDiff.gen_source.none()*
561
+ `MiniDiff.gen_source.none`()
562
+ "Do nothing" source
563
+
564
+ Allows buffers to be enabled while not setting any reference text.
565
+ Use this if the goal is to rely on manual |MiniDiff.set_ref_text()| calls.
566
+
567
+ Return ~
568
+ `(table)` Source. See |MiniDiff-source-specification|.
569
+
570
+ ------------------------------------------------------------------------------
571
+ *MiniDiff.gen_source.save()*
572
+ `MiniDiff.gen_source.save`()
573
+ Latest save source
574
+
575
+ Uses text at latest save as the reference. This results into diff showing
576
+ difference after the latest save.
577
+
578
+ Return ~
579
+ `(table)` Source. See |MiniDiff-source-specification|.
580
+
581
+ ------------------------------------------------------------------------------
582
+ *MiniDiff.do_hunks()*
583
+ `MiniDiff.do_hunks`({buf_id}, {action}, {opts})
584
+ Perform action on hunks in region
585
+
586
+ Compute hunks inside a target region (even for hunks only partially inside it)
587
+ and perform apply/reset/yank operation on them.
588
+
589
+ The "yank" action yanks all reference lines of target hunks into
590
+ a specified register (should be one of |registers|).
591
+
592
+ Notes:
593
+ - Whether hunk is inside a region is computed based on position of its
594
+ buffer lines.
595
+ - If "change" or "delete" is only partially inside a target region, all
596
+ reference lines are used in computed "intersection" hunk.
597
+
598
+ Used directly in `config.mappings.apply` and `config.mappings.reset`.
599
+ Usually there is no need to use this function manually.
600
+ See |MiniDiff.operator()| for how to set up a mapping for "yank".
601
+
602
+ Parameters ~
603
+ {buf_id} `(number)` Target buffer identifier. Default: 0 for current buffer.
604
+ {action} `(string)` One of "apply", "reset", "yank".
605
+ {opts} `(table|nil)` Options. Possible fields:
606
+ - <line_start> `(number)` - start line of the region. Default: 1.
607
+ - <line_end> `(number)` - start line of the region. Default: last buffer line.
608
+ - <register> `(string)` - register to yank reference lines into.
609
+ Default: |v:register|.
610
+
611
+ ------------------------------------------------------------------------------
612
+ *MiniDiff.goto_hunk()*
613
+ `MiniDiff.goto_hunk`({direction}, {opts})
614
+ Go to hunk range in current buffer
615
+
616
+ Parameters ~
617
+ {direction} `(string)` One of "first", "prev", "next", "last".
618
+ {opts} `(table|nil)` Options. A table with fields:
619
+ - <n_times> `(number)` - Number of times to advance. Default: |v:count1|.
620
+ - <line_start> `(number)` - Line number to start from for directions
621
+ "prev" and "next". Default: cursor line.
622
+ - <wrap> `(boolean)` - Whether to wrap around edges.
623
+ Default: `options.wrap` value of the config.
624
+
625
+ ------------------------------------------------------------------------------
626
+ *MiniDiff.operator()*
627
+ `MiniDiff.operator`({mode})
628
+ Perform action over region
629
+
630
+ Perform action over region defined by marks. Used in mappings.
631
+
632
+ Example of a mapping to yank reference lines of hunk range under cursor
633
+ (assuming default `config.mappings.textobject`): >lua
634
+
635
+ local rhs = function() return MiniDiff.operator('yank') .. 'gh' end
636
+ vim.keymap.set('n', 'ghy', rhs, { expr = true, remap = true })
637
+ <
638
+ Parameters ~
639
+ {mode} `(string)` One of "apply", "reset", "yank", or the ones used in |g@|.
640
+
641
+ ------------------------------------------------------------------------------
642
+ *MiniDiff.textobject()*
643
+ `MiniDiff.textobject`()
644
+ Select hunk range textobject
645
+
646
+ Selects all contiguous lines adjacent to cursor line which are in any (not
647
+ necessarily same) hunk (if cursor line itself is in hunk).
648
+ Used in default mappings.
649
+
650
+ ------------------------------------------------------------------------------
651
+ *MiniDiff.fail_attach()*
652
+ `MiniDiff.fail_attach`({buf_id})
653
+ Indicate source attach fail
654
+
655
+ Try to attach next source; if there is none - call |MiniDiff.disable()|.
656
+
657
+ Parameters ~
658
+ {buf_id} `(integer)` Buffer identifier for which attach has failed.
659
+
660
+
661
+ vim:tw=78:ts=8:noet:ft=help:norl: