How to duplicate these vim abbreviations in Atom?

  1. This first one just surrounds a block of text with tags.

"Surrounds paragraph with tags.
iab tvb e/^$

  1. This one just expands the text shown.
    iab ttitle
    <CR>—+ !!Title Here
    <CR>—++ Item 1
    <CR>—++ Item 2


In your

wrapSelection = (before, after) ->
  selections = atom.workspace.getActiveTextEditor().getSelections()

  for selection in selections
    selectedText = selection.getText()
    if selection.isEmpty()

atom.commands.add 'atom-text-editor', 'custom:wrap-bold', ->
  open = '<b>'
  close = '</b>'

  wrapSelection(tag, tag)

This one just expands the text shown.

You can do that with a snippet.

  "ToC and Headers":
    prefix: "ttitle"
    body: """
---+ !!${1:Title Here}


---++ ${2:Item 1}

---++ ${3:Item 2}


Thank you! The “*”: construct also answers my other question regarding using the same snippet in multiple file types.


Selectors in snippets.cson work the same way as ones in config.cson. It’s all very consistent.