Git Product home page Git Product logo

python_ifold's Introduction

This is a mirror of http://www.vim.org/scripts/script.php?script_id=2002

Folds are created for:

- 'class' and 'def' definitions.
- Blocks between {{{, }}} markers (but not yet {{{n, etc.)


Flavors:

- A (python_ifold.a.vim) - ideal for legacy systems.
- B (python_ifold.b.vim) -  with all options set by default.
- C (python_ifold.c.vim) -  same as flavor B, but uses extra Vim settings for user comfort.


Improvements over python_fold:

- Fixes the wild (i.e. bogus) folding bug 
- Shows class and function signatures
- Now, as in the original, flavor B will omit any misplaced comment mark
- Flavor A boosts performance on outdated systems, something of great importance when there are lots of nested folds over large code pages


Caveats:

- The fold level for each fold is equal to the indentation divided by the value of the 'shiftwidth' option, so make sure that 'shiftwidth' is set to the right value for your code. For best results set 'shiftwidth' , 'softtabstop'  and 'tabstop' to the same value, and use 'expandtab' and 'autoindent' (all included in flavor C).

Example:
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set autoindent
set foldcolumn=1  " Optional

- Class and function folds show a counter of number of lines (and the first line below the signature) that are within the fold when it's closed. Read the change history to learn more about this.

- Press F key whenever you want to disable temporarily the folding, press F again to re-enable it (won't fold the block of code where the cursor is, though).

- If g:ifold_mode is set to a value greater than 0, will make extra parsing to your code to avoid including blank lines at the end of each fold and wont unfold your code if any comment marks are misplaced. This behavior is set by default in flavor B. But be warned , though. This option requires more power from your system (hence the two versions: 'A' for lower-end systems and 'B' for powerful-enough systems), so if you lack of requirements you shouldn't use it. 

- The docstring is not shown at all.

- If you choose flavor A or if you set the global g:ifold_mode to 0, bare in mind that any comment mark between the beginning of a line and the first expression's character (of a sentence) WILL interfere with the whole folding process, that is, only if these marks do not respect the indentation sequence.

python_ifold's People

Contributors

hellhound avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

marcusm shvenkat

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.