Skip to Content

VSCode Multi-cursor 101 on macOS and Windows

Posted on 2 mins read

In the world of Cloud Foundry we often jokingly refer to ourselves as yaml developers. It’s everywhere: BOSH manifests, Concourse pipelines, CF application manifests, often huge reams reaching tens of thousands of lines. VSCode’s (don’t worry, Microsoft is cool now) multi-cursor editing features are a life-saver when it comes to editing these files.

If you’re a VSCode user and yet not familiar with the multi-cursor shortcuts, here’s a quick rundown of what you can do:

⌘D / Control + D

⌘D (Control + D on windows) is the G.O.A.T of multi-cursor editing. Select some text and hit ⌘D to create a cursor at the next occurrence of that text. Keep hitting ⌘D to find more occurrences and spawn cursors all over your giant files with ease. ⌘D should solve your multi-cursor needs 80% of the time.


⌘⇧L is ⌘D for when you know you want to select every occurrence in the file. Select some text, hit ⌘⇧L, and you’ll have a cursor everywhere that your selected text appears in the file.

⌘⌥↑ and ⌘⌥↓

Need just a few more cursors? Tap ⌘⌥↑ or ⌘⌥↓ to create cursors above or below the current cursor.

⌘F + ⌥⏎

This is ⌘⇧L in advanced mode. Sometimes you want to find the next occurrence using regex or a case-insensitive search. Hit ⌘F to find in file, type in your fancy regex for whatever you’re looking for, and then hit ⌥⏎ to spawn cursors at every match (Pro-tip: ⌘⌥R toggles regex search, and ⌘⌥C toggles case-insensitive search).

⌥⇧ + mouse

Don’t tell your VIM friends, but sometimes the mouse truly is the fastest way. Hold down ⌥⇧ and move your mouse to drag a “selection box” of cursors from your current cursor.

You can find these and many more Visual Studio Code keyboard shortcuts here; or in VS Code hit ⌘k then ⌘s.