ultisnips icon indicating copy to clipboard operation
ultisnips copied to clipboard

Nested placeholder {VISUAL:\\includegraphics\{$2\}}

Open kiryph opened this issue 8 years ago • 1 comments

Consider following latex snippet:

snippet EFG "Figure" b
\begin{figure}[${1:<+htpb+>}]
  \centering
  ${VISUAL:\\includegraphics[$3]\{$2\}}
  \caption{${4:<+caption text+>}}
  \label{fig:${5:<+label+>}}
\end{figure}$0
endsnippet

It should be able to surround via visual mode an already existing line

\includegraphics{myinlinegraphic.eps}

to

\begin{figure}[${1:<+htpb+>}]
  \centering
  \includegraphics{myinlinegraphic.eps}
  \caption{${4:<+caption text+>}}
  \label{fig:${5:<+label+>}}
\end{figure}$0

and it also should expand in normal mode from

EFG

to

\begin{figure}[${1:<+htpb+>}]
  \centering
  \\includegraphics[$3]\{$2\}
  \caption{${4:<+caption text+>}}
  \label{fig:${5:<+label+>}}
\end{figure}$0
endsnippet

Is this possible with UltiSnips? I couldn't find confirmation in the docs under 4.3 or in honza snippets repository

kiryph avatar Sep 22 '16 13:09 kiryph

No, this is not currently possible. The default text for VISUAL markers is not parsed for further tabstops and in fact the layout of the code would make it rather difficult to model this.

I agree that this would be a cool feature, but it will be not easy to implement. I will accept a patch if somebody is interested in working on this.

SirVer avatar Dec 09 '19 16:12 SirVer