Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

Two transforms on TM_SELECTED_TEXT

$
0
0

I need a vscode snippet to transform selected text.

I have text like:

    Teaching Strategies:        Use advance organizers at the beginning of lessons to provide a conceptual framework.        Encourage the use of concept maps to help students organize and relate new information to what they already know.        Focus on the depth of understanding rather than the breadth of coverage, promoting meaningful learning over rote memorization.

I want to transform it to:

Teaching Strategies::* Use advance organizers at the beginning of lessons to provide a conceptual framework.* Encourage the use of concept maps to help students organize and relate new information to what they already know.* Focus on the depth of understanding rather than the breadth of coverage, promoting meaningful learning over rote memorization.

The logic is

  • if line start with four space and end with colon, then remove spaces from the beginning and add two colons at the end.
  • if line start with eight space, replace the eight space with *.

The two transforms are:

"${TM_SELECTED_TEXT/^ {8})/* /gm}""${TM_SELECTED_TEXT/^ {4}(.+):$/$1::/gm}"

How to run these one after another on selected text.


Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>