Duplicating Line(s) in Chrome DevTools Editor

jlogix profile image Justin ・1 min read

Here is a useful tip for those who want to quickly copy a single line or a number of adjacent lines while editing code in Chrome DevTools Editor. Prior to version 62, Chrome DevTools on Windows used to have this nifty feature to quickly duplicate a single line by pressing Ctrl+C followed by Ctrl+V on that line without selecting any text. Later versions of Chrome DevTools, for some reason, discontinued this extremely useful feature. Even the usual Windows method of drag and drop while pressing Ctrl key does not produce a copy of the selection in Chrome DevTools - but rather moves the selection. I have created a ticket in the Chromium project bugs tracker to reinstate this feature - but nothing has been done yet.

But recently I discovered a method to make the drag and drop copying to work: after selecting the text that you want to copy, if you press Ctrl key and start dragging the selection and then press Shift key while dropping the selection at the destination, it creates a copy of the selection at the destination. I noticed that the sequence of operation matters:

1. Press Ctrl key before you start dragging the selection

2. Press Shift key while dropping the selection at the destination

The version I have tested it is Chrome 70. YMMV. Hope it helps to some extent those who are still grieving - like me - the missing line duplication feature in Chrome DevTools editor on Windows.

Posted on Nov 5 '18 by:


markdown guide