Sublime Forum

A command to paste a image from clipboard to the code?

#1

On the question Drag and drop image files to LyX they show:

Not by drag & drop, but it is possible with copy & paste. Just put the image in the clipboard and select Edit->Paste Special. LyX will then immediately open a “Save as” dialog, where you can specify where and under which name the image will be saved. However, you can also just press Enter to choose the selected name and path.

A plugin like this for Sublime Text would help a lot when writing latex code. This seems to be already badly requested on:

  1. #1965 Drag and drop image to code

Although the plugin seems simple I think. When the command is issue, it would:

  1. Take the contents of the clipboard
  2. Check whether it is an image.
  3. Ask the user for a folder where to save the image, already suggesting the last used path and a name based on some information it can get as the current date and time.
  4. Insert the image path on the cursor current position as:
\begin{figure}
\centering
        \includegraphics[totalheight=8cm]{images/verticalcell.eps}
    \caption{used by \citet[p.~4]{XXXXX}.}
    \label{fig:verticalcell}
\end{figure}

Does someone know a package for Sublime Like this? If not, soon as I can I can look about to write it because I would love to have it.

Is there some advice and suggestions for this package as libraries I should use as pil, or features to implement? This should be a new package or just a new feature for the https://github.com/SublimeText/LaTeXTools? I opened a issue over there commenting about it.

0 Likes