GithubHelp home page GithubHelp logo

vimish-fold's Introduction

Vimish Fold

License GPL 3 MELPA CircleCI

Vimish Fold

This is a package to perform text folding like in Vim. It has the following features:

  • folding of active regions;

  • good visual feedback: it's obvious which part of text is folded;

  • create folds from regions between {{{ }}} automatically (marks are customizable);

  • persistence by default: when you kill a buffer your folds don't disappear;

  • persistence scales well, you can work on hundreds of files with lots of folds without adverse effects;

  • it does not break indentation;

  • folds can be toggled from folded state to unfolded and back very easily;

  • quick navigation between existing folds;

  • you can use mouse to unfold folds (good for beginners and not only for them);

  • for fans of the avy package: you can use avy to fold text with minimal number of key strokes!

Installation

If you would like to install the package manually, download or clone it and put on Emacs' load-path, then you can require it in your init file like this:

(require 'vimish-fold)

It's available via MELPA, so you can just M-x package-install RET vimish-fold RET.

Usage

First of all, create global key bindings for most important functions:

  • vimish-fold creates folds;
  • vimish-fold-delete deletes folds.

When point is inside of a fold you can toggle it with C-`, so usually you don't need to bind toggling functions.

Minimal code creating the keybindings might look like this:

(global-set-key (kbd "<menu> v f") #'vimish-fold)
(global-set-key (kbd "<menu> v v") #'vimish-fold-delete)

Of course you can choose different key bindings.

Other functions that constitute API of the package:

  • vimish-fold-unfold
  • vimish-fold-unfold-all
  • vimish-fold-refold
  • vimish-fold-refold-all
  • vimish-fold-delete-all
  • vimish-fold-toggle
  • vimish-fold-toggle-all
  • vimish-fold-avy (requires avy package)
  • vimish-fold-from-marks

To get persistent folds you need to enable a minor mode provided by the package. You can turn vimish-fold-mode selectively for modes where you want to have persistent folding, or simply activate it everywhere:

(vimish-fold-global-mode 1)

Customization

There are a number of customization options that are available via M-x customize-group vimish-fold. Everything is carefully documented, as always.

License

This work is based on Magnar Sveen's fold-this package to some extent, so I think I should include him as an author, thanks Magnar!

Copyright © 2015–present Mark Karpov
Copyright © 2012–2013 Magnar Sveen

Distributed under GNU GPL, version 3.

vimish-fold's People

Contributors

alexmurray avatar mrkkrp avatar niubalen avatar syohex avatar

Watchers

 avatar

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.