Live data from Hacker News

Show HN: A New Basic Vim Motion

github.com

21–30 of 43 posts

Re: Show HN: A New Basic Vim Motion

#21
post #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…

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!

Re: Show HN: A New Basic Vim Motion

#23
post #14

Earlier quoted context omitted.

As I stated in a previous comment, it's called "incremental search" and you can do it in vim. Look here for how: http://linuxcommando.blogspot.com/2008/06/smart-case-insensi...

yea but unfortunately it's not that good ... think it's better than default search but a still too slow as a mean for code navigation (atleast for my taste). it's mainly due to needing to hit enter, which escapes everything, there should be a way to hit next occurrence and prev without leaving the /search box.

n for next match, N for previous match.

In combination with this it's almost as effective. Personally I'd use ctags and the http://vimdoc.sourceforge.net/htmldoc/tagsrch.html#tag-comma... search functionality of the tags. But I'll give you that normal text searching in emacs is a tiny bit more efficient :)

Re: Show HN: A New Basic Vim Motion

#24
post #17
post #15

Earlier quoted context omitted.

The problem with ; is that it doesn't work with t. It just leaves the cursor in the same place, because that's exactly what your t command would do if you typed it again. It's now some years since I used vim regularly but I recall this regularly annoying me when trying to create visual selections. For example, I'd do "vt," (or whatever) expecting the selection to extend to a given point, and then find myself stuck at…

That's odd. With my configuration I can use ; with t and it will skip over an occurrence of the target if it is the next character, like it seems you expect it to behave. I don't know if this has been fixed/improved in Vim itself or by some plugin that I use, but it does seem to be fixed now.

In vim, the ‘new’ behaviour (skipping the target if there would be no motion) is the default, and the original vi behaviour can be selected using cpoptions; see

  :help cpo-;

Re: Show HN: A New Basic Vim Motion

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

Interesting, that's like what Pentadactyl (a vim-based plugin everyone should also use) does for links on websites, but for text in vim instead.

(And I also had to remap the default keys away from the number row ...)

Re: Show HN: A New Basic Vim Motion

#26
post #25
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…

Interesting, that's like what Pentadactyl (a vim-based plugin everyone should also use) does for links on websites, but for text in vim instead. (And I also had to remap the default keys away from the number row ...)

Yes, EasyMotion is very like the browser vim keybindings. I personally use Luakit which is very minimalistic and dead easy to reprogram your way from interface to behavior.

Re: Show HN: A New Basic Vim Motion

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

Also see PreciseJump, which was the first vim plugin to do this.

Re: Show HN: A New Basic Vim Motion

#28
post #21
post #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…

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)

Re: Show HN: A New Basic Vim Motion

#29
post #25
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…

Interesting, that's like what Pentadactyl (a vim-based plugin everyone should also use) does for links on websites, but for text in vim instead. (And I also had to remap the default keys away from the number row ...)

Vimium for Chrome is yet another similar plugin (but the keys start mapped to home row, similar to vim.)

Re: Show HN: A New Basic Vim Motion

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

When I switched from Vim to Sublime Text 2 (with Vintage vim mode), I missed EasyMotion so much that I created a ST2 plugin for it: https://github.com/tednaleid/sublime-EasyMotion
Post reply on HN