|
|
Mike Raiford escreveu:
> nemesis wrote:
>> 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.
I see you chose to ditch the mouse, which the original challenge was
about. Good for you anyway! :)
BTW, 2Ctrl+o is just that: press 2, press Ctrl+o. ;) No need to press
it 2 or 3 times... May not sound much for short repetitions where indeed
repressing the same key may be faster, but for numerous repetitious it
can be very worth it, like yy10p to copy the current line and paste it
10 times bellow.
As far as I know, VS has emacs keyboard shortcuts emulation, so it
surely must have similar editings capabilities. I know I had set up it
once to do the wonderful copy buffer cycling. I also know Netbeans has
keyboard shortcuts resembling vi. Not really surprising coming from
Bill Joy's Sun Microsystems.
Anyway, someone suggested mouse would make emacs (and vim by extension)
obsolete, but this is clearly dull as the mouse is an imprecise analogic
tool which simply can't compare to the ease of discrete and concise
commands typed as keyboard shortcuts...
I rest my case. :)
--
a game sig: http://tinyurl.com/d3rxz9
Post a reply to this message
|
|