0

Is there a way to create a keyboard shortcut that would copy whatever you had highlighted and pasted over?

Rather than having to copy and paste something elsewhere, to then recopy it is pretty annoying, plus if possible it could be extremely useful to a lot of people?

EDIT:

Okay, let's see if I can better explain myself:

In coding, say you're trying to move a random key from one variable to another, and the place you're pasting it to already has a value you also want to keep.

$var_1 = roghiu2g3iugdfgiu2h3i4uh;
$var_2 = sdoihsoidfjsgoij;

As of now, I would have to copy one of these, place it elsewhere,

$var_1 = roghiu2g3iugdfgiu2h3i4uh;
$var_2 = sdoihsoidfjsgoij;

sdoihsoidfjsgoij

Then paste the other one over this:

$var_1 = roghiu2g3iugdfgiu2h3i4uh;
$var_2 = roghiu2g3iugdfgiu2h3i4uh;

sdoihsoidfjsgoij

And then finally cut/copy and delete the original, and put it in the new location:

$var_1 = sdoihsoidfjsgoij;
$var_2 = roghiu2g3iugdfgiu2h3i4uh;

So I'm trying to see if this is possible, and although I'm on Mac I'm sure this would be handy for all OS.

Sjrsmile
  • 253
  • 1
  • 5
  • 20
  • It's quite impossible to understand what you're asking. You need to better explain what you're meaning to do and with what product/operating system – gbr Apr 12 '17 at 11:31
  • I've rephrased what I was asking, does this read a little easier to understand? – Sjrsmile Apr 12 '17 at 12:24

1 Answers1

0

It's still quite hard to understand what you want but it seems that you're looking for a way to swap the contents of the clipboard with the currently selected text; is that right?

If it's so, as far as I know it's not a feature implemented natively by any major operating system or software, but:


By the way, you're doing a lot of work for nothing in your example, even with the basic clipboard functionalities you don't need to "place elsewhere" anything: just copy it before the old value, and then select and cut the old value and paste it in the other place.

Most of the time you can do it with few keystrokes, that's why it's not a widespread feature:

  1. Position before the first character of the first text fragment:
    $var_1 = ^roghiu2g3iugdfgiu2h3i4uh;
    $var_2 = sdoihsoidfjsgoij;

  2. Select the text, most of the time a Ctrl- (I think Option- on Mac OS) will be enough

  3. Cut the text
  4. Position before the first character of the second text fragment (in your example a down-arrow press is enough)
    $var_1 = ;
    $var_2 = ^sdoihsoidfjsgoij;

  5. Paste

  6. Select the second text, which is now at your right (most of the time a Ctrl- / Option- will do)
  7. Cut it
  8. Go back at the first position (in your example just an up-arrow)
  9. Paste

It takes about 10 seconds, for a think that's not needed so frequently, so it's not very worthwhile to optimize. Your shortcut will probably save you about 3 seconds.


By the way, if you're looking for ways to optimize your usage of the clipboard you should probably have a look at clipboard managers; even in your example you can save some time by using two clipboards. Actually the Mac OS itself has a second clipboard built in (the "kill ring").


I spent a fair amount of my time to help you, now please spend some of yours to re-edit the question and its title so that it's easily understandable and findable.

Community
  • 1
  • 1
gbr
  • 1,264
  • 8
  • 27