* copy and paste multiple times
@ 2012-01-25 17:20 Rajanikanth Jammalamadaka
2012-01-25 17:28 ` Andreas Röhler
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Rajanikanth Jammalamadaka @ 2012-01-25 17:20 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 210 bytes --]
This has been discussed below:
http://stackoverflow.com/questions/71985/emacs-equivalent-of-vims-yy10p
Is there no built-in (short :-)) command in emacs to copy and paste a
region multiple times?
Thanks,
Raj
[-- Attachment #2: Type: text/html, Size: 403 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: copy and paste multiple times
2012-01-25 17:20 copy and paste multiple times Rajanikanth Jammalamadaka
@ 2012-01-25 17:28 ` Andreas Röhler
2012-01-25 17:35 ` Teemu Likonen
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Andreas Röhler @ 2012-01-25 17:28 UTC (permalink / raw)
To: help-gnu-emacs
Am 25.01.2012 18:20, schrieb Rajanikanth Jammalamadaka:
> This has been discussed below:
> http://stackoverflow.com/questions/71985/emacs-equivalent-of-vims-yy10p
>
> Is there no built-in (short :-)) command in emacs to copy and paste a
> region multiple times?
>
> Thanks,
> Raj
>
AFAIK not.
But is was discussed at this list and several proposals made.
Here is mine:
(defun yank-repeat (arg)
"With numerical ARG, repeat last yank ARG times. "
(interactive "p*")
(dotimes (i arg)
(insert (car kill-ring))))
Andreas
--
http://launchpad.net/python-mode
http://launchpad.net/s-x-emacs-werkstatt/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: copy and paste multiple times
2012-01-25 17:20 copy and paste multiple times Rajanikanth Jammalamadaka
2012-01-25 17:28 ` Andreas Röhler
@ 2012-01-25 17:35 ` Teemu Likonen
2012-01-25 17:37 ` Rajanikanth Jammalamadaka
2012-01-25 17:52 ` Drew Adams
2012-01-25 18:10 ` Jambunathan K
3 siblings, 1 reply; 7+ messages in thread
From: Teemu Likonen @ 2012-01-25 17:35 UTC (permalink / raw)
To: Rajanikanth Jammalamadaka; +Cc: help-gnu-emacs
* 2012-01-25T12:20:16-05:00 * Rajanikanth Jammalamadaka wrote:
> This has been discussed below:
> http://stackoverflow.com/questions/71985/emacs-equivalent-of-vims-yy10p
>
> Is there no built-in (short :-)) command in emacs to copy and paste a
> region multiple times?
The Stack Overflow question is about copying *lines*, not *a region* as
you put it. Which one do you mean? Anyway, there is no as quick command
as Vi's "yy10p".
Possible solutions:
1. Write a desired command yourself.
2. Switch to viper-mode for a moment.
3. Delete line with C-k C-k and then yank it several times with C-y.
My opinion is that yank command's numeric prefix argument should repeat
the yank. But Emacs is customizable and programmable, so I just do it:
(global-set-key (kbd "C-y") (lambda (n)
(interactive "p")
(dotimes (i (abs n)) (yank))))
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: copy and paste multiple times
2012-01-25 17:20 copy and paste multiple times Rajanikanth Jammalamadaka
2012-01-25 17:28 ` Andreas Röhler
2012-01-25 17:35 ` Teemu Likonen
@ 2012-01-25 17:52 ` Drew Adams
2012-01-25 18:10 ` Jambunathan K
3 siblings, 0 replies; 7+ messages in thread
From: Drew Adams @ 2012-01-25 17:52 UTC (permalink / raw)
To: 'Rajanikanth Jammalamadaka', help-gnu-emacs
> Is there no built-in (short :-)) command in emacs to copy
> and paste a region multiple times?
Others have given you one trivial solution: write a simple command to do it.
Another is to use a keyboard macro:
C-x ( C-y C-x )
then
C-u 200 C-x e
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: copy and paste multiple times
2012-01-25 17:20 copy and paste multiple times Rajanikanth Jammalamadaka
` (2 preceding siblings ...)
2012-01-25 17:52 ` Drew Adams
@ 2012-01-25 18:10 ` Jambunathan K
2012-01-25 20:18 ` Philipp Haselwarter
3 siblings, 1 reply; 7+ messages in thread
From: Jambunathan K @ 2012-01-25 18:10 UTC (permalink / raw)
To: Rajanikanth Jammalamadaka; +Cc: help-gnu-emacs
Rajanikanth Jammalamadaka <rajanikanth@gmail.com> writes:
> This has been discussed below:
> http://stackoverflow.com/questions/71985/
> emacs-equivalent-of-vims-yy10p
>
> Is there no built-in (short :-)) command in emacs to copy and paste a
> region multiple times?
Use registers. Mark the region, store it in register `a' and insert the
contents of register `a' multiple times.
Mark region
C-x r s a
C-x r i a
C-x r i a
> Thanks,
> Raj
>
>
>
>
--
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: copy and paste multiple times
2012-01-25 18:10 ` Jambunathan K
@ 2012-01-25 20:18 ` Philipp Haselwarter
0 siblings, 0 replies; 7+ messages in thread
From: Philipp Haselwarter @ 2012-01-25 20:18 UTC (permalink / raw)
To: Jambunathan K; +Cc: help-gnu-emacs
On Wed, Jan 25 2012 19:10 (@1327515031), Jambunathan K wrote:
> Rajanikanth Jammalamadaka <rajanikanth@gmail.com> writes:
>
>> This has been discussed below:
>> http://stackoverflow.com/questions/71985/
>> emacs-equivalent-of-vims-yy10p
>>
>> Is there no built-in (short :-)) command in emacs to copy and paste a
>> region multiple times?
>
> Use registers. Mark the region, store it in register `a' and insert the
> contents of register `a' multiple times.
>
> Mark region
>
> C-x r s a
>
> C-x r i a
> C-x r i a
Combine it with `repeat':
C-x r s a
C-x r i a
C-x z a z a z a ...
Still, 9 + 2 * n keystrokes
Actually it would be a nice feature to make the behaviour of `repeat'
customizable, so that if `repeat-pass-argument' is t, numeric argument
would be passed to the command, and if nil it would simply repeat the
last command with its previous argument.
Then you could just set the default and create wrappers with let-binds
of `repeat-pass-argument'.
It would simplify the above considerably (and make it more intuitive, in
my opinion):
M-w C-y C-u n C-x z
6 + lg(n) keystrokes…
Any takers?
--
Philipp Haselwarter
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-01-25 20:18 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-25 17:20 copy and paste multiple times Rajanikanth Jammalamadaka
2012-01-25 17:28 ` Andreas Röhler
2012-01-25 17:35 ` Teemu Likonen
2012-01-25 17:37 ` Rajanikanth Jammalamadaka
2012-01-25 17:52 ` Drew Adams
2012-01-25 18:10 ` Jambunathan K
2012-01-25 20:18 ` Philipp Haselwarter
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.