ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Fold Javascript Functions

by LuckyKat ST3

Folds all JS functions with a single command

Details

Installs

  • Total 3K
  • Win 2K
  • OS X 614
  • Linux 430
Sep 17 Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10 Sep 9 Sep 8 Sep 7 Sep 6 Sep 5 Sep 4 Sep 3 Sep 2 Sep 1 Aug 31 Aug 30 Aug 29 Aug 28 Aug 27 Aug 26 Aug 25 Aug 24 Aug 23 Aug 22 Aug 21 Aug 20 Aug 19 Aug 18 Aug 17 Aug 16 Aug 15 Aug 14 Aug 13 Aug 12 Aug 11 Aug 10 Aug 9 Aug 8 Aug 7 Aug 6 Aug 5 Aug 4 Aug 3
Windows 2 0 3 0 1 0 2 1 2 2 6 0 4 0 6 1 1 2 3 1 0 0 3 1 2 0 2 4 2 1 1 2 1 0 2 3 0 1 1 1 1 2 2 2 3 2
OS X 0 1 0 1 0 1 0 0 0 0 0 0 0 0 1 0 1 0 2 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 2 0 0 0 1 0 0 0 0 1 0 0
Linux 0 1 0 0 0 0 0 0 0 1 0 0 1 0 1 0 1 0 1 0 1 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 1 0 1 0 1

Readme

Source
raw.​githubusercontent.​com

Fold Javascript Functions

A plugin for Sublime Text 3 for Javascript code. This plugin folds all functions except where your cursor is. This effectively removes all out-of-scope contexts, reducing a lot of noise while programming in JavaScript. Default shortcut key is cmd+alt+k. (ctrl+alt+k on Windows)

Additional features

There is an “Unfold All” command from the command palette. Furthermore, these options are available in the settings:

  • select_to_unfold: (on by default) One thing that annoys me in Sublime Text is to press that tiny triangle to unfold code. With this you can double click (which selects code) to open a folded block.
  • fold_on_open: (off by default) Folds upon opening a file.
  • brace_selection: (0 by default) Which part of the braces to fold. 0 = only inner content of braces, 1 = include braces, 2 = greedy inclusion (folds everything starting from the parameter list)
  • fold_constructors: (off by default) The plugin will also fold object literal parameters inside constructors. For example: var myObj = new Constructor({...});
  • auto_fold: (off by default) An experimental feature. Automatically folds and unfolds while you move your cursor.

Finally, the - admittedly unusual - Fold Args command (cmd+alt+shift+k) folds all function arguments in the selected code. This simplifies the view on the code and highlights the parts that are not yet “outsourced” to helper functions, which may give you some ideas for refactoring.

Requirements

Make sure you have the latest version of Sublime Text 3 installed. As of writing, build 3126. The plugin makes use of Sublime's selectors to recognize the blocks with curly braces. Unfortunately, this keeps changing on every now and then (twice now since development of this plugin).

No support for Sublime Text 2, sorry.