Table of Contents
Enable Basic Auto-Completion
Customize Auto-Complete Sources
Use Snippets for Smarter Completion
Home Development Tools sublime How do I use auto-completion in Sublime Text?

How do I use auto-completion in Sublime Text?

Jul 21, 2025 am 01:24 AM
automatic completion

<p>The automatic completion function of Sublime Text can be enabled and customized to improve coding efficiency through the following steps: 1. Enable basic automatic completion, make sure that the settings include "auto_complete": true, and use the shortcut keys Ctrl Space (Windows/Linux) or Cmd Space (Mac) to manually trigger the suggestion list; 2. Customize the source of completion, control the suggestion source by modifying the "auto_complete_use_tags" and "auto_complete_with_all_tabs" settings, and adjust the pop-up delay of the "auto_complete_delay" setting; 3. Use code snippets to achieve intelligent completion, create custom shortcuts, such as pressing the Tab key to insert the complete loop structure, to ensure that the fragment scope is correct to avoid incorrect insertion. After reasonable configuration, Sublime Text will become an efficient coding auxiliary tool.</p> <p> Sublime Text has a built-in auto-completion feature that can help speed up your coding by suggesting variable names, functions, and even custom snippets as you type. It's not overly flashy, but it works well if you know how to use it properly.</p> <h3 id="Enable-Basic-Auto-Completion"> Enable Basic Auto-Completion</h3> <p> By default, Sublime Text offers basic auto-complete suggestions based on what's already in your current file or project. To make sure it's working:</p> <ul> <li> Start typing something like a variable name or function.</li> <li> Press <code>Ctrl Space</code> (Windows/Linux) or <code>Cmd Space</code> (Mac) to manually trigger the suggestion list.</li> </ul> <p> You'll notice that as you type more, Sublime gets better at guessing what you want — especially if those words have appeared before in your file.</p> <p> If you're not seeing any suggestions, go to <strong>Preferences > Settings</strong> and check that this line is present:</p><pre class='brush:php;toolbar:false;'> "auto_complete": true</pre><p> Also, you can adjust how long to wait before auto-complete pops up using the <code>auto_complete_delay</code> setting (measured in million seconds).</p><h3 id="Customize-Auto-Complete-Sources"> Customize Auto-Complete Sources</h3><p> Sublime Text pulls suggestions from a few different places. You can tweak where it looks for suggestions by editing your settings:</p><ul><li> Words from open files ( <code>"auto_complete_use_tags"</code> : usually enabled by default)</li><li> Words from the current file ( <code>"auto_complete_with_all_tabs"</code> : useful when working across multiple files)</li></ul><p> To fine-tune these behaviors, add or modify the following in your user settings:</p><pre class='brush:php;toolbar:false;'> { "auto_complete": true, "auto_complete_selector": "source, text", "auto_complete_triggers": [ {"selector": "text.html.basic", "characters": "<"} ] }</pre><p> This setup means auto-complete will work in most code files and also kick in after typing <code><</code> in HTML files, which is handy for tag suggestions.</p><h3 id="Use-Snippets-for-Smarter-Completion"> Use Snippets for Smarter Completion</h3><p> Auto-complete isn't just about guessing what you're typing — you can define your own shortcuts using <strong>snippets</strong> .</p><p> For example, create a snippet that inserts a full <code>for</code> loop when you type <code>forloop</code> and press <code>Tab</code> . Here's a simple one for JavaScript:</p><pre class='brush:php;toolbar:false;'> <snippet> <content><![CDATA[ for (let i = 0; i < ${1:array}.length; i ) { ${2:// code here} } ]]></content> <tabTrigger>forloop</tabTrigger> <scope>source.js</scope> </snippet></pre><p> Once saved (via <strong>Tools > Developer > New Snippet</strong> ), typing <code>forloop</code> followed by <code>Tab</code> will expand into a full loop with placeholders you can tab through.</p> <p> Make sure your snippets are scoped correctly so they only appear where they should — that way you don't end up inserting HTML tags inside a Python file by accident.</p> <hr> <p> That's the core of making auto-complete work for you in Sublime Text. It doesn't do AI-style completions out of the box, but with a little setup and some custom snippets, it becomes a solid tool for faster coding.</p>

The above is the detailed content of How do I use auto-completion 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)

Hot Topics

PHP Tutorial
1596
276
How to implement autocomplete and autofill through vue and Element-plus How to implement autocomplete and autofill through vue and Element-plus Jul 17, 2023 pm 06:45 PM

How to implement auto-complete and auto-fill through Vue and ElementPlus Introduction: In modern web development, form auto-complete and auto-fill are an important functional requirement. It can improve user experience and reduce the tediousness and errors of repeated input. This article will introduce how to use Vue and ElementPlus to implement auto-complete and auto-fill functions, and provide corresponding code examples. 1. What is autocomplete and autofill? Autocomplete (Autocomplete): When the user enters a text

How to handle autofill and autocomplete in PHP forms How to handle autofill and autocomplete in PHP forms Aug 11, 2023 pm 06:39 PM

How to Handle Autofill and Autocomplete in PHP Forms As the Internet develops, people increasingly rely on autofill and autocomplete features to simplify their operations on the website. Implementing these functions in PHP forms is not complicated. This article will briefly introduce how to use PHP to handle auto-fill and auto-complete of forms. Before we begin, we need to clarify what autofill and autocomplete are. Autofill refers to automatically filling in the fields in a form for users based on their previous input or history. For example, when the user enters an email

Implementation method of text box auto-complete function developed in PHP in WeChat applet Implementation method of text box auto-complete function developed in PHP in WeChat applet Jun 01, 2023 pm 07:42 PM

With the popularity of WeChat mini programs, various development needs are also increasing. Among them, the text box auto-complete function is one of the commonly used functions in mini programs. Although the WeChat applet provides some native components, some special needs still require secondary development. This article will introduce how to use PHP language to implement the automatic completion function of text boxes in WeChat applet. Preparation Before starting development, you need to prepare some basic environments and tools. First, you need to install the PHP environment. Secondly, you need to obtain your own Ap in the WeChat applet background

How to use Layui to implement automatic search function How to use Layui to implement automatic search function Oct 27, 2023 am 09:24 AM

Introduction to how to use Layui to implement automatic search function: Layui is a lightweight front-end development framework that is simple and easy to use. It has a rich set of components and modules, including forms, pop-up windows, navigation, menus, etc. The autocomplete component can help us implement intelligent prompts when searching and provide a better user experience. This article will introduce in detail how to use Layui's autocomplete component to implement the search function, and provide specific code examples. Step 1: Introduce Layui and jQuery First, introduce L in HTML

How do I fix auto-completion not working in Sublime Text? How do I fix auto-completion not working in Sublime Text? Jun 13, 2025 am 12:06 AM

1. Make sure that automatic completion is enabled: Check the user settings in Preferences>Settings and confirm "auto_complete": true; 2. Make sure that there is complete content in the file: Sublime's default automatic completion depends on existing text for suggestions, and it is necessary to manually enter duplicate content to trigger; 3. Install PackageControl and language plug-ins: such as SublimeJEDI or tern to obtain smarter code suggestions; 4. Restart or reset settings: Try restarting the software, delete the settings file, or run safe mode to troubleshoot problems. The above steps can be checked and fixed in the SublimeText that automatically completes failures.

How to implement auto-complete function in PHP and Elasticsearch How to implement auto-complete function in PHP and Elasticsearch Jul 07, 2023 pm 05:24 PM

How to implement auto-complete function in PHP and Elasticsearch Introduction: Auto-complete function is one of the common features in modern web applications. It improves user experience and search accuracy by providing relevant tips and suggestions based on user input. Elasticsearch is a powerful open source search engine that provides fast, scalable and efficient full-text search capabilities. Combining PHP and Elasticsearch, we can easily implement autocomplete functionality. step:

How do I use auto-completion in Sublime Text? How do I use auto-completion in Sublime Text? Jul 21, 2025 am 01:24 AM

SublimeText's automatic completion function can be enabled and customized to improve coding efficiency through the following steps: 1. Enable basic automatic completion, ensure that the settings include "auto_complete": true, and use the shortcut keys Ctrl Space (Windows/Linux) or Cmd Space (Mac) to manually trigger the suggestion list; 2. Customize the completion source, control the suggestion source by modifying the "auto_complete_use_tags" and "auto_complete_with_all_tabs" settings, and adjust the pop-up delay of the "auto_complete_delay" setting; 3. Use the code slice

How to clear autocomplete suggestions in the Safari search bar? How to clear autocomplete suggestions in the Safari search bar? Jul 19, 2025 am 01:03 AM

To clear the Safari search bar to automatically complete suggestions, 1. Open Settings → Select Safari browser → Click "Clear History and Website Data"; 2. If you use iOS 15 and above, you can enter Safari settings to turn off the "Quick Suggestions" function; 3. Use traceless mode, manually delete input content or clean up history regularly to reduce Lenovo interference. The above methods can effectively control Safari's automatic completion behavior and improve privacy protection and user experience.

See all articles