Skip to content

Commit 66d3cf7

Browse files
committed
fix(operators): better document and test gx remapping to gX
1 parent b05a36c commit 66d3cf7

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

doc/mini-operators.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ Default values:
186186

187187
-- Exchange text regions
188188
exchange = {
189+
-- NOTE: Default `gx` is remapped to `gX`
189190
prefix = 'gx',
190191

191192
-- Whether to reindent new text to match previous indent
@@ -202,6 +203,7 @@ Default values:
202203

203204
-- Replace text with register
204205
replace = {
206+
-- NOTE: Default `gr*` LSP mappings are removed
205207
prefix = 'gr',
206208

207209
-- Whether to reindent new text to match previous indent

lua/mini/operators.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ MiniOperators.config = {
284284

285285
-- Exchange text regions
286286
exchange = {
287+
-- NOTE: Default `gx` is remapped to `gX`
287288
prefix = 'gx',
288289

289290
-- Whether to reindent new text to match previous indent
@@ -300,6 +301,7 @@ MiniOperators.config = {
300301

301302
-- Replace text with register
302303
replace = {
304+
-- NOTE: Default `gr*` LSP mappings are removed
303305
prefix = 'gr',
304306

305307
-- Whether to reindent new text to match previous indent

readmes/mini-operators.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ Here are code snippets for some common installation methods (use only one):
158158

159159
-- Exchange text regions
160160
exchange = {
161+
-- NOTE: Default `gx` is remapped to `gX`
161162
prefix = 'gx',
162163

163164
-- Whether to reindent new text to match previous indent
@@ -174,6 +175,7 @@ Here are code snippets for some common installation methods (use only one):
174175

175176
-- Replace text with register
176177
replace = {
178+
-- NOTE: Default `gr*` LSP mappings are removed
177179
prefix = 'gr',
178180

179181
-- Whether to reindent new text to match previous indent

tests/test_operators.lua

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,18 @@ T['setup()']['remaps built-in `gx` mappings'] = function()
150150
validate('vgX', 2)
151151

152152
-- Should remap only built-in `gx`
153+
child.lua('vim.keymap.del({ "n", "x" }, "gX")')
153154
child.lua('vim.keymap.set({ "n", "x" }, "gx", function() _G.n = _G.n + 5 end)')
154155
child.lua('MiniOperators.setup()')
155-
validate('gX', 3)
156-
validate('vgX', 4)
156+
validate('gX', 2)
157+
validate('vgX', 2)
157158

158159
-- Should not override already present mapping
160+
child.lua('vim.keymap.set({ "n", "x" }, "gx", function() _G.n = _G.n + 5 end, { desc = "URI under cursor" })')
159161
child.lua('vim.keymap.set({ "n", "x" }, "gX", function() _G.n = _G.n + 10 end)')
160162
child.lua('MiniOperators.setup()')
161-
validate('gX', 14)
162-
validate('vgX', 24)
163+
validate('gX', 12)
164+
validate('vgX', 22)
163165
end
164166

165167
T['evaluate()'] = new_set()

0 commit comments

Comments
 (0)