发布于 2015-09-05 03:16:54 | 292 次阅读 | 评论: 0 | 来源: 网络整理

Command Palette

See also

Overview

The command palette bound to Ctrl+Shift+P is an interactive list whose purpose is to execute commands. The command palette is fed by entries in .sublime-commands files. Usually, commands that don’t warrant creating a key binding of their own are good candidates for inclusion in a .sublime- commands files.

By default, the command palette includes many useful commands, and provides convenient access to individual settings as well as settings files.

File Format (Commands Files)

Commands files use JSON and have the .sublime-commands extension.

Here’s an excerpt from Packages/Default/Default.sublime-commands:

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

    { "caption": "Preferences: Default File Settings", "command": "open_file", "args": {"file": "${packages}/Default/Base File.sublime-settings"} },
    { "caption": "Preferences: User File Settings", "command": "open_file", "args": {"file": "${packages}/User/Base File.sublime-settings"} },
    { "caption": "Preferences: Default Global Settings", "command": "open_file", "args": {"file": "${packages}/Default/Global.sublime-settings"} },
    { "caption": "Preferences: User Global Settings", "command": "open_file", "args": {"file": "${packages}/User/Global.sublime-settings"} },
    { "caption": "Preferences: Browse Packages", "command": "open_dir", "args": {"dir": "$packages"} }
]
  • caption
  • Text for display in the command palette.
  • command
  • Command to be executed.
  • args
  • Arguments to pass to command.

How to Use the Command Palette

  1. Press Ctrl+Shift+P
  2. Select command

The command palette filters entries by context. This means that whenever you open it, you won’t always see all the commands defined in every .sublime-commands file.

最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务