macros
macros copied to clipboard
Copy a line and Paste it
I want to copy a line in a source code file, drop down 10 lines, highlight the line I end up at and paste the copied line over the top.
I am having trouble with the highlight a line and copy it and then the second highlight a line and paste over it.
Is there a forum for this extension that I can post this kind of question?
This seems to do what you want:
"copyLine": [
/* Highlight line */
"cursorEnd",
"cursorHomeSelect",
/* Copy selection */
"editor.action.clipboardCopyAction",
/* Down 10 times */
"cursorDown",
"cursorDown",
"cursorDown",
"cursorDown",
"cursorDown",
"cursorDown",
"cursorDown",
"cursorDown",
"cursorDown",
"cursorDown",
/* Highlight line */
"cursorEnd",
"cursorHomeSelect",
/* Paste over selection */
"editor.action.clipboardPasteAction"
]
Alternative approach:
"copyLine2": [
/* Copy current line to the line below, then move cursor down to it */
"editor.action.copyLinesDownAction",
/* Move line down 10 times (past target line) */
"editor.action.moveLinesDownAction",
"editor.action.moveLinesDownAction",
"editor.action.moveLinesDownAction",
"editor.action.moveLinesDownAction",
"editor.action.moveLinesDownAction",
"editor.action.moveLinesDownAction",
"editor.action.moveLinesDownAction",
"editor.action.moveLinesDownAction",
"editor.action.moveLinesDownAction",
"editor.action.moveLinesDownAction",
/* Delete target line */
"cursorUp",
"editor.action.deleteLines"
]
Hope that helps :)
try https://marketplace.visualstudio.com/items?itemName=ctf0.macros