Inserting snipet to selected lines of code


Im comming from a tex program where i was able to define macros to insert in to a selected area of code. It then inserted that snipet in the top and closed it after the last selected line of code. Is that possible to configure with atom somehow?

a sample:


and sometimes it also useful to get a tag to set the cursor to the next used point:


how can i build my snipets like that?


Looks like you’ll need a proper package for that (or at least some work in the init file).

I’ll give it a try when I have time. In the mean time, there are LaTeX autocomplete packages that are configurable in terms of content and cursor position. They don’t work with selected text, but they might suit your needs.


i assume it wold be better to integrate it to the snippets package as the main task is to automate workflows. this seams as a extension of the same to me.


Snippets are for when you type a “prefix” and expand it to the “body”. What you’re suggesting, if I understand right, is to apply a modification to some selected text.


The workflow i would see as apropriate is this:
my code:

foo bar
  • select code with the mouse. like select only: “foo”
  • press a hotkey like {shift & cmd} + p. to get a box where i can type for searching the tag.
  • select the tag by enter
  • that inserts the snipet and expands the selected text.

ending up with:

\begin{multicol}{set the cursor here}


Possibly the closest package with capability:


That package is actually very old, haven’t done much since. But considering the interest around it, I’ll go back to it ASAP!


Wow, thanks!