Closed Somelauw closed 8 years ago
Thanks for the contribution! Unfortunately, your modification to the regex reintroduces the problem I fixed in vim/vim/pull/842. Could you sort that out? Also, I'm not quite sure what you mean by
]m and [m end on function definition (first non-whitespace char)
What behaviour is changed, and what problem does it solve?
Thanks for the contribution! Unfortunately, your modification to the regex reintroduces the problem I fixed in vim/vim#842. Could you sort that out?
I had originally based my code on an older version and overlooked this change. I will reintroduce it.
What behaviour is changed, and what problem does it solve?
The problem I was trying to solve, is that when doing the ]m and [m it doesn't position the cursor like this:
| def
But like this:
|def
Except that when I just tried your code it didn't behave that way. I am not yet sure why though. The regexes for ]m and [m start with a greedy whitespace match, so I don't get why your jump wouldn't end on a whitespace.
Huh. Good question, I'm now puzzling over that myself. I'm not a regex wizard, and I only added two characters to the end of that particular one, I didn't write it.
When you enter the regex manually it lands on the first whitespace character, so it must be in the function somewhere, rather than the regex itself.
However, when you do :silent! exe '/^\s*\(class\|def\)\>'<cr>
, it lands on the d or c... interesting.
Skips the whitespace if you do :/^\s*\(class\|def\)\>``<cr>
as well. Very odd.
I have readded your modification in https://github.com/vim/vim/pull/842
Thanks! I'll send that off to Bram.
Add xmap mappings Disable search wraparound (at least for visual mode this makes little sense) Use search() function Use perl regex Replace tabs by spaces ]m and [m end on function definition (first non-whitespace char)
Thanks to strull and Ellesarddan on #vim on freenode for their help on this pull request.