Latex-workshop: how to customize snippets

Created on 30 Oct 2019  路  2Comments  路  Source: James-Yu/LaTeX-Workshop

If some of LaTeX-Workshop's snippets are not handy for me, how can I change them?
E.g. currently __ will trigger _{$1}, but instead I want to use d to trigger it.

question

Most helpful comment

I would add:

  1. latex-workshop.intellisense.commandsJSON.replace isn't released yet. Also it only applies to snippets in data/commands.json whereas __ is defined in snippets/latex.json. But this is fine since you can avoid the __ snippet by simply not typing two _s.
  2. You might be interested in the live snippets feature of LaTeX-Utilities depending on your exact needs. The key differences are 1. live snippets don't require tab completion unlike regular snippets 2. they can make use of regex rules 3. they are context-aware (i.e. math mode vs text mode)

All 2 comments

  1. See [vscode's documentation] on how users can define their own snippets.
  2. If you want to override the action associated to an existing prefix, use the configuration variable latex-workshop.intellisense.commandsJSON.replace

I would add:

  1. latex-workshop.intellisense.commandsJSON.replace isn't released yet. Also it only applies to snippets in data/commands.json whereas __ is defined in snippets/latex.json. But this is fine since you can avoid the __ snippet by simply not typing two _s.
  2. You might be interested in the live snippets feature of LaTeX-Utilities depending on your exact needs. The key differences are 1. live snippets don't require tab completion unlike regular snippets 2. they can make use of regex rules 3. they are context-aware (i.e. math mode vs text mode)
Was this page helpful?
0 / 5 - 0 ratings

Related issues

jabooth picture jabooth  路  3Comments

jlelong picture jlelong  路  4Comments

dslemusp picture dslemusp  路  4Comments

s-ilic picture s-ilic  路  3Comments

iainmstott picture iainmstott  路  5Comments