How To Edit Multiple Lines at Once in VS Code

<p>You spend a lot of time inside a code editor as a coder, so reducing friction with the editor is essential.</p> <p>One of my favorite friction-reducing features in VS Code is multi-cursors. You can insert multiple cursors &mdash; on a single line or across multiple lines &mdash; and edit multiple places in your code simultaneously. For instance, multi-cursors allow you to change values across several CSS lines blazingly fast:</p> <p><img alt="" src="https://miro.medium.com/v2/resize:fit:630/0*7Cx5LdFtS85F4GIH.gif" style="height:452px; width:700px" /></p> <p>all images and gifs by author</p> <p>I&rsquo;ll show you how to:</p> <ul> <li>Create multiple cursors with and without your mouse</li> <li>Customize multi-cursor behavior</li> <li>Practice multi-cursors in a variety of scenarios with guided exercises</li> </ul> <p>We&rsquo;ll use the CSS example to illustrate different ways to add multi-cursors. Here&rsquo;s the code if you want to copy and paste it into an editor and follow along with the examples:</p> <p><iframe frameborder="0" height="215" scrolling="no" src="https://betterprogramming.pub/media/550280c1a43a9d29125957d9d3f0dd67" title="example.css" width="680"></iframe></p> <p>But, as you&rsquo;ll see in the practice exercises, multi-cursor utility extends far beyond CSS.</p> <h1>Creating Multiple Cursors With Your Mouse</h1> <p>You can use your mouse to insert multi-cursors anywhere you want, or you can select multiple lines and insert multi-cursors at the end of each selected line.</p> <p><a href="https://betterprogramming.pub/how-to-edit-multiple-lines-at-once-in-vs-code-290373328a12">Read More</a></p>
Tags: mouse VS Cursors