Live data from Hacker News

Show HN: A New Basic Vim Motion

github.com

31–40 of 43 posts

Re: Show HN: A New Basic Vim Motion

#31
post #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,…

As a little thought exercise, I'm trying to see how many commands I can think of that are equivalent to s. So far:

1s

cl

c

vc

xi

There's obviously more if you want to add '1' to a couple of these, and more still if you want to go to 3 characters.

Re: Show HN: A New Basic Vim Motion

#32
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}.

Could you explain your use cases of `s`? I've basically never found a use for it given `c` and `r` or `R` but maybe I'm missing something.

Re: Show HN: A New Basic Vim Motion

#33
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}.

Could you explain your use cases of `s`? I've basically never found a use for it given `c` and `r` or `R` but maybe I'm missing something.

Maybe 3 needs to become 42. Maybe x needs to become price. Maybe miapelling needs to become misspelling. I pretty frequently have a one-character thing that needs to be replaced.

Re: Show HN: A New Basic Vim Motion

#35
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…

For Emacseers, this sounds essentially equivalent to ace-jump-mode[1]

There's a nice intro video by EmacsRocks at [2].

[1] https://github.com/winterTTr/ace-jump-mode

[2] http://emacsrocks.com/e10.html

Re: Show HN: A New Basic Vim Motion

#36
post #35
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…

For Emacseers, this sounds essentially equivalent to ace-jump-mode[1] There's a nice intro video by EmacsRocks at [2]. [1] https://github.com/winterTTr/ace-jump-mode [2] http://emacsrocks.com/e10.html

ace-jump-mode is the absolute Emacs nuts and every Emacseers ought to spend the two minutes it takes to understand how it works because it is the biggest time saver ever.

You must be able to type any letter/number on your keyboard without looking at your keyboard that said because the way to use it efficiently consist in first looking where you want move your cursor, then invoking the shortcut while keeping your eyes on your target. That's how you can be really very efficient.

Note that the latest version can also "ace jump" across various Emacs frames (previously it was limited to buffer(s) inside the current frame).

But to be honest the thing posted here for vim is different: Emacs' ace-jump-mode is vim's easymotion and the author of this new vim navigation feature suggest also using easymotion.

But, yeah... Anyone using Emacs or vim and not using ace-jump-mode / easymotion is totally unaware of what he is losing.

Every single time I demonstrate that to coworkers I see a jaw dropping ; )

Re: Show HN: A New Basic Vim Motion

#38
To the creator: What about all the other plugins and macros that already use "s" ? I'd love to try this out, but remapping basic keys has always led to some other function or mapping or macro suddenly failing.

Why can you not rework the "f" key itself to take 2 keys if pressed in quick succession? "f" waits a millisecond to see if another key is pressed, if not it behaves identically to the default "f", else it uses 2 or even 3.

Re: Show HN: A New Basic Vim Motion

#39

To the creator: What about all the other plugins and macros that already use "s" ? I'd love to try this out, but remapping basic keys has always led to some other function or mapping or macro suddenly failing. Why can you not rework the "f" key itself to take 2 keys if pressed in quick succession? "f" waits a millisecond to see if another key is pressed, if not it behaves identically to the default "f", else it uses…

That's an interesting proposition, I'll see what I can do to offer the alternative of making f ambiguous instead of using s. I don't think it could be the default because most users wouldn't be as quick to type the three letters, at least at first, and it would need to timeout really fast so as to keep f's original responsiveness to single letters.

Re: Show HN: A New Basic Vim Motion

#40
post #28
post #21

Earlier quoted context omitted.

I remapped `;` to `:` (try it, it's fun!) and evolved my character jump usage into just using `/` + two characters of resolution. So many times I'd do an `f` search like `fs` only to realize the variable `she_sells_sea_shells_by_the_sea_shore` appears between me and my destination. Ugh!

You're missing out on using the normal meaning of ; which is really useful. I prefer to map the space bar to : instead. The space bar is not usually mapped to anything, so you wouldn't be masking any other function by mapping it. Also, for jumping long distances, you should really try PreciseJump or EasyMotion. (mentioned elsewhere in this thread)

Reading your comment I have just mapped

"space" to ":"

":" to ","

That makes sense. Now ; and shift-: works in pair how n and shift-N works in pair.

Post reply on HN