|
|
nemesis wrote:
> Mike Raiford escreveu:
>> nemesis wrote:
>>
>>> Yeah, Professor Foo probably goes like: "Now type vi file and here
>>> are some basic commands for you. Have fun!" Surely wasn't a vi
>>> class and it just got in the way of the tasks. You surely had no
>>> time to learn it while you were fighting against it to get your
>>> assignments done...
>>
>> That's exactly how it happened :)
>
> And poor vi has nothing to do with it, really. :)
>
>>> And I remember you're the guy who backed down from my text-copying
>>> challenge in this thread. ;)
>>
>> ... I think I missed something here. What challenge was that?
>
> Copy a really big block of text with a mouse and then try y} on vim for
> the same task. ;)
>
> Here's another: open up some big source file, randomly place the cursor
> somewhere inside, then search for the next call of the nearest function
> being called (supposing it's not being called in the next line sure).
> Copy the next block of text following the function call, then go back to
> where you were and paste it. Pretty routine source code editing.
>
> In vim it can be done in a automated way, barely looking at what's being
> done: * j 0 y} 2Ctrl+o o Esc p
>
> * over the function name to search for the next occurrence of name
> j to go to next line
> 0 to go to beginning of line
> y} to yank/copy the statements block following the call
> 2Ctrl-o to go back 2 times in the jump stack (search and copy add to it)
> o to add a line below the line where you were in the first place
> Esc to get out of insert mode
> p to place the copy
>
> It may sound completely alien, but is completely intuitive once you
> learn the basics. Needless to say, I'd be done with it before the mouse
> guy would still be positioning his cursor beyond the last statement to
> copy and before using page-ups like mad to reach his original location
> -- even if he was smart to bookmark it before... :P
>
Hmmm Let see .. (This is visual studio, so YMMV)
Ctrl-F3 (Find next occurrence)
Down Arrow
Home
Ctrl-I } <enter>
Ctrl-=
Ctrl-c
3xCtrl--
Down Arrow
Enter
Ctrl-v
A few more keystrokes, but comparable.
--
~Mike
Post a reply to this message
|
|