yasnippet-snippets
yasnippet-snippets copied to clipboard
LaTeX: one-letter key is not a good idea
trafficstars
Writing LaTeX with (setq yas-triggers-in-field t), which allows expanding snippet inside snippet, is very convenient. However, there are some one-letter key snippets in this repo that expand unexpectedly when I use <TAB> to move to the next field.
Example: \(g\)
I have a snippet <m which expands to \($1\)$0. When I want to write a function g in LaTeX, I type <m, g then <TAB>. However, since yas-triggers-in-field is activated, the <TAB> expands g to \gls{${1:label}}.
Since a function is very often named g (when f is already defined), this happens to be quite annoying.
As issue #69 stated, common words should not be used as a key.
I suggest to use gls as a key name or prepend the key by a common prefix.