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

$ (move to end of line) then % (match parentheses) not working properly in visual mode #2304

Closed
liujoey opened this issue Jul 10, 2015 · 5 comments
Labels

Comments

@liujoey
Copy link
Contributor

liujoey commented Jul 10, 2015

Say we have code like this:

public void foo(String bar) {
    blabla();
}

My cursor is at char 'f' of the function name 'foo', a quick way to select the whole function will be Shift-v to enter Visual-Line mode to select the first line, then press $ move cursor to the end of the line, then press % to match the close brace. This Shift-v $ % sequence works perfectly in Vim, but not in Evil.
When in Evil visual mode, if you press $, the cursor moves one char further than the last char of '{', just as same as it does in Vim, but then % does nothing. In Vim even the cursor is one char right to the last char, % can still jump to the close curly brace. But in Evil, I have to press h key once, move my cursor one char back to make % to work. I've also submitted an issue on Evil's issue tracking site. This bugs me a lot because my muscle memory is so strong about this one.

@sooheon
Copy link

sooheon commented Jul 11, 2015

Definitely an issue for evil, not spacemacs. I understand the frustration though. Until you get an answer from there, you could learn the spacemacs way, which would be (starting from the same place) $ SPC v, which is the same number of commands and even easier imo. Part of the reason for spacemacs is so you can learn hybrid ways to do things, so experiment :)

@TheBB
Copy link
Collaborator

TheBB commented Jul 11, 2015

Another workaround is to do things in visual state first (where in my experience % works fine), and then later use V to enter visual line state from visual state.

@liujoey
Copy link
Contributor Author

liujoey commented Jul 13, 2015

@sooheon Thanks, but SPC v only selects function body inside the braces, not including the function name.

@TheBB even in normal visual mode, $ still move one char beyond the end of the line which makes % not working. I currently learnt this sequence $ Shift-v % which works fine. Just need to fracture my muscle a little bit :-)

@StreakyCobra
Copy link
Contributor

I can't reproduce the bug anymore. @liujoey Is this still the case for you?

@liujoey
Copy link
Contributor Author

liujoey commented Nov 6, 2015

@StreakyCobra The bug is gone, I guess the recent evil updates fixed this issue.

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

No branches or pull requests

4 participants