honza / vim-snippets

vim-snipmate default snippets (Previously snipmate-snippets)
MIT License
4.82k stars 2.03k forks source link

Some TeX snippets don't expand according to config #1430

Open angelus2014 opened 2 years ago

angelus2014 commented 2 years ago

I just started (so please excuse if this is a stupid question) using vim-snippets (Neovim 0.7.0) with ultisnips, but I've noticed that with LaTeX (tex.snippets), there are several that expand differently. For example 'bf' expands to '\bf{}' even though in the config it states:

snippet bf "Bold" wi
  1 \bf{${1:${VISUAL}}}$0
  2 endsnippet

Also, shouldn't 'bf' be 'textbf' as with 'bf' the rest of the text will be bold, not just the text inside the brackets...... When using just bf, it should be {\bf text-one-wants-in-bold}.


With regards,

Angelo Machils

RiMillo commented 2 years ago

For what is worth, I agree: the \bf syntax is awkward and it is not correct, a workaround might be to switch \bf and the opening brace as follows: {\bf ${1:${VISUAL}}}. All in all, personally, I do prefer \textbf{}. In fact, a quick search through the history shows that it used to be implemented version until a couple of months ago, commit ddcda4f5ddbacf5f64637aeadf1b8ac1010ea6ba; notice that since then, more recent commits reverted some changes applied by the former. Actually, the original snippets are still presents in snippets/tex.snippets, however they are overridden by those in UltiSnips (if you are using UltiSnips, I guess).

Notice also that similar problems hold for snippets it, rm, un

oeyoews commented 2 years ago

if you not set like this

vim.g.UltiSnipsSnippetDirectories = {
  vim.fn.stdpath("data") .. "/site/pack/packer/opt/vim-snippets/UltiSnips/"
}

in default, this ultisnip plugin load this snippets/ directory, not the Ultisnips/ directory, this will not be overwritten by Ultisnips/ directory @angelus2014