Skip to content

Commit 98aad5f

Browse files
committed
chore(docs): added disclaimer
1 parent 3cb7b91 commit 98aad5f

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

README.md

+34
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,40 @@ Give your right-pinky a workout and install `cursor-text-objects.nvim` today!
9595
```
9696

9797

98+
# Disclaimer
99+
The default recommended mappings, `[` and `]`, will not conflict with existing
100+
mappings. There's [a test
101+
script](https://gist.github.com/ColinKennedy/7e632f88570be89762b0ca8372769b72)
102+
that verifies this.
103+
104+
However if you have another mapping like this:
105+
106+
`vim.keymap.set({'n', 'x', 'o'}, '[i', function() return "dd" end,
107+
{expr=true})`
108+
109+
then you may be surprised that `d[ip` does not work.
110+
111+
In short while actually this is not a conflict, it can still be confusing for
112+
a you and you'll want to remap `cursor-text-objects` or that other mapping
113+
/ plug-in to avoid the issue.
114+
115+
<details>
116+
<summary>More details on what is going on in this case</summary>
117+
118+
`cursor-text-objects` is a pending operator but the mapping above is a regular
119+
operator. A pending operator is a mapping that "waits for the user to keep
120+
typing more keys" but a regular operator executes immediately. So if you only
121+
have `cursor-text-objects` applied, `ip` is interpreted as "[i]nside
122+
[p]aragraph". But with the mapping above, `d[i` executes immediately and then
123+
treats `p` as the start of a new command. And `p` as a standalone keymap means
124+
[p]ut. (See `:help put` for details).
125+
126+
So again this is all expected behavior but if you don't want that to happen,
127+
you're better off remapping `[i` to something else.
128+
129+
</details>
130+
131+
98132
# Tests
99133
## Initialization
100134
Run this line once before calling any `busted` command

0 commit comments

Comments
 (0)