tpope / vim-unimpaired

unimpaired.vim: Pairs of handy bracket mappings
https://www.vim.org/scripts/script.php?script_id=1590
3.31k stars 205 forks source link

[Suggestion] `[e` and `]e` visual selection take count according to cursor position #216

Closed bruhtus closed 3 years ago

bruhtus commented 3 years ago

I have noticed some inconsistency when using [e and ]e in visual selection. When I select from bottom to top (using visual line command), which make the cursor on the first selection, it take count similar to what relativenumber displayed. But, when I select from top to bottom (using visual line command), which make the cursor on the last selection, it didn't take count similar to what relativenumber displayed.

My suspect is [e and ]e take the first selection line for the count instead of the current cursor line. So, is it posible to take the current cursor line instead of the first selection line?

Thank you.

tpope commented 3 years ago

3]e means "move the selection" 3 lines down, not "move the selection to the 'relativenumber' 3 line". It sounds to me like what you are proposing is that if I have 5 lines selected, with the cursor up top, and input 3]e, it shouldn't do anything, because the 3 is inside the selection. That seems silly to me.

bruhtus commented 3 years ago

3]e means "move the selection" 3 lines down, not "move the selection to the 'relativenumber' 3 line".

So, I can't depend on what 'relativenumber' displayed then? Ok, thanks for clarifying that.

if I have 5 lines selected, with the cursor up top, and input 3]e, it shouldn't do anything, because the 3 is inside the selection.

Yeah you're right, I usually use 'relativenumber' as reference for count so I didn't realize that.