Is there any way that UltiSnips can be made to seek for a text in document and execute some snippet at the position of text?
Explanation of Intent :-
Say I have the following text file
abcde klsdfl | %cursor unique_text Now, what I want is that if I write trigger and press the expand key (Tab in my case) then the snippet would write some_text and then look for unique_text (which is always unique and located at the bottom of my document), insert two blank lines above it and write anything there and just after some_text position as well?
Bare structure of MWE :-
snippet trigger "you_dont_need_this" wmA some_text ${1:anything} #code for seeking unique_text $1 endsnippet Expected DryRun :-
abcde klsdfl trigger %pressing Tab now unique_text Snippet executes.
abcde klsdfl some_text anything %blank line already existing anything %blank line no 1 %blank line no 2 unique_text Edit 1 : Actual usage - I am using snippets for LaTeX documents and wanted to write the bibliography while giving citations immediately. The snippet should go down towards the very end of the document and find \end{thebibliography} and create a \bibitem{cite_key} directly as soon as I expand my snippet for \cite{cite_key} and then I would write the reference (which are often my own thoughts and questions) and then I could use Ctrl-O key-binding from my text editor Vim to jump to the previous location. This would save me a lot of time, specially with large documents.
import/includestatements at the start of the document. I don't know if your snippet engine supports this. May be, as you wish to modify the text after cursor position, you should be able to do it by simply callingsetline()on the position found -- expecting your snippet engine has the same kind of constraints as mine: the number of lines before the cursor shall not be modified by templates/snippets.UltiSnipsand will check for the functionality you mention. Thanks.