Title says it, is it possible to alter yasnippets behavior so that it is not possible to expand on “-or” but it is possible to expand on “[newline]or” or “[tab]or” only?
I would like this because I am trying to expand my yasnippets automatically when expansion is possible, and there is only ever confliction when I am writing variable names.
I got the solution here:
http://ergoemacs.org/emacs/emacs_tip_yasnippet_expand_whole_hyphenated_word.html
There is variable
(defvar yas-key-syntaxes (list "w" "w_" "w_." "w_.()" "^ ")..), which controls kinds of expansions."w"means that `”-or” is expanded as separate “or”.If
then
"-or"is expanded as complex expression"<some>-or"only. But" or"is expanded as usually.So,
"buffer-substring"will be expanded only if there is filebuffer-substring.yasnippetwith contentBut with
"w"keyword"buffer-substring"will be expanded assubstring.yasnippet.If there is additional string
# key: bsin filebuffer-substring.yasnippetthen"buffer-substring"won’t be expanded at all. (For Version: 0.8.0)