use VimL function (from some addon) into snippet
Hello. I'm trying to create a TODO snippet that will be generic for all languages, as it'll use a vim-addon to make the comment behaviour.
In my case, I'll be using NerdCommenter vim-addon, because it provides a NerdComment(0, 'invert') function to comment the line or block that is visually selected.
So, I'm creating this snippet (based on your video(youtube) tutorials):
snippet todo "Todo reminder based on filetype" b
TODO: ${1:desc} (`date +"%F, %R"`, `echo $USER`)`
endsnippet
What I want to do is make this snippet behave like this step-by-step:
1) type "todo"<tab>
2) type description in tabstop 1, and press <tab>
3) now the snippet will visually select this line and call NerdComment to comment this TODO line <-- this is where I'm stuck
where <tab> key is my g:UltiSnipsJump
Example:
the step 3 will make this:
TODO: my description (2012-04-13, 00:10, ciberglo)
become this on a C file:
/*TODO: my description (2012-04-13, 00:10, ciberglo)*/
and this on a Python file:
#TODO: my description (2012-04-13, 00:10, ciberglo)
Could anybody help me?
Thanks in advance!
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- UltiSnips Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask ciberglo for more information if necessary.