Friday, October 28, 2011

Re: how to make 'h,j,k,l' faster ?

On 28/10/11 17:21, Ben Fritz wrote:
>
>
> On Oct 28, 6:16 am, Tim Chase<v...@tim.thechases.com> wrote:
>> On 10/27/11 22:20, gaoqiang wrote:
>>
>>> I feel those keys slow. and word-move-keys are a little diffcult to
>>> make a accurate move.
>>
>> While it's a bit of a non-answer, I'd recommend using Vim's many
>> other movement keys to move faster and more accurately. I almost
>> NEVER use h/l to move left/right but rather use f/F/t/T/,/; (and
>> occasionally in prose, the parens to move by sentence) to move
>> horizontally. For vertical movements, it's usually faster to
>> guess roughly and then fine-tune with j/k to move up/down. This
>> can be done with }/{ to jump to blank lines, using "/" to search
>> forward, using ]]/[[/]}/]{/[{/[}/[(/]) to jump to code-block
>> starts/ends, or using H/M/L to jump to the first/middle/last line
>> on the screen.
>>
>> Also, don't forget that you can prefix a count on each of these
>> commands to do it N times (or in the case of H/L, go to the
>> Nth-[top|bottom]-line-of-the-screen)
>>
>
> I find it very nice to set relative line numbers and use a count with
> j/k for down/up movement. One would think you could do the same thing
> with absolute line numbers and G, but I always find that to be too
> much typing. I usually end up typing "4j" instead of "jjjj" or
> "1546G", much faster. And getting in the habit makes it that much
> easier to do things like d4j instead of Vjjjjd.
>

A naked range is also a "go to line":

:1234
goes to line 1234

:$-5
goes to 5 lines above the last line (i.e. the 6th line from the end)

:.+10
goes 10 lines down

:'B+2
goes to the file containing mark 'B, 2 lines after the mark

:'>-2
goes to 2 lines higher than the end of the latest Visual area


You can also use relative line numbers after a search:

/^\s*}$/-1
goes to the line before the next line containing only zero or more
whitespace and one closing brace

?^$?+1
goes to the first line after the previous empty line

etc.


Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
206. You religiously respond immediately to e-mail, while ignoring
your growing pile of snail mail.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment