Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I save collapsed code in Sublime Text 2?

Tags:

sublimetext2

Have code I can forget about all looking nice:

nice

However, upon closing the file and reopening it:

messy

How can I collapse this code I'm not going to edit for years(hopefully!) and keep it hidden indefinitely?

like image 936
Starkers Avatar asked Feb 07 '14 00:02

Starkers


People also ask

Is it possible to collapse code in Sublime Text?

Unfortunately, collapsing of code in sublime text isn't exactly the same as textmate, so you dont get the little arrows in the sidebar. The code is also folded into a single character which makes it easy to delete an entire block of folded code without noticing you have done so.

How to save and run code in Sublime Text?

With Sublime Text, choose File > New File from its top menu bar in order to save a file calledUntitled. blank line. Choosing File > Save or Save As will be the next step. The file extension has a big impact on how it works. How Do I Save And Run Code In Sublime Text?

What is code folding in Sublime Text 2?

Another handy feature of Sublime Text 2 code folding is being able to fold all blocks that are indented with a certain level. For this example, I want to fold all the and just see the the properties/functions of obj.


1 Answers

I think the BufferScroll plugin will do what you want.

Buffer Scroll is a simple Sublime Text plug-in which remembers and restores the scroll, cursor positions, also the selections, marks, bookmarks, foldings, selected syntax and optionally the colour scheme, when you open a file. Will also remember different data depending the position of the file in the application (example file1 in window1 has scroll line 30, file1 in window2 has scroll in line 40)

Also, via preferences, allows to enable syncing of scroll, bookmarks, marks and folds between cloned views, live.

Update:

To install this package on ST2, you have to add the repository to your PackageControl user settings:

"repositories":
    [
        "https://github.com/titoBouzout/BufferScroll"
    ]

Now you should be able to do a standard install from ST2.

like image 175
AGS Avatar answered Nov 11 '22 13:11

AGS