vim-textobj-user
vim-textobj-user copied to clipboard
Support `move-[nNpP]` when patterns is a list
This patch allows move-n
etc. to work when a textobject is defined using a list with separate start and end patterns. Without this fix, an error is generated when the keybind is pressed for moving between these objects.
Thank you for the patch. I'll update tests and the document, then merge this patch.
I thought at first your patch looks good, but there is a problem. If a text object is defined by a list "pattern", that text object can be nested like HTML tags. Your patch doesn't correctly handle nested objects.
Suppose that a text object is defined by ['<<', '>>']
, and the current buffer contains the following text:
AAA <<BBB <<CCC>> DDD>> EEE
Doing move-N
at the first column should move the cursor to the end of DDD>>
, but, with your patch, the cursor is moved to the end of CCC>>
.
Ah, drat. I should have thought of that, but I only tested it in my own use case. Sorry to waste your time!