joshhunt
joshhunt

Reputation: 5335

Atom Editor: Fold selection onto single line

Is there a way in Atom to fold an entire selection on a new line? I'm trying to make a package that lets me select multiple lines of code and fold them. My markup would look something like this:

/* Text Colors */

.text-red {
    color: red;
}

.text-green {
    color: green;
}

.text-blue {
    color: blue;
}

/* Typography */

h1 {
    font-size: 30px;
}

and then when I fold it, it would look something like this:

/* Text Colors */

[...]

/* Typography */

h1 {
    font-size: 30px;
}

This way I can view looks of sections in my code at the same time. I've tried using foldSelectedLines but unfortunately that ends up folding it like this:

/* Text Colors */

.text-red {[...]

/* Typography */

h1 {
    font-size: 30px;
}

Upvotes: 13

Views: 16308

Answers (2)

jpd
jpd

Reputation: 723

Its CTRL-ALT-F on Linux & Windows or CTRL---F on mac.

Also in Atom press CTRL-SHIFT-P (or -SHIFT-P on mac) to open the command palette and type fold to get a list of all the possible fold options and related keyboard shortcuts.

Upvotes: 24

Giant Ravens
Giant Ravens

Reputation: 31

I had the same problem - I wanted to fold arbitrary selections as in Textmate.

For Atom on the Mac at least ctrl-option-command-F works!

Upvotes: 3

Related Questions