All Projects → jamalsenouci → sublimetext-syntaxfold

jamalsenouci / sublimetext-syntaxfold

Licence: MIT License
Sublime Text Plugin that provides a configurable command and popup for folding code based on syntax

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to sublimetext-syntaxfold

dotfiles
Software Installation, Configuration and Preferences for Springload
Stars: ✭ 23 (-43.9%)
Mutual labels:  sublime-text
YaraSyntax
YARA package for Sublime Text
Stars: ✭ 15 (-63.41%)
Mutual labels:  sublime-text
DictionaryAutoComplete
This adds dictionary entries to the completions inside comments. For lazy typers!
Stars: ✭ 89 (+117.07%)
Mutual labels:  sublime-text
chelevra.tmtheme
Sublime Text Syntax Highlighting Theme
Stars: ✭ 23 (-43.9%)
Mutual labels:  sublime-text
sublime-patcher
Bash script for patching/cracking Sublime Text on Linux
Stars: ✭ 20 (-51.22%)
Mutual labels:  sublime-text
Sublime-QML
QML support for Sublime Text 2 and Sublime Text 3
Stars: ✭ 19 (-53.66%)
Mutual labels:  sublime-text
spacegray
A Hyperminimal UI Theme for Sublime Text
Stars: ✭ 7,260 (+17607.32%)
Mutual labels:  sublime-text
eRCaGuy dotfiles
.bashrc file, terminal prompt that shows current git branch, Arduino setup, Eclipse setup, git diff with line numbers, helpful scripts, improved Linux productivity, etc.
Stars: ✭ 84 (+104.88%)
Mutual labels:  sublime-text
vim-minimd
A fast, folding Markdown outliner for Vim
Stars: ✭ 27 (-34.15%)
Mutual labels:  fold
CodeChampion
Plays epic sound clips when you write epic code on sublime Text!
Stars: ✭ 30 (-26.83%)
Mutual labels:  sublime-text
Nineties
💾 Colors for World Wide Web pioneers
Stars: ✭ 16 (-60.98%)
Mutual labels:  sublime-text
anaconda go
AnacondaGO adds autocompletion, linting and IDE features for Golang to your Sublime Text 3
Stars: ✭ 39 (-4.88%)
Mutual labels:  sublime-text
CSSFontFamily
CSSFontFamily is a Sublime Text plugin with a collection of font stacks autocomplete.
Stars: ✭ 15 (-63.41%)
Mutual labels:  sublime-text
mjml-syntax
Sublime package for the MJML
Stars: ✭ 44 (+7.32%)
Mutual labels:  sublime-text
SublimeXssEncode
Converts characters from one encoding to another using a transformation.
Stars: ✭ 37 (-9.76%)
Mutual labels:  sublime-text
Sublime-CMakeLists
Sublime Text 2/3 - CMake Package
Stars: ✭ 62 (+51.22%)
Mutual labels:  sublime-text
sublime-sesame
Add, open, remove, switch, and manage projects and folders, using the command palette and key bindings.
Stars: ✭ 15 (-63.41%)
Mutual labels:  sublime-text
SetupStuff
This repository contains the instructions to install various tools that are helpful to a developer.
Stars: ✭ 18 (-56.1%)
Mutual labels:  sublime-text
sublime-atomizr
Convert Sublime Text completions into Atom (or Visual Studio Code) snippets, and vice versa.
Stars: ✭ 12 (-70.73%)
Mutual labels:  sublime-text
readablefold.vim
A Vim plugin to improve foldtext for better looks
Stars: ✭ 21 (-48.78%)
Mutual labels:  fold

SyntaxFold - Sublime Text Plugin

A plugin for Sublime Text 3 that folds/collapses or unfolds/expands code blocks based on specific syntax defined by the User rather than indent.

Note: This plugin does not create folding markers (the functionality for creating these markers is not exposed within the Sublime Text API). The folding functionality provided by this plugin relies on using keyboard shortcuts assigned by the User or by invoking fold commands through the command panel.

Background

This plugin was created for any language that uses named regions similar to languages like VB, C++ and C# (see here). Where possible, use a plugin created specifically for your syntax.

Expanding and collapsing areas is also supported in non-source files, such as text files (Sublime Text regards HTML as belonging to a text scope name).

Installation

  • Use Sublime Package Control
  • Ctrl+Shift+P then select Package Control: Install Package
  • Type SyntaxFold and press ENTER

Alternatively Clone this repository to your Sublime Text packages directory.

Setup

The settings file can be accessed through Preferences -> Package Settings -> Settings - User. It will be initially populated with the following settings.

{
    "config":[
        {
            "scope": "source.java, source.js, embedding.php",
            "startMarker": "//region",
            "endMarker":"//endregion"
        },
        {
            "scope": "source.cs",
            "startMarker":"#region",
            "endMarker":"#endregion"
        },
        {
            "scope": "source.c++, source.c",
            "startMarker":"#pragma region",
            "endMarker":"#pragma endregion"
        },
        {
            "scope": "text.html.basic",
            "startMarker":"<!--region-->",
            "endMarker":"<!--endregion-->"
        },
        {
            "scope": "text.plain",
            "startMarker":"---region---",
            "endMarker":"---endregion---"
        }
    ]
}

Add or remove fold region objects to meet your needs. Note the scope key. Utilize this key to filter which source file types for which the start and end markers are active. To determine the scope name for a file type use Tools -> Developer -> Show Scope Name or Ctrl+Alt+Shift+P.

The scope key may contain a comma separated list of scopes for which the markers should be active. The settings file above supports, for example, Java, Javascript and PHP files folding through the same //region and //endregion markers since the defined scope is "source.java, source.js, embedding.php".

Usage

Use the keybindings to fold/unfold your code

Key Bindings

The following is an excerpt of the default key bindings:

[
//Fold all code blocks
  { "keys": ["alt+0", "alt+0"],
    "command": "fold_all" },

// Unfold all code blocks
  { "keys": ["alt+shift+0", "alt+shift+0"],
    "command": "unfold_all"},

// Toggle fold current code block
  { "keys": ["alt+1", "alt+1"],
    "command": "toggle_fold_current"},
]

Command Reference

A list of commands have been added to the command palette and can be accessed using Ctrl+Shift+P. All commands start with "SyntaxFold : [command name]".

Fold All: Fold/collapse all syntax delimited blocks in the current document.

Unfold all: Unfold/expand all syntax delimited blocks in the current document.

Toggle Fold Current: Folds/collapses or Unfolds/expands the syntax delimited block where the cursor is placed on.

Open README: Open this readme file.

Saving fold state

This package doesn't support saving the folded state of a file (remembering which blocks you have folded) but there is a package called BufferScroll perfectly suited to that https://packagecontrol.io/packages/BufferScroll

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].