Friday, January 28, 2011

Re: Typing numbers

On Fri, Jan 28, 2011 at 05:35:02PM EST, Tim Chase wrote:
>> I concur that prefixing Vim normal mode commands with a count, such as
>> '7dw' to delete the next seven words is ineffective.. Something like
>> 'dw....' where you delete the next word (dw) and repeat the last command
>> (.) a number of times is the way I normally do it because I don't have
>> to count the words before I even start deleting. While I hit the dot (.)
>> repeatedly, I can see what I'm deleting and I know when to stop.. And
>> I can always hit 'u' for undo to bring back the words I deleted one at
>> a time in the event I got carried away.
>
> This breaks when using t/T with ";" to repeat the motion as it just finds
> the same one you just found. I have to break down and count for those :)

Another reason why I don't use t/T (and don't care much for f/F either).

There's only so much can fit under my skull.. and I prefer to stick with
a limited subset of keyboard actions that may not be the quickest and
most efficient for all occasions.. but that I can use without hesitation
or incurring any overhead rememberiing. Namely that if the cursor is at
the beginning of the line above and I want to get to the '..ii..' typo
in 'rememberiing.', I find it considerably more effective when all is
told to just hit 'w' till I get to the beginning of the word
'rememberiing'.. and either hit llll.. or hit 'e' to get to the end of
the word and then 'hh' followed by 'x' to delete the last of the two
'i''s.. What would I really gain by counting 1, 2, 3.. it's the 3rd 'i'
I want to remove.. or wait a minute.. is it the second..? Huh..

Now I'm aware that I could also jump to the next sentence and work
backward.. and there are probably other ways to get to that extra 'i' in
fewer keystrokes than my clumsy approach, but all in all, I much prefer
sticking to wwww.. or eeee.. and occasionally bbb.. etc. because it
would take me longer to produce the 'find the third i' or 'jump to next
sentence' key sequence than typing three or four (five or six..) 'w''s
in succession.

And on a really bad day, after such a minor distraction.. I might even
need another little extra effort to remember why I moved the cursor
there in the first place.. Clever is not always better..

>> Come to think of it, the only pratical use I have for counts is when
>> I need something like a line of dashes:
>>
>> i -<Esc> x 80p
>>
>> IOW - i for insert mode, one dash,<Esc> back to normal mode, 'x' to
>> delete the dash and yank it to the unnamed register, and finally 80p to
>> create a line of eighty dashes..
>
> I just use
>
> 80I-<esc>
>
> to save the cut/yank :)

Thanks Tim, even better illustrates my point...

Incidentally, you have just put paid to maybe 2-3 years of frustration..
I vaguely remembered that there was a better way (probably saw it in vim
tips, or maybe s/o once mentioned it on this list) and never memorized
it properly.. Once in a while, I would try.. hm.. starts with typing 80-
in normal mode.. then what..?? and I was never able to bring it back.
I actually stopped trying because it so annoyed me. :-)

To make sure it'll stick *this* time, I'll practice it for the next few
days.. :-)

One nice touch about the above sequence and makes it really elegant is
the upper case 'I' because you can type it regardless of where the
cursor is located on the current line: after you hit <Esc>, the cursor
sits on the last of your inserted dashes, which means that you just need
to type 'a' to switch to insert mode with the cursor on the first
character following the last dash and 'Enter' to separate your line of
dashes and the previous contents of the line and move down any ensuing
text.

Thanks again for your comments.

cj


--
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