vim-textobj-user
vim-textobj-user copied to clipboard
Matching a single newline results in unexpected behaviour
call textobj#user#plugin('newline', {
\ '-': {
\ 'pattern': '\n',
\ 'select': 'n',
\ },
\ })
Instead of matching a single newline like expected, this matches from the previous newline to the following newline. This persists even with the 'cursor' scan type. It seems to work when the cursor is somehow on the newline character (such as on blank lines).
This issue is specific to newlines. Changing the matched character to something else matches the single character like expected.
This arose when I was trying to match whitespace with:
call textobj#user#plugin('space', {
\ '-': {
\ 'pattern': '\S\zs\_s\+',
\ 'select': 's',
\ },
\ })
Which works as expected for every case except for single newlines.