Live data from Hacker News

Show HN: A New Basic Vim Motion

github.com

1–10 of 43 posts

Re: Show HN: A New Basic Vim Motion

#2
I like the idea, but am more reluctant about the keybindings--I use `s` almost every day. More importantly, I'm infatuated with the marriage Vim has between motions and actions-over-a-range, and think it's very weird to have motion commands that are only available after {d, c, y}.

Re: Show HN: A New Basic Vim Motion

#3
Interesting, but I am not willing to surrender a basic key binding like `s` with what can be done with /. It is only an extra key to do the same thing.

You should lower your ambitions and just make this a function one can key bind to a char of their choice.

Have you tried submitting this to vim as a patch instead? I doubt it would be approved, for a good reason. Nice work though.

Re: Show HN: A New Basic Vim Motion

#4
post #2

I like the idea, but am more reluctant about the keybindings--I use `s` almost every day. More importantly, I'm infatuated with the marriage Vim has between motions and actions-over-a-range, and think it's very weird to have motion commands that are only available after {d, c, y}.

Thanks for the feedback. I know remapping a basic vim key is pretty drastic, but to justify seek's speed I needed an easily accessed key--though I do plan to allow setting it to another key in your vimrc--and substitute quite fits the bill. I'm already using 1s instead of lone s without thinking. And for higher counts it doesn't get in your way.

Regarding the motions with d, c and y, just to clarify the seek motion is available anytime. As for the others, they work similarly to iw, i" &c, and I think these operator pending motions add a great layer of flexibility to vim without needing extra base keys.

Re: Show HN: A New Basic Vim Motion

#5
While I'm normally of the opinion that 's' is almost begging to be remapped, I don't think that this is different enough from '/' to warrant a first-class place. OTOH mapping the Easy Motion trigger from '\\' to 's' might be worth it.

Re: Show HN: A New Basic Vim Motion

#6
post #3

Interesting, but I am not willing to surrender a basic key binding like `s` with what can be done with /. It is only an extra key to do the same thing. You should lower your ambitions and just make this a function one can key bind to a char of their choice. Have you tried submitting this to vim as a patch instead? I doubt it would be approved, for a good reason. Nice work though.

I actually used to use the single 's' keypress a lot. But at the same time I wasn't happy about that habit, it was often lazy-thinking, instead of using things like cf{char} or even cw, ce. So I committed to use '1s' when I really needed the single substitution, and it worked really well, so I felt I had gained on both sides. Just try and see what you think, you can always remove. And yes I will make it customizable, but I especially wanted to release this first opinionated version exactly to get feedback like this. Thanks.

Re: Show HN: A New Basic Vim Motion

#7
This sounds very similar to EasyMotion, which is an amazing plugin that I hope everyone tries.

EasyMotion allows make any movement, say "w" for forward by word, and will then highlight the beginning of every word on the screen with a "target key". Pressing that target key will take you to that word. Similarly, doing "j" will do the same, but with every line down from your line (j=down), making jumping to any line, anywhere, as easy as "j{letter}".

I have EasyMotion bound to the "space" key, and I use a fork of EasyMotion that automatically highlight with 2 letters instead of one (the default is to higlight with one, and if anything is ambiguous, after pressing the first key you'll get another key to press. With this fork, you never have to "press a key then wait", you always press the two keys that appear).

I also have the letters to use mapped to something like: "asdfghjkl", e.g. the homerow keys in order, because if I mistype one of the keys, EasyMotion will take me pretty near.

Re: Show HN: A New Basic Vim Motion

#8
post #7

This sounds very similar to EasyMotion, which is an amazing plugin that I hope everyone tries. EasyMotion allows make any movement, say "w" for forward by word, and will then highlight the beginning of every word on the screen with a "target key". Pressing that target key will take you to that word. Similarly, doing " j" will do the same, but with every line down from your line (j=down), making jumping to any line, a…

I should have mentioned EasyMotion in the readme! Or should I.. I should right? I love it, and also recommend everyone to try. But there's just one thing about it: you need to trigger it first to see what you have to press to get to your target. By creating seek I was able to literally make it a three-keystrokes action, I don't need to wait a split second to know what I need to type as the target, I'm already looking at it before I hit even the first key.

So I find EasyMotion great for getting across lines and around the screen, but within the line I think seek is a more fundamental solution.

Re: Show HN: A New Basic Vim Motion

#9
post #8
post #7

This sounds very similar to EasyMotion, which is an amazing plugin that I hope everyone tries. EasyMotion allows make any movement, say "w" for forward by word, and will then highlight the beginning of every word on the screen with a "target key". Pressing that target key will take you to that word. Similarly, doing " j" will do the same, but with every line down from your line (j=down), making jumping to any line, a…

I should have mentioned EasyMotion in the readme! Or should I.. I should right? I love it, and also recommend everyone to try. But there's just one thing about it: you need to trigger it first to see what you have to press to get to your target. By creating seek I was able to literally make it a three-keystrokes action, I don't need to wait a split second to know what I need to type as the target, I'm already looking…

Fair enough. I'll give it a try.

And I think you should mention EasyMotion in the Readme, I'm probably not the only one around who uses that plugin and many people probably have the same question/

Re: Show HN: A New Basic Vim Motion

#10
Another built-in solution to the problem of mismatches when using the jump commands (f, t, F, T) is the use of ; and ,

Semicolon will repeat the last jump command, and comma will repeat it in the opposite direction.

I find this very useful not only for mismatches that I didn't see, but also for help with quickly formatting text. Along side . to repeat an action, it's incredibly fast to use ; to repeat your last jump (like to delete the surrounding html tag). This is a just one example, but it's a quick and easy pattern I use to do things like selectively stripping html tags within a string that has some inline html, or moving around quickly within arrays.

Post reply on HN