-
-
Notifications
You must be signed in to change notification settings - Fork 358
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
Enhance f
to flash numerical labels for later ;
jumps
#160
Comments
Actually waiting for CursorHold before doing label cleanup would be dangerous. The user might start editing the buffer while it is in the labelled state! But there is an alternative I used in sexyscroller.vim. You can block Vim with many small sleeps in a loop, but break out for early cleanup if you detect the user has pressed a key, by checking |
Have you tried |
Yep, if I should implement jupm-to-first-match motions, maybe the Hm, but there are a lot of things we should consider before implement this feature, like how should we deal with bi-directional motions? Jump to next match? Have you tried Also, if you set I know there are a lot of cases you want to jump to first match immediately instead of waiting the EasyMotion labels, but for me, it's easy, comfortable, and intuitive enough to deal these cases with |
Thanks so much for your feedback and all your suggestions. There really are a lot of ways to use EasyMotion these days! I thought a bit more about what feature I really want, and reworded it: I want the same behaviour that the default I got excited and went and made a proof-of-concept! (I'm sure you know the feeling.) https://github.com/joeytwiddle/vim-easymotion - Helpful hinting for f,F,t, and T (search "hinting") It works quite ok for the next 1 to 9 matches, although right now I understand this is using EasyMotion in quite a different way from normal, but it is:
I'd love to know what you think of it so far, and if I should be working in different ways. I hope to finish off some of the TODOs in future...
|
f
jumps to first match, flashes numerical labels for other matches
f
jumps to first match, flashes numerical labels for other matchesf
to flashes numerical labels for later jumps (on ;
)
f
to flashes numerical labels for later jumps (on ;
)f
to flash numerical labels for later ;
jumps
Wow!!! It's amazing! It broaden my mind. I understood what you are trying to do. Your proof-of-concepts looks so promissing! 🍣 I'll look into it more deeply to improve it :) |
Thanks! ❤️ And may I say, EasyMotion is very awesome these days. So many features, and so well behaved! 🍧 |
https://github.com/Lokaltog/vim-easymotion/tree/feature-flash-motions I'll work on this branch for this flash-motions. Although the code definitely should be improved more, but it works better i think :)
|
consistent highlight
|
Options: imo, it should be better to set like this if you use flash-motions
|
Wow so fast. That's really great, thanks! Yes it works better. I am beginning to understand the code a little... ;)
I agree about the shading. I don't know if people might want a mixed shading mode (off for flashes but on for traditional EasyMotions). Possibly users will be happy with one mode all the time.
I thought of some more keys where flashing might be useful: Thanks a lot for the branch. I hope I can contribute some more in future... Some other advanced uses for hinting could be ... 😆 ... |
As well as moving in the correct (last set) direction, I would like |
I have pushed to my repository a fix for jump-to-first-when-flashing. (I did in I wonder if we should try to keep these mappings for |
Later in my branch I updated the README, and added count-flash mappings for Then in order for It might be desirable to have a call similar to I am unsure of your plans for |
I added |
I fix to work with As for |
I fixed it. I think all flash motions should be count sensitive. 848b34b |
Now, the dot repeat for flash motions works :) |
I'm considering the flash motions feature should be provided as a separate plugin, not as a easymotion's new feature. Because, the flash motions' feature is almost completely different from original ones and the code will be more and more messed up with the The flash motions feature is so awesome and I'm also so excited with developing this feature, but I don't want to merge it into easymotion's master branch, at least right now even though it works well. However, it's true that we needs the function which overwrite buffer text with the labels provided with easymotion and several functions. If you don't mind, I want to make another plugin like I'd want to know what you think, @joeytwiddle? |
I improved the code for the feature of jump-to-first match. If you are interested in, please see cb8e2d9 I'm sorry to delete your comment because now I used completely different method to implement jump-to-first match, but your detail comments really helps me a lot to understand what you are trying to do. Thanks ❤️ |
I'm sorry, 😭 I |
(partial commit is very useful but I messed up the orders of the commits... I should have be more careful...) |
Hi hajaybusa, nice work! I see you also fixed some bugs too. 👍 I didn't notice your I am very happy you have been changing my code to fit your plugin's style, and deleting my comments when they were no longer needed. The flash behaviour is the same as before, and better, so I cannot be sad!! 😃 About splitting into a separate plugin, that is your choice to make of course! Disadvantage: Many users may not try the new flashing feature if it is not in the core. Advantage: Code will be smaller and cleaner, for users who never wanted flashing anyway. (And I am interested how you would design it!) Either way, refactoring will be required, but that is also good; it will be useful for anyone else who wants to add features in the future. About Things that might be worth considering during future refactoring:
Anyway, what you have done so far is really great! 🍰 The branch is currently quite usable for me, so I will enjoy it. 😁 Thanks a lot, and please don't get assassinated by Logitech! 🐹 |
I think I implemented like you said. Isn't it the behavior you think? https://github.com/Lokaltog/vim-easymotion/blob/cb8e2d9c9ab3c923da8a385257e98348619768b4/autoload/EasyMotion.vim#L1205-L1210 |
I suppose this config should fix this inconsistentency. |
Yeah, maybe it's true... overwriting buffer text invoke the re-parse for syntax highlighting. I can use the I think it's fast with 2-key find motions like |
I totally agree with you. Actually, there are already a function (undocumented) for the users to customize the motions, but it's not good enough to open it as an API. https://github.com/Lokaltog/vim-easymotion/blob/master/autoload/EasyMotion.vim#L258 I'll improve it in the future. |
The idea of flash motions excited me! Thanks for the great suggestion! 👍 |
Gif config vimrc: https://gist.github.com/haya14busa/abffba810017c20bc9be |
My apologies, you are right, the cursor is at the target while the flashes are displaying. I was just confused by the initial delay in setting up the flashes on a slower machine. I have put a I tested switching Anyway things are fast enough for real-world usage. It's only slow when I test with a lot of matches (
Great! I wonder if that should default to the same value as
That is a nice trick, it fooled me hehe! 😉 I did wonder about the black areas ... but it didn't really bother me. |
(Sorry I should have started a separate issue for this!) To match Vim's usual I have achieved this using Vim's joeytwiddle@fccd317 on my (Note that the value of I could have put this on new I was worried that If you later implement a reverse |
Thanks! I'll look into it. I didn't know I also want to keep the current |
Hmm, |
If I separate this feature into another plugin, it's possible without these dirty hack. |
About plugin nameI'm looking for a better plugin name than |
I actually like your proposed name. But just to brainstorm, you could consider some permutations of the following words: For me, I am very happy using what we have come up with so far. I have not once thought "I should disable this annoying plugin" which is pretty unusual when trying a new Vim plugin! 😆 So creating a whole new plugin might be overkill. But perhaps you have lots of extra plans for flashing which would not fit well in the existing codebase. I think I might delay implementing flashes for |
Oh, really? 😄 Hm, I don't think it's bud name and I like it to some extent, but flash motions helps But maybe I'll work on this with this name, |
Thanks :) IMHO, there maybe are more people who likes this feature if you look into this sneak's issues justinmk/vim-sneak#88 Some of these suggestions mentioned in that issues is just the same as the flasmotions feature. |
Thanks for referencing this issue! I’ll definitely try that flash-motions plugin out! |
Hi @lydell. I have not tried If you want to try flash-motions now, it is on this branch (or my version). Just add the key mappings from the README section "Add helpful hinting". |
Here is another plugin that offers a similar feature. https://github.com/boucherm/ShowMotion "Tiny vim plugin to highlight landing places when moving with w,W,b,B" (and f,F,t,T) Edit: Oh it doesn't show numbers, just a block flash. And this one, just for f,F,t,T. It highlights the targets at all times. https://github.com/bradford-smith94/quick-scope |
Thanks for the info :) |
This issue becomes a bit outdated and I don't have any plan to work on this at least for now. sorry, i'll close it |
I would like to suggest an alternative to request #133 .
Add a multi-line search on
<Plug>(easymotion-flash-f)
that will immediately go to the first match, but will also _flash_ EasyMotion labels for all the other matches on the screen. (They could disappear on CursorHold event or after 150ms.) If the user realises they didn't want the first match, they will at least know what keys to press to get to the match they want. That should be very fast!In this case, it might feel more Vim-like to use numerical labels. I am currently using fanfingtastic (multi-line f,t,F,T) so for me a good flow would be:
fX
jumps straight to the next 'X' character, but flashes red numbers over all the other 'X's on screen5;
would jump to the 5th next match, the one that EasyMotion labelled with a 5.But you may have your own idea about the keys. I would accept anything with a small number of keystrokes!
I would be quite happy if matches in the opposite direction were also labelled. (To feel like ftFT, I would bind a key so these could be reached with
5,
)The reason I want this is:
f
orF
.This is a slight re-thinking of EasyMotion, as a hinter during normal Vim usage, rather than something we specifically request. (But I would only use this for Normal and Visual modes, and keep the other EasyMotion features for operator-pending mode.)
Arguably this feature belongs in one of the f-enhancement plugins, but I am looking at EasyMotion because it already has the complicated code for labelling!
On a related note, here is a little experiment I am trying in flashing/suggesting, as an alternative for (easymotion-j) and (easymotion-k)
Is there any bidirectional alternative to (easymotion-j/k)? It seems I have to decide whether I am going up or down, so I have to think about my cursor position. It might be nicer if EasyMotion could just label all the lines on screen (starting with those nearby, or near the middle).
The text was updated successfully, but these errors were encountered: