Table of Contents
How to Add Multiple Cursors with Clicks
Selecting All Matching Instances
Using Column Selection (Block Cursor Mode)
A Few More Tips That Make a Different
Home Development Tools sublime How do I use the multi-cursor editing feature in Sublime Text?

How do I use the multi-cursor editing feature in Sublime Text?

Jul 04, 2025 am 01:16 AM
Multi-cursor editing

Sublime Text's multi-cursor editing feature enables efficient code editing in a variety of ways. First, hold down Alt (Windows/Linux) or Option (Mac) and click to add multiple cursors; secondly, press Ctrl Shift L (or Cmd Shift L) after selecting the text to edit all matches at the same time; thirdly, use Shift Alt to drag the mouse to achieve column selection, and edit multiple rows vertically; in addition, you can gradually expand the selected instance through Ctrl D (or Cmd D), press Esc to exit the multi-cursor mode, and press Ctrl U (or Cmd U) to undo the last cursor addition. These techniques greatly improve the efficiency of code modification.

Multi-cursor editing in Sublime Text is one of those features that feels a bit magical the first time you use it, but once you get the hang of it, it becomes a powerful tool for editing code quickly and efficiently. The key idea is that you can edit multiple lines or sections at once — which saves tons of time when you're doing repetitive changes.


How to Add Multiple Cursors with Clicks

The most straightforward way to use multi-cursor editing is by clicking. Hold down the Alt key (on Windows/Linux) or the Option key (on Mac), and click wherever you want another cursor to appear. Each click adds a new cursor at that position.

This works great when you want to edit scattered parts of your file — like changing variable names in different functions or adding comments in several places.

Tip: If you're using a trackpad, you can sometimes just click with two fingers after the initial click to add more cursors, depending on your settings.


Selecting All Matching Instances

A very common scenario is wanting to change every occurrence of a word or symbol in a block of code. Here's how:

  1. Highlight the word or text you want to match.
  2. Press Ctrl Shift L (Windows/Linux) or Cmd Shift L (Mac).

That splits your selection into all matching instances across the file, and now any edits you make apply to all of them.

For example, if you have a list of variables named temp and you want to rename them all to value , this shortcut does it in one go.

If you don't have anything selected, pressing Ctrl D (or Cmd D on Mac) will select the next instance of the currently highlighted word — allowing you to build up selections incrementally.


Using Column Selection (Block Cursor Mode)

Sometimes you want to edit a vertical block of text — maybe inserting something at the same column across multiple lines. This is called column selection , and it's super useful for aligning values ​​or commenting out blocks.

To do this:

  • Hold Shift Right Mouse Button and drag mysteriously to create a block selection.
  • Alternatively, hold Shift Alt (or Shift Option on Mac) and drag with the mouse.

Once you've made a column selection, typing will overwrite the same characters on each line — or insert text aligned vertically.


A Few More Tips That Make a Different

Here are a few extra things to keep in mind:

  • You can press Esc anytime to remove extra cursors and return to a single cursor.
  • If you accidentally added too many selections, press Ctrl U (or Cmd U on Mac) to undo the last cursor addition.
  • Multi-cursors work well with other features like multiple-line indenting , commenting , or even find/replace .

Also, if you're using a plugin like Emmet or Vintageous , some of these shortcuts might behave differently — so double-check your keymap if things don't work as expected.


Basically that's it. Once you start using multi-cursor editing regularly, you'll wonder how you ever got by without it. It's not complicated, but it definitely takes practice to know when and how to use it effectively.

The above is the detailed content of How do I use the multi-cursor editing feature in Sublime Text?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to run Python code in Sublime Text How to run Python code in Sublime Text Aug 04, 2025 pm 04:25 PM

EnsurePythonisinstalledandaddedtoPATHbycheckingversioninterminal;2.Savefilewith.pyextension;3.UseCtrl Btorunviadefaultbuildsystem;4.CreateacustombuildsystemifneededbygoingtoTools>BuildSystem>NewBuildSystem,enteringthecorrectcmdforyourPythonvers

How to run Python code in Sublime Text? How to run Python code in Sublime Text? Aug 16, 2025 am 04:58 AM

Make sure that Python is installed and added to the system PATH, run python--version or python3--version verification through the terminal; 2. Save the Python file as a .py extension, such as hello.py; 3. Create a custom build system in SublimeText, Windows users use {"cmd":["python","-u","$file"]}, macOS/Linux users use {"cmd":["python3

How to debug Python code in Sublime Text? How to debug Python code in Sublime Text? Aug 14, 2025 pm 04:51 PM

UseSublimeText’sbuildsystemtorunPythonscriptsandcatcherrorsbypressingCtrl Baftersettingthecorrectbuildsystemorcreatingacustomone.2.Insertstrategicprint()statementstocheckvariablevalues,types,andexecutionflow,usinglabelsandrepr()forclarity.3.Installth

How to create a Python project in Sublime Text? How to create a Python project in Sublime Text? Aug 16, 2025 am 08:53 AM

InstallSublimeTextandPython,thenconfigureabuildsystembycreatingaPython3.sublime-buildfilewiththeappropriatecmdandselectorsettingstoenablerunningPythonscriptsviaCtrl B.2.OrganizeyourprojectbycreatingadedicatedfolderwithPythonfilesandsupportingdocument

How to run a Python script and see the output in a separate panel in Sublime Text? How to run a Python script and see the output in a separate panel in Sublime Text? Aug 17, 2025 am 06:06 AM

ToseePythonoutputinaseparatepanelinSublimeText,usethebuilt-inbuildsystembysavingyourfilewitha.pyextensionandpressingCtrl B(orCmd B).2.EnsurethecorrectbuildsystemisselectedbygoingtoTools→BuildSystem→Pythonandconfirming"Python"ischecked.3.Ifn

How to build and run Python in Sublime Text? How to build and run Python in Sublime Text? Aug 22, 2025 pm 03:37 PM

EnsurePythonisinstalledbyrunningpython--versionorpython3--versionintheterminal;ifnotinstalled,downloadfrompython.organdaddtoPATH.2.InSublimeText,gotoTools>BuildSystem>NewBuildSystem,replacecontentwith{"cmd":["python","-

How to configure Sublime Text for Pygame development? How to configure Sublime Text for Pygame development? Aug 17, 2025 pm 12:23 PM

Install Python and Pygame, verify the installation by running importpygame and printing the version number; 2. Install PackageControl in SublimeText to manage plugins; 3. Install practical plugins such as Anaconda (or LSP), SublimeREPL, PythonExec, BracketHighlighter and ColorHighlighter through CommandPalette; 4. Create a custom build system Python_Pygame.sublime-build, and use "cmd":["python&

How to run pytest in Sublime Text? How to run pytest in Sublime Text? Aug 14, 2025 pm 02:29 PM

CreateanewbuildsysteminSublimeTextviaTools>BuildSystem>NewBuildSystem,thenreplacethecontentwithaJSONconfigurationforpytestincludingvariantsforrunningalltests,verboseoutput,andcoverage.2.SavethefileasPytest.sublime-buildinthePackages/User/direct

See all articles