Visual Studio Code: Multi-line and multi-cursor editing

3904215382_999d7ca865_z

CC 2.0 image courtesy Antony Theobald on Flickr

A few months back I wrote a blog post about Column Mode Editing in Notepad++. In the article, I demonstrate how to edit multiple columns of text to add, edit, or remove information. After I wrote this I wondered if we could edit multiple lines at once in Visual Studio Code. It turns out we can and there are two different ways to do it.

Multi-Line Editing

Multi-line editing is similar to column mode editing in Notepad++. The idea is to edit multiple instances of text on contiguous lines and replace it with similar information. This is useful for HTML where you may want to change several hyperlinks at once or if you want to edit multiple rows in a JSON file.

To employ multi-line editing, use the following command for your OS:

  • Windows: Ctrl + Alt + Arrow Keys
  • Linux: Shift + Alt + Arrow Keys
  • Mac: Opt + Cmd + Arrow Keys

MultiLineEditing

Multi-Cursor Editing

To edit multiple instances of text within different sections of a document, you can use multi-cursor editing. This allows multiple cursors to be placed in different spots so text can be added, modified, or deleted.

To engage multi-cursor editing, press the Alt key (or Option key on a Mac) and use the mouse to place cursors throughout the document. Every click creates a cursor resulting in multiple cursors.

MultiCursorEditing

Summary

This article demonstrated two ways to make multiple edits simultaneously within Visual Studio Code.

Related Article

About Ken Cenerelli
I am a technical writer/programmer writer/content developer, .NET developer, Microsoft MVP, public speaker, blogger, and Microsoft Azure nerd. I blog about technology at kencenerelli.wordpress.com and am on Twitter via @KenCenerelli.

One Response to Visual Studio Code: Multi-line and multi-cursor editing

  1. Pingback: The Morning Brew - Chris Alcock » The Morning Brew #2552

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: