-1

In PatentStorm, I used Ctrl+W — Ctrl+Shift+W to fold / unfold code.

I migrated to Atom — is this possible to mimic?

Rafael
  • 7,605
  • 13
  • 31
  • 46

1 Answers1

0

Custom Keymap

Add this to your keymaps:

'atom-text-editor':
  'ctrl-w': 'editor:fold-current-row'
  'ctrl-shift-w': 'editor:unfold-current-row'

Atom Keymaps In-Depth


Atom Defaults (Windows)

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.

Atom Code Folding

Single Key Fold-Toggling

If you'd like to use a key binding to fold-toggle, create a custom command:

atom.commands.add 'atom-text-editor',
  'editor:toggle-current-row-folding': (event) ->
    editor = @getModel()
    bufferRow = editor.bufferPositionForScreenPosition(editor.getCursorScreenPosition()).row
    if editor.isFoldedAtBufferRow(bufferRow)
      editor.unfoldBufferRow(bufferRow)
    else
      editor.foldBufferRow(bufferRow)

Here you would use 'editor:toggle-current-row-folding' as your command.

From abe + kschaper @ How to toggle current fold in editor view?

Rafael
  • 7,605
  • 13
  • 31
  • 46