hrsh7th / vim-vsnip

Snippet plugin for vim/nvim that supports LSP/VSCode's snippet format.
MIT License
876 stars 37 forks source link

expand wrong for `$` #274

Closed Shane-XB-Qian closed 1 year ago

Shane-XB-Qian commented 1 year ago

supposed this is the right place for this: for example "sed ${1|-E,--regexp-extended|} ':${2:x} N $! b$2 ${3:command}' ${4:file}" seems cannot expand $!, as well as $$ and $n if n > 9 e.g $10

Shane-XB-Qian commented 1 year ago

i mean should not expand $! and $$ etc, but $n but should allow n > 9

Shane-XB-Qian commented 1 year ago

or actually in some langs $n has special meaning too, how to make it not expand (if chose)?

uga-rosa commented 1 year ago

$ as a mere symbol, it should be escaped with \.

sed ${1|-E,--regexp-extended|} ':${2:x} N \$! b$2 ${3:command}' ${4:file}

Also, a bug that prevented more than 9 press holders from working has recently been fixed.

Shane-XB-Qian commented 1 year ago

should be escaped with \

looks double \ required.

a bug that prevented more than 9 press holders from working has recently been fixed.

thanks, good news.

uga-rosa commented 1 year ago

The need for two \ is an escape in double quotes in the vim script, and the string that is actually conveyed to vsnip is \$. Single quotes would be one.

Shane-XB-Qian commented 1 year ago

ok, my case actually was from typescript, but vsnip was wrote by vim script, guess eventually it got was \$.