Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling startpos == endpos (a.k.a an empty selection, not 0) #36

Open
norcalli opened this issue Aug 1, 2014 · 3 comments
Open

Handling startpos == endpos (a.k.a an empty selection, not 0) #36

norcalli opened this issue Aug 1, 2014 · 3 comments

Comments

@norcalli
Copy link

norcalli commented Aug 1, 2014

If you highlight the left bracket in hello [] and type ci[, the inside of the brackets will be selected to start replacing which is the default text object. As far as I can tell, there is no way of indicating this behavior using the plugin. Is there something I missed, or should I look to try to modify textobj-user, and if so, do you have a suggestion where to start?

@kana
Copy link
Owner

kana commented Aug 2, 2014

There is no way to target an empty region in Vim script, as far as I know. So that you have to make a patch to Vim to provide this functionality before tweaking vim-textobj-user.

@kana
Copy link
Owner

kana commented Aug 2, 2014

Additionally, if you specify the same position for both start and end positions, it means a region which consists of only one character, not an empty region.

@kana
Copy link
Owner

kana commented Aug 3, 2014

Theoretically, it seems to be possible to target an empty region by selecting a character in Visual mode with 'selection' = exclusive. But Vim behaves as if this selection is inclusive, so that it targets the character instead of an empty region. This behavior is inconsistent with the description of :help 'selection'. It might be a bug, but it might be an intentional behavior for backward compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants