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;
}
You can fold blocks of code by clicking the arrows that appear when you hover your mouse cursor over the gutter. You can also fold and unfold from the keyboard with the Alt+Ctrl+[ and Alt+Ctrl+] keybindings. To fold everything, use Alt+Ctrl+Shift+[ and to unfold everything use Alt+Ctrl+Shift+] .
First press the Ctrl + G in your keyboard then you will redirect to command line in the Atom editor, then type line number to navigate that line Number.
Highlight multiple lines however you like. Use the Selection|Split Into Lines command ( Cmd+Shift+L on OS X or press Cmd/Ctrl+Shift+P and type Split Into Lines ) to split the multiline selection into a selection for each line. Press the right arrow by itself to reveal the cursor at the end of the selections.
Select all text ( Cmd + A on Mac, Ctrl + A elsewhere), then use the shortcut to “split the selection into lines” ( Cmd + Shift + L on Mac, Ctrl + Shift + L elsewhere). Both commands are also available from the command palette.
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.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With