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
Add a simple amp-like jump command #8875
Conversation
88c2975
to
1e48615
Compare
1e48615
to
635fa5a
Compare
635fa5a
to
cc66db3
Compare
I was testing it and I didn't see any issue so far on the current implementation. Nice work. I have a question, would it be possible to work in all visible buffers? So we could go to a word in another split window? |
I have been testing it and it works brilliantly, thanks! |
Should the default value for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me but I'm not a jump mode user. I'd be interested in @semin-park's feedback as the original PR owner
We generally don't try to tailor our keymap to qwerty (many people use different keymaps). Using the alphabet is a pretty reasonal default IMO. I have set the setting to my (colmak) homerow plus some keys that are easily reachabke. What exactly those are is highly individual. |
Alphabet is certainly a good default, but having a config option to prefer the home row keys of QUERTY / Colmeak / Dvorak would be next level awesome :)
How is this possible? Cheers! |
just add this to your config (under editor, its also documented in this PR): jump-label-alphabet = "eirsaotndhfuywgm(cplbjvkx)z_" That example is for my personal layout (colmak) where brackets and underscore are on the base layer. Basically the letters that come first are used first so |
@pascalkuthe You are amazing, you thought of everything. Sorry I didn't see that in the PR and wasted your time. |
Doesn't having |
hjkl is a historical artifact, not intentional bias towards qwerty |
@qwerty01 I think the recommendation for that is to just use search ( |
|
Well you could also type characters before and/or after the brace you're trying to jump to when using |
Oh quick aside, found an issue when scrolling while jump mode is active, only the visible screen at the time of enabling jump mode gives jump options, so if you scroll while jump mode is active, there aren't more options to jump: Also probably a use case that won't come up often but figured I'd mention it. EDIT: The limits are explicitly set on line 5882 and 5896, removing them doesn't cause any noticeable performance issues, but still leaves large files mostly unmarked since we run out of jump labels. EDIT2: Mistyping a jump code can lead to jumping off the screen if it corresponds to a location that was marked off the screen, so it might be best if the current functionality is kept, or maybe exiting jump mode on scroll would be better. |
Yeah, I think we should clear the jump labels / exit jumping mode when the viewport changes (scrolling, resizing, etc.). It's only meant to jump to locations that are visible/in-view.
Currently it's a regular motion so like |
cc66db3
to
82622b9
Compare
yeah I fixed this by simply dismissing any pending (or pseudo pending) keys whenever a mouse button is pressed (also during bracketed paste). I think mouse buttons behaving the same as other keys in that regard just makes sense. I think this will fix quite a few similar bugs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs are clear and the feature works great! (Just did my first build to test this out)
EDIT: After using it for a bit I get why it's like that, this is better than what I expected! And thanks to trying to respond to a reply I've also answered my own concern about the colour support.
Is it intended to put the cursor at the end of the word you jump to and select the whole word? If so, working great!
Jumping in only after skimming (and not being familiar with amp) that's not what I expected (coming from EasyMotion in VSCode with vim bindings). I could see why you'd often want to act on the word you just jumped to so I can see the logic behind that behaviour!
Just have one comment/question about themes below
I noticed that, unlike |
It does in visual Mode just not on normal mode. It's intentional. |
Got it, but what is the reasoning for this? |
See my comment above: #8875 (comment) It matches the LSP location jumping features |
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
Thank you for this feature! It's working great 😄 Just a quick question -- Is it possible to "add" a selection to the word I am jumping to? Without extending the current selection as in visual mode, i.e., an easy way to add multiple cursors. |
There's some discussion about that above: #8875 (comment) |
It's likely that your theme doesn't define the To verify that this is indeed the issue, check that the labels in To fix, make sure your theme defines it by either creating and using a local one or opening a PR. |
That was it thank you |
Closes #274
Closes #510
Closes #5340
This is a simple amp-like jumpmode that @the-mikedavis and I have been toying around with for a while. When discussing/starting to review #5340 we found the PR more complex than we would like for this feature (a diff above 1k loc). We were uncomfortable with how closely it follows hop and the subsequent debate about emulating the million other jumpmode plugins out there. There are many different approaches to jump commands, and we cannot maintain them all in core. Instead, we want to pick a single opinionated choice that we feel fits well with the rest of the editor.
While testing that PR we made the following observations:
f
for simple cases and/
(which we want to improve further) for complex cases. Compared to a jumpmode these commands work with multicursors.Based on these observations we decided to mostly follow amps implementation. This PR also has a more correct implementation fixing issues I found with the original PR (labels would appear on single char words, punction and would include leading whitespace, ..).
This PR contains a cherry pick from #6417, depending on which PR is merged first I will rebase the other PR and drop that commit