Shell Snippet Trigger
Show existing snippet suggestions when you type a backslash (\) in Shell Script or Zsh files, just as backslash-aware Markdown extensions do.
Usage
- Install this extension in your local VS Code.
- Create a user snippet with a backslash prefix, or keep your existing snippets.
- Open a document with language mode Shell Script (
shellscript) or Zsh (zsh).
- Type your prefix and accept a suggestion using your existing Enter/Tab settings.
For example, put this in a user .code-snippets file. The four backslashes in JSON represent two literal backslashes in the editor:
{
"Shell function": {
"scope": "shellscript,zsh",
"prefix": "\\\\fn",
"body": ["${1:function_name}() {", "\t${0::}", "}"]
}
}
Type \\ to browse matching snippets, or continue with \\fn to narrow the list. A single \ is the registered trigger character, so it can already request suggestions. This extension does not require exactly two characters.
Behavior and limits
- Uses VS Code's native snippet suggestions. No templates are bundled or copied.
- Requires
editor.suggestOnTriggerCharacters to be enabled and snippets not to be hidden from suggestions.
- Does not alter keybindings, word boundaries, file associations, or formatting.
- Only selects
shellscript and zsh; Markdown behavior is untouched.
- Does not provide Zsh language identification, syntax checking, or a language server.
- Does not parse Shell syntax: a backslash may trigger suggestions inside strings or comments too. Press Escape to dismiss them.
Activates only when Shell Script or Zsh is opened. Registers one completion provider returning no additional items; VS Code supplies existing snippets. No runtime dependencies, subprocesses, network requests, telemetry, file watchers, timers, or workspace scans.
Remote workspaces and sync
Declared as a UI extension, so it runs locally even when editing WSL/SSH workspace documents. Once published to Marketplace, its local installation can be synchronized through VS Code Settings Sync's Extensions category. Enable Snippets separately to synchronize your user templates. This does not synchronize other remote language servers.
中文说明
在 Shell/Zsh 中注册单个反斜杠作为补全触发字符,复用现有 snippets。你可以继续使用双反斜杠前缀,例如 \\fn。不修改 Enter/Tab 习惯,不附带模板,不扫描工作区。仅有本地 VSIX 时不能依靠 Settings Sync 分发安装包;发布到 Marketplace 后才有正常的跨设备安装渠道。