SublimeText / LaTeXTools

LaTeX plugin for Sublime Text
https://latextools.readthedocs.io/
2.01k stars 364 forks source link

Autocomplete after non-alphabetic symbols #1406

Closed NeoFantom closed 5 years ago

NeoFantom commented 5 years ago

I noticed that I can't add auto-completion maps for non-alphabetic symbols in LaTeXTools\LaTeX_math.sublime-completions. For example:

{ "trigger": "0", "contents": "\\emptyset" },
{ "trigger": "-", "contents": "\\forall" },

These mappings would be useless. I personally prefer to use some non-alphabetical symbols since they really expand the choices I have for one-tap auto-completion. How can I solve this?

ig0774 commented 5 years ago
  1. I wouldn't recommend directly editing LaTeXTools\LaTeX math.sublime-completions, since this file will be overwritten on updates to LaTeXTools. You can easily create your own completions file with the "scope": "text.tex.latex string.other.math, text.tex.latex meta.environment.math" line to trigger your completions in math mode.

  2. There are some underlying issue with non-alphanumeric characters in ST completions and in general word-boundaries. The core issue is reported here. There's not much I can think of we can do with a plugin, since this is fundamentally about how ST itself handles completions.

  3. In your examples, I can get the 0 trigger to work insofar as it turns up in the autocomplete drop-down and is replaced with \emptyset as expected. That said, you're right insofar as you can't just type 0 + tab and have things autocomplete the way they do for, e.g., a + tab.