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

Visual indent leaves cursor at incorrect location #183

Closed
jordwalke opened this issue Apr 5, 2013 · 5 comments
Closed

Visual indent leaves cursor at incorrect location #183

jordwalke opened this issue Apr 5, 2013 · 5 comments
Assignees

Comments

@jordwalke
Copy link

Insert:

one
two
three

Place your cursor in normal mode on the three. Press V for linewise visual mode. Move up to the one to select all three lines. Then press >. Your cursor should remain at the top on line one - this is what vim does. The current cursor behavior of jumping back down messes up the repeat command.

I notice that when selecting from the top down, and shifting with >, everything works.

The Vim behavior seems to be: Always leave the cursor at the topmost part of the selection, regardless of where the selection began. Strange but works well and is engrained into my muscle memory.

@guillermooo
Copy link
Owner

It seems Vim normalizes motions to always be top-down. That makes sense. This one looks like a big feature.

BTW, if you try repeating in line 'three', you do get the expecter result, right?

@guillermooo
Copy link
Owner

Potential fix:

  • tag all downward motions

The first run of a command including downward motions would run normally. When repeating, we'd include an 'is_repeating' flag so 'vi_run' knows it must reverse the motion. I suppose that means we'd need to define antonyms for each downward motion too. This should work for visual line mode; not so sure about visual mode.

@guillermooo
Copy link
Owner

Then again, I haven't double-checked with Vim wether the reversal occurs in every mode. I suspect it might be only in visual line mode, which would be geat news.

@jordwalke
Copy link
Author

I believe that if I try repeating at line three it does the correct thing (but I have to move my cursor there - it doesn't even remain at three when selecting bottom up - indenting moves my cursor down one extra line oddly)

@ghost ghost assigned guillermooo May 25, 2013
@guillermooo
Copy link
Owner

This one seems pretty tough to solve. I need to think longer about how to reverse the motion's direction when repeating commands.

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

No branches or pull requests

2 participants