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

Beta-testing 'mini.jump2d' #74

Closed
echasnovski opened this issue May 6, 2022 · 15 comments
Closed

Beta-testing 'mini.jump2d' #74

echasnovski opened this issue May 6, 2022 · 15 comments

Comments

@echasnovski
Copy link
Owner

Please leave your feedback about new 'mini.jump2d' module here. Feel free to either add new comment or positively upvote existing one.

Some things that I am interested to find out (obviously, besides bugs):

  • Are configuration and function names intuitive enough?
  • Are default values of settings convenient for you?
  • Is documentation clear enough?
@echasnovski echasnovski pinned this issue May 6, 2022
@Iron-E
Copy link

Iron-E commented May 9, 2022

I came to this from lightspeed.nvim. I didn't expect to only be able to jump to beginnings or ends of words at first; I realized that doesn't really matter since you can just use mini.jump to get to an exact position after a mini.jump2d. Feels very fast, even on old hardware

@echasnovski
Copy link
Owner Author

echasnovski commented May 9, 2022

That is great to here, hope you'll like it!

My initial idea was something along the lines "I want to jump to any non-whitespace in a matter of couple of keystrokes". So when after implementation, it felt unusable (or, at least, needing much time to get used to). The reason for me was that I immediately lost the place where I wanted to jump. Looked cool though! You can try this with lua MiniJump2d.start({ spotter = MiniJump2d.gen_pattern_spotter('%S') }).

So after trial and error I figured that I very rarely needed to jump inside word between letters. Usually it is "jump to word -> replace whole word". But jumping to place near punctuation or start of capital letter is quite frequent in programming. Thus was the default spotter born.

@JoseConseco
Copy link

One thing could be changed, default labels :
keys = 'asdghklqwertyuiopzxcvbnmfj' - are more ergonomic than default 'abcd...' labels from jump
These are from hop (can be costomized)

@echasnovski
Copy link
Owner Author

Thanks! Yeah, I thought about that. And while those might be "ergonomic mechanically" they don't feel "ergonomic mentally" to me. It seems more intuitive to have "a" at start and "z" at end, albeit maybe slightly worse to type. And also this won't have the same effect as in 'hop.nvim' because labels are computed not around cursor, so any label is more or less equally possible on first step.

But they are customizable, so don't think this should matter much.

@BenjaminKern
Copy link

I was trying initially to migrate from hop, but unfortunately y1 yank motion was broken. In addition, I am using https://github.com/rcarriga/nvim-notify, and the vim.notify messages are very noisy. It would be great to be able to disable this notifications somehow

@echasnovski
Copy link
Owner Author

Thanks for the feedback!

  • Could you, please, tell more about "y1 yank motion was broken"? I don't quite understand that.
  • I am not using 'rcarriga/nvim-notify' myself, so didn't take that into account. All 'mini.nvim' modules are using vim.notify at the moment for user-facing messages. I am leaning towards changing that to plain old :echomsg. Or make it work with vim.notify, not really sure, but that is being worked on.

@BenjaminKern
Copy link

I will try to reproduce this problem and make an separate issue for that once I find the time

@JoseConseco
Copy link

Hi @echasnovski i was recently trying to implement repeat functionality in my custom Text Object. Turns out u have to use vim-repeat plug to make it work, and here is my sollution:
tpope/vim-repeat#92 (comment)
I wonder can this be used to repeat jumps with jump and/or jump2d ?

@echasnovski
Copy link
Owner Author

First, in order for custom textobject to support dot-repeat, you usually don't have to use 'tpope/vim-repeat'. 'mini.nvim' has several text objects and motions, all of them support dot-repeatability out of the box. Usually it is a matter of making a correct mapping for using it. Situations might be different, but you can try to look at source code of 'mini.comment' (starting from here) or 'mini.indentscope' (starting from here).

Second, jumps in 'mini.jump' are fully dot-repeatable: typing dto will delete till first o; then typing . will again delete till first o.

Third, jumps in 'mini.jump2d' are dot-repeatable to the extent I currently see reasonable: d<CR>aa will delete up to spot defined by two as; then typing . will automatically "know" that user wants to do delete using 'mini.jump2d' and start jumping. It is not (and probably will not under this design) possible to replace f with 'mini.jump2d' functionality so that it "remembers" the last target character. This would require some caching magic currently implemented in 'mini.surround' (quite complicated and I will use this approach only if totally necessary).

@echasnovski
Copy link
Owner Author

@BenjaminKern, I stopped using vim.notify() for frequent user notification in favor of good old echomsg. Now it should be less noisy.

@BenjaminKern
Copy link

Awesome, thanks

@BenjaminKern
Copy link

Maybe a quick feedback after using jump2d for a couple of days. I am often in the situation, where i need to jump 3-4 times to get to the location, where I want, while with hop it usually takes two jumps. I have a feeling that this happens when I want to jump to a location that is not so far away.

@echasnovski
Copy link
Owner Author

Thanks for the feedback, it really helps!

I presume you mean "keystrokes" instead of "jumps" here. Well, yeah, that is one of the intentional main differences between of 'hop.nvim' and 'mini.jump2d'. Former computes labels with algorithm involving cursor position, latter - doesn't. And so it takes roughly a uniform amount of keystrokes to get to any allowed spot instead of "fewer near cursor". (Also, is this an estimate for the same allowed jump spots? Like both "word starts in current window" or "default 'mini.jump2d' and some specific command in 'hop.nvim'"?).

When I tried 'hop.nvim', for some reason this asymmetry in label computation was a deal breaker to try and write 'mini.jump2d'. Besides, found using this type of jumping usually to go relatively far enough from current cursor position (otherwise using builtin motions), so 'mini.jump2d' is usually narrowing allowed spots somewhat quicker.

@BenjaminKern
Copy link

Yes, you correctly interpreted what I meant, with jumps I meant keystrokes. I guess, I got used to the way hop works, so for me I am most often moving around near the current position of the cursor. But as you clearly stated, it is ok to have a different focus for jump2d, it is a valid use case to expect uniformity in the number of keystrokes. You cannot make everybody happy, otherwise it wouldn‘t be „mini“ anymore

@echasnovski
Copy link
Owner Author

With 0.4.0 release, 'mini.jump2d' is no longer in beta-testing. Thank you all for your input!

@echasnovski echasnovski unpinned this issue May 28, 2022
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

4 participants