-
Notifications
You must be signed in to change notification settings - Fork 89
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
Thoughts on the let g:sneak#streak = 1 feature #88
Comments
Good thoughts! I think you are on the right track. I've been trying to solve this, but didn't consider that workflow. I think it's a good compromise. |
i come up with this set of labels which i feel very much fit my needs. |
A really transparent way of solving my workflow could be not to use sneak streak at all, but number each highlighted match (like sneak streak puts labels on each). Then I could simply hit like 8; (or 26; in worse cases) to get to the match I want really quickly. |
@liujoey Those are good defaults ( @lydell That's a good idea, but display of number labels >9 is tricky if there are adjacent matches: But, I'm definitely going to experiment with the idea of "trigger key" to invoke streak-mode immediately after a sneak. In fact, this is probably already possible after this commit. |
@lydell Just tested, it works (be sure to update, I fixed a small bug with
Instead of |
Cool! :) There is one problem, though: If I used a backwards sneak, backwards streak mode should be invoked. (And one thing is missing: The labels do not show up until I press the trigger key. But you did say that it is a basic implementation.) About adjacent numbers and hints:
|
@lydell Yeah, it's not perfect. It also doesn't work with repeat-operation. But I'm going to try it for a few days to see how it feels. I will add first-class support ASAP.
Not often. Here's a lot more discussion: easymotion/vim-easymotion#47
With Numbers could solve some problems. One new problem though: since the the cursor will go to the first match, the numbers wouldn't help with operations like |
well, i'm not a heavy |
@lydell FYI, in order for the test mapping above to work for 2-char sneak, clever-s needs to be disabled:
|
No problem, I already had it disabled ;) |
I think the initial solution proposed by lydell in this thread is a great idea! In its current incarnation I think the streak mode is kinda broken. I came here after just checking trying it briefly because I knew I would face the same issues as lydell. The biggest problem in my opinion is that the predictability of sneak is ruined. You never know if pressing an editor command will take you to another match or do as you expect. I don't think the number solution is as good. After the first nine matches is ends up taking an extra keypress. I'm excited to see what is going to happen with this issue :) Till a solution is found I'll just enjoy vim-sneak as better alternative to vim-seek. |
Just to give a different perspective . . . I write prose every day and love and use streak mode exclusively. More than 90% of the time I don't want the first match. I would prefer NOT to have to press a special key before jumping, although I understand the arguments being made. I hope that remains an option. I am thinking about implementing liujoey's idea (without the 'g' which I use frequently). Good idea. m |
@mon10a It will definitely remain an option, possibly remain default. |
I just updated and see that highlighting now remains ON after jumping to a thanks -- this plugin (and Unite) really make Vim a pleasure to use. m On Tue, Apr 1, 2014 at 6:34 PM, justinmk [email protected] wrote:
|
@mon10a Would you mind creating an issue? I think that behavior is a side-effect of trying to gracefully handle |
sure, thanks m On Tue, Apr 1, 2014 at 7:03 PM, justinmk [email protected] wrote:
|
Hi, I opened an issue last night (#98, I think), but it has not shown up in the Regards. m On Tue, Apr 1, 2014 at 7:03 PM, justinmk [email protected] wrote:
|
@mon10a I got it, should be fixed soon. Github does some weird caching on the list, I bet if you refresh it will appear. |
@lydell If you pull the activate_or_fallthrough branch you can try this out. The "activation" key to activate the target labels is whatever you have mapped to I have been using this for more than a week. Contrary to my expectations, I found it to be more trouble than it saved. But since you never have used streak-mode, maybe you won't find it as jarring. Can you try it out? I think there are other ways to address the original issue:
|
I finally got time to try it out today. Some thoughts after using it for a few minutes:
But I’ll have to try it out for some time to know for sure.
What do you mean? As I mentioned in my first post “I decided to give the let g:sneak#streak = 1 feature a try.” I had it on for a couple of weeks. Then I opened this issue with my experiences. |
@lydell I didn't word that very well, but I just meant you might have less permanent habits. I usually am able to adapt, but somehow this feature was very awkward to me. |
I’ve tried this for a while now. Some things I’ve found:
The feature feels awkward to me, too, now. I’ve come to the conclusion that g:sneak#streak = 1 is nothing for me. I’m currently trying the following out: nmap <silent> <expr> <tab> sneak#is_sneaking() ? '<Plug>(SneakStreak)<cr>' : '<Plug>Sneak_s' I just wish that pressing tab when |
@lydell Thanks for trying it and sharing your thoughts. That mapping is very cool!
I could make it an option, but would like to know the use case(s). Only reason I can think of: the next match is off-screen, and you want to label only the currently on-screen matches. |
I understand why
|
Good points. There are several ideas now that I am enthusiastic about. Hope to work on this in the next week or two. |
Showcase is over, now there is a separate function which does a little more than just entering streak every time. All dirty hacks are reverted, so you can now check out my fork without loosing the sneak functionality. @justinmk: in visual mode it does some weird stuff. I couldn't figure out why. Maybe you know better. You will find a lot of familiar code in the function. It would be great if you would look at it some time. |
@notEvil Just to check, you are aware of |
I had a thorough look at the code when I wrote the function, so yes, I'm aware of
=> after sneak is finished it enters streak mode only if there are at least 2 matches left, no matter whether a:streak is 2 (forced streak) or just 1. Maybe you mixed up the brackets. In any case sneak's and therefore also streak's search direction is fixed, and streak is an addon for sneak which, by the users perception, is entered unpredictably. So my function does something very different to Edit: found and fixed mistake. +update. now it works perfectly and has extra features |
I’ve used this mapping for a while now:
Should Either way, I think the |
Seems like I actually do, after all, but for a different reason. |
first of all, interesting way to use sneak/streak :) |
@lydell I could expose the state ( |
@lydell How about if
|
That would work. But if you need to add something anyways, why not just add the possibility to enter streak mode without moving? Doesn’t really matter to me in the end, though. |
I'm trying to avoid creating a ton of specialized |
It could be an option like |
Oh, you want to turn it off completely? Else, how would we know when to save the jump and when not to? |
I want to use vanilla sneak, which means I can use ; and , to explore of trail of matches, and then use c-o to return to the initial location. If there are lots of matches, though, using ; and , isn’t effective. That’s why the How this is implemented doesn’t matter to me—built into sneak as an option (in case there are more people like me for whom the |
I think that if a sneak (any kind of sneak) is invoked while already sneaking, then that sneak shouldn’t add to the jump list. I think that makes sense for all users. |
I like it. Easy to implement too. Gimme a minute. |
@lydell Done. Thanks. |
Nice! Then the only missing piece is exposing the current sneak direction. |
The conclusion here is that the Thanks for all the time and work in this issue! :) |
@lydell I'm actually 99% convinced of several tweaks for
|
Sounds awesome!
Sounds like a good idea to me (although I won't use it). Just make sure that the minimal set is only uses when streak is automatically invoked, not manually. |
AFAICT everything here worth implementing, was implemented. |
I’ve been using vim-sneak for a while, and I really like it! Most of the time it takes me exactly where I want to go really fast.
Every now and then, though, I choose two particularly bad characters to sneak for, and the screen gets all magenta. Suddenly my target might be like 10 ; away (but I cannot be sure that it’s exactly 10, so usually I find myself spamming ; instead of doing 10;). In those cases I either try to find a less common pair of characters close to my original target to sneak for those, or I use some other motion to get a bit closer and then sneak again.
A few weeks ago, I decided to give the let g:sneak#streak = 1 feature a try. My first impression was “Wow, this is brilliant!” when one of those “screen got all magenta” scenarios happened. Suddenly my target was just a single keystroke (the label character) away. It felt like it really sped me up—without changing the sneak experience I’ve gotten used to at all (except that the highlighted matches now are covered with some letter and a space, but that doesn’t matter since I know what I sneaked for).
However, after some time I realized that this option actually slowed me down. Many times a sneak gets many results, but I actually want to go to the first result. Then I usually want to edit the text at that point, for example by typing a or cw. But 'a' and 'c' are likely a label to jump to another match! It’s really annoying to press a to append some text after the cursor, but instead be taken to some other place! That caused my to press Esc after most sneaks, increasing the number of keystrokes!
I’ve thought about changing the labels, so they won’t likely collide with other commands, but I can’t come up with such a set.
So what first seemed to be a really convenient option did not work out very well in the end. Now I have disabled the option and bound SneakStreak to its own key.
However, I still turn the screen all magenta every now and then. Now, I usually re-perform my sneak using my SneakStreak key followed by enter instead. That works pretty good ... but it feels like we could do better, just like the let g:sneak#streak = 1 option tries to.
What about the following? If there are more than two matches, give labels to every match. But don’t go to the match if the label is typed: Make every key work just as normal instead. If I do want to follow a label, I have to press my SneakStreak key first. This is how I’m thinking:
I sneak for something. Then one of three things usually happen:
The text was updated successfully, but these errors were encountered: