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

Auto​Fold​Code

by Vasily-X ST3

A Sublime Text package that saves/restores folded code regions in files automatically.

Details

Installs

  • Total 9K
  • Win 6K
  • Mac 2K
  • Linux 2K
May 10 May 9 May 8 May 7 May 6 May 5 May 4 May 3 May 2 May 1 Apr 30 Apr 29 Apr 28 Apr 27 Apr 26 Apr 25 Apr 24 Apr 23 Apr 22 Apr 21 Apr 20 Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26
Windows 0 0 1 2 1 0 1 0 1 2 1 1 1 4 3 0 0 0 0 2 2 0 1 2 2 1 3 2 2 2 4 0 2 1 0 0 1 3 1 2 3 0 1 1 2 1
Mac 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 0 0 1 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 1 1 2 0 1 1 0 0 1 0
Linux 0 1 1 2 1 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 2 0 1 0 0 1 0 0 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0
012345May 10May 7May 4May 1Apr 28Apr 25Apr 22Apr 19Apr 16Apr 13Apr 10Apr 7Apr 4Apr 1Mar 29Mar 26May 10 Linux: 0 Mac: 0 Windows: 0May 9 Linux: 1 Mac: 0 Windows: 0May 8 Linux: 1 Mac: 0 Windows: 1May 7 Linux: 2 Mac: 0 Windows: 2May 6 Linux: 1 Mac: 0 Windows: 1May 5 Linux: 0 Mac: 0 Windows: 0May 4 Linux: 0 Mac: 0 Windows: 1May 3 Linux: 1 Mac: 0 Windows: 0May 2 Linux: 0 Mac: 0 Windows: 1May 1 Linux: 0 Mac: 0 Windows: 2Apr 30 Linux: 0 Mac: 1 Windows: 1Apr 29 Linux: 0 Mac: 1 Windows: 1Apr 28 Linux: 1 Mac: 0 Windows: 1Apr 27 Linux: 0 Mac: 0 Windows: 4Apr 26 Linux: 0 Mac: 0 Windows: 3Apr 25 Linux: 0 Mac: 0 Windows: 0Apr 24 Linux: 0 Mac: 1 Windows: 0Apr 23 Linux: 1 Mac: 0 Windows: 0Apr 22 Linux: 0 Mac: 0 Windows: 0Apr 21 Linux: 0 Mac: 1 Windows: 2Apr 20 Linux: 2 Mac: 0 Windows: 2Apr 19 Linux: 0 Mac: 0 Windows: 0Apr 18 Linux: 1 Mac: 0 Windows: 1Apr 17 Linux: 0 Mac: 0 Windows: 2Apr 16 Linux: 0 Mac: 0 Windows: 2Apr 15 Linux: 1 Mac: 1 Windows: 1Apr 14 Linux: 0 Mac: 0 Windows: 3Apr 13 Linux: 0 Mac: 0 Windows: 2Apr 12 Linux: 0 Mac: 0 Windows: 2Apr 11 Linux: 0 Mac: 0 Windows: 2Apr 10 Linux: 0 Mac: 1 Windows: 4Apr 9 Linux: 1 Mac: 1 Windows: 0Apr 8 Linux: 0 Mac: 0 Windows: 2Apr 7 Linux: 0 Mac: 0 Windows: 1Apr 6 Linux: 0 Mac: 0 Windows: 0Apr 5 Linux: 1 Mac: 0 Windows: 0Apr 4 Linux: 1 Mac: 1 Windows: 1Apr 3 Linux: 0 Mac: 1 Windows: 3Apr 2 Linux: 0 Mac: 2 Windows: 1Apr 1 Linux: 0 Mac: 0 Windows: 2Mar 31 Linux: 0 Mac: 1 Windows: 3Mar 30 Linux: 0 Mac: 1 Windows: 0Mar 29 Linux: 0 Mac: 0 Windows: 1Mar 28 Linux: 0 Mac: 0 Windows: 1Mar 27 Linux: 0 Mac: 1 Windows: 2Mar 26 Linux: 0 Mac: 0 Windows: 1May 10 Linux: 0 Mac: 0 Windows: 0May 9 Linux: 1 Mac: 0 Windows: 0May 8 Linux: 1 Mac: 0 Windows: 1May 7 Linux: 2 Mac: 0 Windows: 2May 6 Linux: 1 Mac: 0 Windows: 1May 5 Linux: 0 Mac: 0 Windows: 0May 4 Linux: 0 Mac: 0 Windows: 1May 3 Linux: 1 Mac: 0 Windows: 0May 2 Linux: 0 Mac: 0 Windows: 1May 1 Linux: 0 Mac: 0 Windows: 2Apr 30 Linux: 0 Mac: 1 Windows: 1Apr 29 Linux: 0 Mac: 1 Windows: 1Apr 28 Linux: 1 Mac: 0 Windows: 1Apr 27 Linux: 0 Mac: 0 Windows: 4Apr 26 Linux: 0 Mac: 0 Windows: 3Apr 25 Linux: 0 Mac: 0 Windows: 0Apr 24 Linux: 0 Mac: 1 Windows: 0Apr 23 Linux: 1 Mac: 0 Windows: 0Apr 22 Linux: 0 Mac: 0 Windows: 0Apr 21 Linux: 0 Mac: 1 Windows: 2Apr 20 Linux: 2 Mac: 0 Windows: 2Apr 19 Linux: 0 Mac: 0 Windows: 0Apr 18 Linux: 1 Mac: 0 Windows: 1Apr 17 Linux: 0 Mac: 0 Windows: 2Apr 16 Linux: 0 Mac: 0 Windows: 2Apr 15 Linux: 1 Mac: 1 Windows: 1Apr 14 Linux: 0 Mac: 0 Windows: 3Apr 13 Linux: 0 Mac: 0 Windows: 2Apr 12 Linux: 0 Mac: 0 Windows: 2Apr 11 Linux: 0 Mac: 0 Windows: 2Apr 10 Linux: 0 Mac: 1 Windows: 4Apr 9 Linux: 1 Mac: 1 Windows: 0Apr 8 Linux: 0 Mac: 0 Windows: 2Apr 7 Linux: 0 Mac: 0 Windows: 1Apr 6 Linux: 0 Mac: 0 Windows: 0Apr 5 Linux: 1 Mac: 0 Windows: 0Apr 4 Linux: 1 Mac: 1 Windows: 1Apr 3 Linux: 0 Mac: 1 Windows: 3Apr 2 Linux: 0 Mac: 2 Windows: 1Apr 1 Linux: 0 Mac: 0 Windows: 2Mar 31 Linux: 0 Mac: 1 Windows: 3Mar 30 Linux: 0 Mac: 1 Windows: 0Mar 29 Linux: 0 Mac: 0 Windows: 1Mar 28 Linux: 0 Mac: 0 Windows: 1Mar 27 Linux: 0 Mac: 1 Windows: 2Mar 26 Linux: 0 Mac: 0 Windows: 1May 10 Linux: 0 Mac: 0 Windows: 0May 9 Linux: 1 Mac: 0 Windows: 0May 8 Linux: 1 Mac: 0 Windows: 1May 7 Linux: 2 Mac: 0 Windows: 2May 6 Linux: 1 Mac: 0 Windows: 1May 5 Linux: 0 Mac: 0 Windows: 0May 4 Linux: 0 Mac: 0 Windows: 1May 3 Linux: 1 Mac: 0 Windows: 0May 2 Linux: 0 Mac: 0 Windows: 1May 1 Linux: 0 Mac: 0 Windows: 2Apr 30 Linux: 0 Mac: 1 Windows: 1Apr 29 Linux: 0 Mac: 1 Windows: 1Apr 28 Linux: 1 Mac: 0 Windows: 1Apr 27 Linux: 0 Mac: 0 Windows: 4Apr 26 Linux: 0 Mac: 0 Windows: 3Apr 25 Linux: 0 Mac: 0 Windows: 0Apr 24 Linux: 0 Mac: 1 Windows: 0Apr 23 Linux: 1 Mac: 0 Windows: 0Apr 22 Linux: 0 Mac: 0 Windows: 0Apr 21 Linux: 0 Mac: 1 Windows: 2Apr 20 Linux: 2 Mac: 0 Windows: 2Apr 19 Linux: 0 Mac: 0 Windows: 0Apr 18 Linux: 1 Mac: 0 Windows: 1Apr 17 Linux: 0 Mac: 0 Windows: 2Apr 16 Linux: 0 Mac: 0 Windows: 2Apr 15 Linux: 1 Mac: 1 Windows: 1Apr 14 Linux: 0 Mac: 0 Windows: 3Apr 13 Linux: 0 Mac: 0 Windows: 2Apr 12 Linux: 0 Mac: 0 Windows: 2Apr 11 Linux: 0 Mac: 0 Windows: 2Apr 10 Linux: 0 Mac: 1 Windows: 4Apr 9 Linux: 1 Mac: 1 Windows: 0Apr 8 Linux: 0 Mac: 0 Windows: 2Apr 7 Linux: 0 Mac: 0 Windows: 1Apr 6 Linux: 0 Mac: 0 Windows: 0Apr 5 Linux: 1 Mac: 0 Windows: 0Apr 4 Linux: 1 Mac: 1 Windows: 1Apr 3 Linux: 0 Mac: 1 Windows: 3Apr 2 Linux: 0 Mac: 2 Windows: 1Apr 1 Linux: 0 Mac: 0 Windows: 2Mar 31 Linux: 0 Mac: 1 Windows: 3Mar 30 Linux: 0 Mac: 1 Windows: 0Mar 29 Linux: 0 Mac: 0 Windows: 1Mar 28 Linux: 0 Mac: 0 Windows: 1Mar 27 Linux: 0 Mac: 1 Windows: 2Mar 26 Linux: 0 Mac: 0 Windows: 1

Readme

Source
raw.​githubusercontent.​com

AutoFoldCode

A Sublime Text package that:

  • saves/restores folded code regions in files automatically
  • saves/restores selections in files automatically

This plugin makes folded code regions and selections persist - whether you're just opening/closing a file, starting/quitting Sublime Text or rebooting your computer, AutoFoldCode will restore your code folds and selections with no hassle.

Installation

Automatic (preferred)

  1. Open the Command Palette, and find Package Control: Install Package.
  2. Search for AutoFoldCode and install.

Manual

# To install, clone this repository into you Sublime Packages directory:
cd /path/to/packages/directory
git clone https://github.com/Vasily-X/AutoFoldCode.git

# To update to the latest:
git pull origin master

Usage

Once installed, AutoFoldCode will automatically begin persisting code folds.

This package includes some useful commands:

  • AutoFoldCode: Clear All
    • This command will clear AutoFoldCode's cache, and unfold any folded regions in open views.
  • AutoFoldCode: Clear Current File
    • This command will remove the current file's folded regions from the cache, and unfold all folded regions in the file.
  • AutoFoldCode: Unfold All Open Files
    • This unfolds all open files in all open windows.
    • If you want to just unfold just the current file, Sublime Text already includes the "unfold_all" command for this.

Configuration

  • max_buffer_size
    • By default, AutoFoldCode will not save folds in any view whose length exceeds MAX_BUFFER_SIZE_DEFAULT characters. You can override this value by supplying a "max_buffer_size": <int> value in your AutoFoldCode.sublime-settings file.
  • save_selections
    • You can also disable the feature which saves/restores selections by setting "save_selections": false in your AutoFoldCode.sublime-settings file.

FAQ

  • “When I start Sublime Text, my code folds/selections aren't restored immediately”
    • This is because AutoFoldCode hasn't loaded yet. Once Sublime Text initialises AutoFoldCode, then your folds/selections will be restored.
  • “Sometimes AutoFoldCode folds my code in the wrong places”
    • This will occur if you have closed Sublime Text, edit the file with another editor, then re-open Sublime Text. This used to occur in older versions of this plugin, but shouldn't anymore since it now uses a hash to verify the contents of the file.

Credits

Many thanks to the contributors! And of course, thanks to the great developers at Sublime Text.

License

MIT