0

I want to expand ptest into welcome python in file ending with html. Add these lines in html.snippets(located in vim-snippets/UltiSnips):

snippet ptest
!p print("welcome python")
endsnippet

and ptest expands into !p print("welcome python"). I then rewrite the snippet as below:

snippet ptest
`!p print("welcome python")`
endsnippet

but ptest expands into nothing!

1 Answer 1

1

For the example provided in the question you could use

snippet ptest
welcome python
endsnippet

If instead, a more complex string to be constructed with python is desired, then use snip.rv (.rv stands for the "return value")

snippet ptest
`!p snip.rv="welcome python"`
endsnippet

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.