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

Make f iterate through search results if pressed immediatly after use #41

Closed
toomey8 opened this issue Dec 28, 2013 · 10 comments
Closed

Comments

@toomey8
Copy link

toomey8 commented Dec 28, 2013

Wow. This is a fantastic plugin.

One feature I would really love is the way 'f' is used to repeat immediately after a motion, a la rhysd/clever-f.vim, especially because I've remapped ; to : in normal mode to make entering commands 50% easier.

Arguments for this:

  • the chance that I want to do a second character sneak immediately after completing one seem small
  • the f key is index finger, and much more agile for me than the pinky or ring finger
  • frees up ; (with a recommendation to remap :, making command mode more accessible)

Would this be possible? Maybe crib from clever-f?

@justinmk
Copy link
Owner

Hmmm. It should be possible, but might be a few weeks before I get to it.

@toomey8
Copy link
Author

toomey8 commented Dec 29, 2013

Thanks!

@justinmk
Copy link
Owner

I'm starting to want this feature too :) Since you are familiar with clever-f, does it have a way to repeat the search after doing other things? Or repeat only works immediately after invoking f?

@justinmk justinmk mentioned this issue Jan 26, 2014
@toomey8
Copy link
Author

toomey8 commented Jan 26, 2014

Thanks for your response and help!

As I understand it, cleverf only works immediately post f, and it doesn't work with . to repeat on either vanilla . or with tpope repeat.

I would see this working in its simplest form as:

  • If one invoked SneakForward or SneakBackward immediately after the 2 key identifier sequence then you would invoke SneakNext.
  • Else / If there were any intervening keys, it would invoke a fresh Sneak(Forward|Backward) 2 key prompt.

At a deeper level though, I wonder if we are close to a more elegant combination of single key f and Sneak which combines short and medium motion jumps intuitively and flexibly.

Potential Option - Iterative combination of F and Sneak

  • SneakForward to invoke

Then:

  • b jumps to next b

Then:

  • esc resets SneakForward, you are in normal mode

OR:

  • u jumps to next bu

Then:

  • SneakForward jumps to 2nd bu
  • SneakForward jumps to 3rd bu
  • ...

Else:

  • Any key but SneakForward resets, you are in normal mode

The plusses of this would be:

  • retain most of the functionality of both the standard (or clever) f key
  • esc is mapped so accessibly for me it barely counts as an extra keystroke, so vanilla f mostly works
  • has an iterative approach that makes intuitive sense to me:
    • can i get there with one letter (if yes, ok, great. we're done. esc)
    • no, ok, let me add a second letter
    • no, ok let me easily jump to next instance of the same 2 letter sequence by sneaking again with SneakForward key

This should mean that I can get anywhere +/- a few lines with just a few keystrokes (<5?) AND have to use only one key instead of F/f/S/s.

Not sure if this second idea is fully baked, but I think it would have great flexibility.

Other than the trouble of coding it, which might be huge and would be more than I can handle to be sure, I can't see a downside to just hitting esc if I realize that one letter got me where I wanted), and love the idea of doing this all with one key, plus not needing ;.

Again, thanks so much for your help. Moving medium distances in Vim is something I do a thousand times a day in Vim, so trying to make that nicer is a real gift.

@toomey8 toomey8 closed this as completed Jan 26, 2014
@toomey8 toomey8 reopened this Jan 26, 2014
justinmk added a commit that referenced this issue Jan 29, 2014
As always, if you have mapped to something other
than s/S, it will work as intended.
@justinmk
Copy link
Owner

FYI, this is mostly implemented, possibly broken, in https://github.com/justinmk/vim-sneak/tree/experiment-clever_s

Not that you should waste your time trying out that branch, but just to update you. I think I like the feature, thanks for suggesting it! It works with counts too, so 5s goes to the fifth match. Furthermore, since s<Enter> repeats the last search, the need for ; and , is even more reduced.

But it is failing a few tests and I need to update the documentation and tie up some other things.

Regarding your second idea:

can i get there with one letter (if yes, ok, great. we're done. esc)
no, ok, let me add a second letter

I wouldn't be opposed to this except it kind of breaks streak-mode, because it potentially moves the window (if the first character has an off-screen match), which changes the potential targets. Even if you don't use streak-mode, I think it might be too "spammy", because it will match much more often than two letters, which means the first character will often move the window if there is off-screen text.

@toomey8
Copy link
Author

toomey8 commented Jan 29, 2014

Coo, thanks!

Is there an easy way to do branches with Vundle? If not I need to like actually learn GIT, which, obviously I know I am on github right now.

Yeah, I see your point. I think clever-f functionality + sneak might be great. I'll play with it more and let you know what I think.

Incidentally, I had 's' taken by fold/unfold so I mapped this to option S, and really like the ergonomics.

@justinmk
Copy link
Owner

Vundle infamously does not support "pinning" to a branch. VundleVim/Vundle.vim#35

But, the feature should be in master by next week...

@toomey8
Copy link
Author

toomey8 commented Jan 29, 2014

ahh, thanks! I suspected that.

All the best,

Brian


Brian Toomey

phone: 660.243.0784

skype: toomey8

32 Upper Knight St
Keene, NH 03431

On Wed, Jan 29, 2014 at 9:48 AM, justinmk notifications@github.com wrote:

Vundle infamously does not support "pinning" to a branch. VundleVim/Vundle.vim#35VundleVim/Vundle.vim#35

But, the feature should be in master by next week...

Reply to this email directly or view it on GitHubhttps://github.com//issues/41#issuecomment-33590415
.

@justinmk
Copy link
Owner

Let me know how it goes...

@justinmk
Copy link
Owner

@toomey8 FYI, this feature is disabled by default now, because it is too surprising for new users. You can enable it like so:

let g:sneak#s_next = 1

Sorry for the inconvenience.

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

No branches or pull requests

2 participants