News for hackers. Stuff that matters.
Re:Vim - Putting arrows to use by RegEx on Tuesday August 21, 2012 @04:04PM (#4414502)
I believe many VIM users overestimate the importance of using h,j,k,l in comparison to numeric modifiers. Holding down j to scroll down the page is no more "right" than holding down the down arrow, in my opinion.

The following made me considerably faster:

* Relative Line numbering (For Vim 7.3). G/gg stop being convenient for frequent line movement once your file goes beyond 100 lines. Doing math in your head to figure out if line 589 is 16 lines from 605 takes way too much effort. Append this[0] to your ~/.vimrc, and then CTRL-l will toggle relative/absolute line numbering. So in relative mode, you see a line is 20 up from your cursor, and 20k takes you there with no guessing or holding down keys.

[0]: https://gist.github.com/3418841

* Learn the following: f,F,t,T. Combine them with c and d.

* zz => make current line appear in middle of the screen.

* H,L,M

* w,W,b,B. Combine with numeric modifiers (5dW)

* CTRL-u, CTRL-d, CTRL-f, CTRL-b

* % for block highlighting. Works well with curly braces by default, you may need to pick up extra plugins for ruby/python.

* g; will cycle back to the last places you were in insert mode. g, will cycle forward.

Re:Vim - Putting arrows to use by amadeus on Tuesday August 21, 2012 @04:42PM (#4414681)
Even better, just learn to use EasyMotion, it's one of the most efficient ways of navigating around a file:

https://github.com/Lokaltog/vim-easymotion

Re:Vim - Putting arrows to use by johncoltrane on Tuesday August 21, 2012 @05:18PM (#4414831)
I've tried it and didn't like it at all.

The main problem is how it replaces the letter I'm searching with another unrelated one, making all the matches practically unreadable. To me, at least.

    set incsearch
and

    /foo
    ?bar
are more than enough for my needs.
Re:Vim - Putting arrows to use by dedward on Tuesday August 21, 2012 @07:32PM (#4415342)
EasyMotion is really only good for getting to something you are staring right at on the screen.... I want to go THERE.. not meant as a general search or anything like that... and doesn't help get off the screen, for sure.
Re:Vim - Putting arrows to use by amadeus on Wednesday August 22, 2012 @11:57AM (#4417980)
Basically what dedward said before me.

EasyMotion is not for searching, it's for moving the cursor deliberately to a place onscreen where you need to make an edit.

Re:Vim - Putting arrows to use by johncoltrane on Wednesday August 22, 2012 @01:04PM (#4418337)
Yes, I know.

Searching is how I move to where I want.

It's a lot less confusing to me than EasyMotion's logic, it's consistent whether the word I want to jump to is visible or not and it's a native feature.

Well, I was curious when it was released so I've used it for a couple of weeks and found it horrible and confusing. Obviously many people like it so let's say it's a matter of taste.

Re:Vim - Putting arrows to use by ninetax on Tuesday August 21, 2012 @06:13PM (#4415083)
I have been playing with the relative numbering all afternoon. I love having all my lines indexed, but it's hard to hit any number above 5 or 6 with my right hand because it's about to hit j or k. I wish it could be indexed with a combination of numbers between 1 and 5 only, but I guess that would mess with the j and k functionality.

Any ideas?

Also note: I am not a touch typist.

Re:Vim - Putting arrows to use by RegEx on Tuesday August 21, 2012 @06:38PM (#4415160)
I don't use anything beyond 5(with the exception of 0 because that's fairly easy for me to hit). 6 and 7 are the hardest to hit. 17k for me just becomes 15kkk, for example. If you ever find yourself needing to go 50+ up or down, you should be using one of H, L, or M to take out a good chunk of that.
Re:Vim - Putting arrows to use by ninetax on Tuesday August 21, 2012 @06:44PM (#4415178)
Yeah that's what I was thinking. Thanks!
Re:Vim - Putting arrows to use by ibotty on Tuesday August 21, 2012 @04:11PM (#4414536)
zz is nice. but i hardly need it with

set scrolloff=5

with which i always have 5 lines context below and above the cursor.

Re:Vim - Putting arrows to use by RegEx on Tuesday August 21, 2012 @04:28PM (#4414620)
I had tried scrolloff=1000 for middle scrolling. I liked it for a while, but got a little tired of the jumpy-ness. I'll give 5 a go.
Re:Vim - Putting arrows to use by johncoltrane on Tuesday August 21, 2012 @05:19PM (#4414836)
Same experience here. I have set it to 4 since one year: it's perfect.