Sublime Text - Command Palette



Command Palette includes a list of items or commands which are used frequently. The entries of commands are included in the .sublime-commands file.

Using Command Palette

To open a command palette in Sublime Text editor, you can use the shortcut key combination Ctrl+Shift+P on Windows and Cmd+Shift+P on OSX.

Using Command Palette

The commonly used commands from the palette are −

  • Build with Python
  • Install Packages

Build with Python

This will generate all the dependencies and build the specified code of a given Python file.

Build with Python

Install Packages

With this command, we get list of packages which can be installed which is not included earlier.

Install Packages Command Palette

All the commands included in the command palette are stored in the Packages directory. The basic example of command declared inside the Default.sublime-commands file is shown in the code given below −

[
   { "caption": "Project: Save As", "command": "save_project_as" },
   
   { "caption": "Project: Close", "command": "close_project" },
   
   { "caption": "Project: Add Folder", "command": "prompt_add_folder" },
]

Note − The JSON file includes 3 main keys for every command −

  • Name/Caption
  • Location
  • Content