Feature Request: Add snippets from within the Vim session

Asked by Utkarsh Kukreti

Hey,

Would it be possible to add a feature where I can do a visual selection of some text, add it to the current session as a plain-text snippet, and also add it to the appropriate .snippet file?

Although I'm not too good at vimscript, if you could give me some pointers on how to add this functionality, I can give it a try.

Question information

Language:
English Edit question
Status:
Solved
For:
UltiSnips Edit question
Assignee:
No assignee Edit question
Solved by:
SirVer
Solved:
Last query:
Last reply:
Revision history for this message
Best SirVer (sirver) said :
#1

This is out of scope of Ultisnips. You can easily do this yourself: Make a snippet for the filetype 'snippets' that parses in a new snippet with a fitting name that uses the current content of a special register (say "a). Now, create a mapping to a macro that yanks current selection into "a, calls UltiSnipsEdit, goes to the end of the file and expands the snippet you created once, saves and closes the file. done.

Revision history for this message
Utkarsh Kukreti (utkarshkukreti) said :
#2

Thanks for the reply SirVer.

I found out about the Edit command which opens the .snippet file, and the fact that the snippets are reloaded as soon as the snippet file is saved. They work perfectly!

Thanks for the awesome plugin! :)

Revision history for this message
Utkarsh Kukreti (utkarshkukreti) said :
#3

Thanks SirVer, that solved my question.