Search code examples
visual-studio-codecopylinecopy-pasteshortcut

Does VS Code support copying text in set range of lines?


Suppose that I have 1 000 000 lines of text in .txt file. I want to copy lines from 350 000 to 700 000. Is there any shortcut for that?


Solution

  • VS Code v1.46 has a new selection anchor feature that helps you to select multiple lines easier.

    1. Press Ctrl+G, type 350000 and hit Enter. It would jump to line 350 000.
    2. Place your cursor at the very start of line 350 000. Press Ctrl+K Ctrl+B to set selection anchor. If this shortcut is not working, open command palette with Ctrl+Shift+P, search for 'Set Selection Anchor' and select that option.
    3. After placing the selection anchor, you should see a thin vertical blue line at the very start of line 350 000
    4. Jump to line 700 000 by pressing Ctrl+G, then type 700000 and hit Enter.
    5. Place your cursor at very end of line 700 000. Press Ctrl+K Ctrl+K to select from anchor to cursor.
    6. Now, lines 350 000 to 700 000 should be selected. Press Ctrl+C to copy them.