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

Discussion: labeled f/t #116

Open
mikeslattery opened this issue Jan 11, 2022 · 11 comments
Open

Discussion: labeled f/t #116

mikeslattery opened this issue Jan 11, 2022 · 11 comments
Labels
enhancement New feature or request

Comments

@mikeslattery
Copy link

mikeslattery commented Jan 11, 2022

It would be useful if subsequent matches for f/F/t/T where highlighted with numbers instead of the search character.

For example, if your text is |Mississippi, Missouri and you type fi, you go to the first i and the next 3 will be highlighted. I'd rather briefly see M|iss1ss2pp3, M4ssouri. If I typed 2; I'd see Mississ|ipp1, M2ssour3, and then I could again type 2; and I'd see Mississippi, M|issour1.

I know what the search character is, of course, but I may have trouble telling how many times I need to use ;. With this feature, I don't lose any visual information, but I can better tell where I want to jump. This would be configurable for people that like the current way.

A nice side benefit is limit_ft_matches would be useful at a higher value (e.g. '9')

@ggandor
Copy link
Owner

ggandor commented Jan 11, 2022

This is a duplicate of #68 (more or less). I still don't see the point of such a labeling system for f/t, it would just reinforce bad habits. You can count 2-3 in-between matches, that's no problem I guess. But if there are more than that, it would be simpler to label the maches with letters, wouldn't it? But then it's probably much simpler to use s anyway, instead of being annoyed by the short pause (while you have to read/process the label). (Related: https://github.com/ggandor/lightspeed.nvim#labeled-matches-for-1-character-search) You can even repeat s now, and jump from match to match in the same manner (with s or ;), without paying attention to the labels, if that's your cup of tea.

A nice side benefit is limit_ft_matches would be useful at a higher value (e.g. '9')

That makes no sense when sXY or sXY{label} would most probably take you to the target in 3 or 4 keypresses. (But even if we forget about s, labeled f/t would be a more logical alternative, as mentioned above. In the end, a number is a "label" as well, that you need to read and process, so I don't see any benefit over letters that take you there directly, only the drawback - more keystrokes.)

Make no mistake, I'm always on the lookout for new ideas, and grateful for any suggestions, I'm just playing devil's advocate, as always. (Someone has to.)

@mikeslattery
Copy link
Author

I see your point. I'm fairly new to lightspeed so this might just be my lack of experience. I mostly want this when I under-guess the number of times my target character exists in the current line(s), thinking f will work when s would have been a better choice. This happens when I'm trying to move as fast as possible through code and I get sloppy.

I think I need more experience using this plugin before I can give a better justification for this feature. I'll check back in a few days (regardless of this issue's status).

Btw, thanks for the wonderful plugin. I tried Hop and didn't like it nearly as much. I found it interesting that you wrote it in Lisp.

@mikeslattery
Copy link
Author

mikeslattery commented Jan 21, 2022

@ggandor So I still miss being able to efficiently use f (etc) for near-by 1-char jumps, so I'm mapping those to hop.nvim until this plugin does something with f that fits my workflow in a useful way. I will still use lightspeed's s for things that are farther away, but a 2-char search takes a tiny bit more cognitive load when I'm coding fast.

Thanks for taking the time to reply to my OP.

UPDATE: I don't like hop's ftFT either. I've switched back to lightspeed for those. I like how vim-shot-f highlights available 1st characters, but I wish it also highlighted 2nd instance letters (as well as 1st), as well as the ; functionality of this issue. That functionality in lua would be my dream plugin for ftFT.

@ggandor
Copy link
Owner

ggandor commented Jan 21, 2022

Yeah, sometimes it might make sense to label f matches... I don't know. When I want to target some 1-character delimiter symbol, parens/brackets/semicolons/etc., it's indeed more intuitive than s. But I would only consider this for Normal and Visual mode. We really don't want to lose the ability to {op}fx something, without having to press a 4th key. Not to mention that it would be a breaking change from vanilla Vim behaviour.

@ggandor ggandor changed the title Display numbered hints for ; after f/F/t/T Discussion: labeled f/t Jan 21, 2022
@ggandor ggandor added the enhancement New feature or request label Jan 21, 2022
@barsv
Copy link

barsv commented Sep 18, 2022

Finally I got it with leap.nvim + flit.nvim and the following config:
require('flit').setup({ multiline = false, labeled_modes = "nv" })
labeled_modes don't include 'o' for operation pending mode because with 'o' it's required to press 4th key after {op}fx.

It's not exactly what mikeslattery asked. Because it shows character labels instead of numbers. But for me it's good enough.

Thank you, ggandor!

@ggandor
Copy link
Owner

ggandor commented Sep 19, 2022

UPDATE: I don't like hop's ftFT either. I've switched back to lightspeed for those. I like how vim-shot-f highlights available 1st characters, but I wish it also highlighted 2nd instance letters (as well as 1st), as well as the ; functionality of this issue. That functionality in lua would be my dream plugin for ftFT.

@mikeslattery https://github.com/jinh0/eyeliner.nvim might interest you. (But you can also try flit.nvim now, as mentioned above.)

@mikeslattery
Copy link
Author

Thanks @ggandor. Both are so close, but neither label ahead occurrences of single char.

I tend to agree with your original assessment that this should be a separate plugin. This is a very specific user preference, and debatable that even the existing f functionality belongs in lightspeed (as it doesn't in leap).

I appreciate the author of such an incredible plugin taking the time to consider my whims. My feelings would not be hurt if you closed this ticket.

It's time for me to deep dive into lua and neovim's api to make my own, or modify/extend an existing plugin. I may fork flit.

@ggandor
Copy link
Owner

ggandor commented Sep 25, 2022

It's time for me to deep dive into lua and neovim's api to make my own, or modify/extend an existing plugin. I may fork flit.

@mikeslattery I can throw a gist together for you, but I'm a bit lost now, what is your desired feature set then? :)

I wish it also highlighted 2nd instance letters (as well as 1st), as well as the ; functionality of this issue

This is exactly what eyeliner does, isn't it?

@mikeslattery
Copy link
Author

mikeslattery commented Sep 26, 2022

Example: My eyes are focused on an x near the end of a line. Do I need to type fx, fx;,fx;; or fx;;;? Anything that requires ;;;; or more should not be highlighted; I should use s instead.

s requires slightly more cognitive load as I have to consider it's adjacent character. I'd rather use ; up to, but not exceeding, 3 times.

Without a clear hint (a number or color codes), I don't know how many times to use ;.

Again, maybe I'm using f too much, and should not use more than one ;, in which case these other plugins would be best.

@ggandor
Copy link
Owner

ggandor commented Sep 26, 2022

It's simpler if you describe the intended behaviour instead of the problem (the latter I understand), because I'm still unsure about what the goal is.

  • Do you want hints before pressing f (quickscope, eyeliner) or after that (flit)?

If it is the former:

  • Basically you want eyeliner, but you'd want it to highlight not only primary and secondary, but also ternary/quaternary (fx;;, fx;;;) matches with different colors?

If it is the latter:

  • What is the problem with flit.nvim, i.e. labels on the matches? To quote myself,

In the end, a number is a "label" as well, that you need to read and process, so I don't see any benefit over letters that take you there directly, only the drawback - more keystrokes.

  • But okay, let's accept you prefer numbers over labels. What about simply setting flit's label set to {'1', '2', '3', '4'}, and always using ;? (It's totally irrelevant that IMO this is a bad idea, technically nothing prevents you to do it.)

That said...

Again, maybe I'm using f too much, and should not use more than one ;, in which case these other plugins would be best.

Definitely. I think your life would become much simpler by getting used to reaching s whenever you don't know the count instantly and instincitvely (2, or at most 3) ;)

@mikeslattery
Copy link
Author

mikeslattery commented Sep 28, 2022

Do you want hints before pressing f (quickscope, eyeliner) or after that (flit)?

After. That was a good clarifying question. As I said, I'm looking at where I want to go.

What is the problem with flit.nvim... ?

Maybe I didn't look closely enough. I'll install it and see if it's the solution.

(2, or at most 3)

I never mean to go beyond 2, or even 1 most of the time. It's usually an underestimation of how many occurances there are. If I think my e is then 2nd instance, but it's actually the 4th instance, and I've already typed fe;, it's easier to for me to continue with ;; than to start over with s. This is usually when I'm editing really fast and my mind isn't keeping up with my fingers.

But I agree that I should go for s more often and get used to using it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants