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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.