Sublime Text 4 for Python
- to use Sublime Text 4 for Python, download and install Sublime Text 4 from Sublime Text
- open Sublime Text and go to Tools -> Build System -> New Build System
- Erase any content in it and paste the following JSON configuration:
- save the file as 'Python3.sublime-build'
- to install 'Package Control':
- open the Command Palette using CTRL+SHIFT+P
- type 'Install Package Control' and press enter. This will automatically install Package Control.
- to install Python related packages:
- open the Command Palette using CTRL+SHIFT+P
- type 'Install Package' and choose 'Package Control: Install Package'
- search for Python-related packages such as SublimeLinter, SublimeLinter-flake8, Anaconda, Python Black, or PyV8. Install them by clicking on the package name
- under 'Preferences -> Settings', you can customize Sublime Text, such as:
- Auto-save: Automatically save files when they lose focus.
- Syntax highlighting: Customize the color scheme for better readability.
- Indentation settings: Set tabs or spaces for indentation, and specify the number of spaces per indentation level.
- to use Sublime Text for Python:
- Creating and Opening Python Files: use CTRL+N to create a new document and save it with a .py extension to enable Python syntax highlighting
- Running Python Scripts: CTRL+B
- Navigating Code: CTRL+P to quickly navigate to files, symbols, or lines
- Using Snippets: Snippets are templates that make coding more efficient. You can create your own or use existing ones for common Python code patterns.
- tips for Effective Python Development in Sublime Text:
- learn keyboard shortcuts
- use multiple cursors:
- CTRL+ left click to add a cursor at the clicked positions
- CTRL+SHIFT+L to add a cursor to each selected line
- CTRL+SHIFT+Up/Down Arrow to select multiple lines, then CTRL+SHIFT+Right/Left Arrow to expand the selection to columns
- press 'ESC' to exit multiple cursor mode
- customize your workspace: use layouts and groups to organize open files and work more efficiently
{
"cmd": ["python3", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python"
}