Skip to content

Latest commit

 

History

History
107 lines (73 loc) · 3.12 KB

README.md

File metadata and controls

107 lines (73 loc) · 3.12 KB

Evil vimish-fold

License GPL 3 MELPA Build Status

Integration of vimish-fold with evil

Adds standard vim keybindings of zf and zd to create and delete folds (via vimish-fold) respectively. Also hooks into evil so the usual vim keybindings for fold toggling (za), opening (zo), closing (zc) etc all work as expected with vimish-fold.

Finally, also supports navigation between folds using zj and zk.

This provides a near-complete vim folding experience in evil for Emacs.

Installation

MELPA

The preferred way to install evil-vimish-fold is via MELPA. You can just M-x package-install RET evil-vimish-fold RET.

Manual

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

(require 'evil-vimish-fold)

NOTE: This will also require the manual installation of evil and vimish-fold if you have not done so already.

Configuration

You can configure evil-vimish-fold to run on a per mode basis using hooks or as a global mode activated on specific modes.

By default, global-evil-vimish-fold-mode will enable evil-vimish-fold-mode in modes derived from those specified in evil-vimish-fold-target-modes. By default evil-vimish-fold-target-modes is set to prog-mode (and thus all modes derived from prog-mode). This will allow you to avoid having evil-vimish-mode enabled in modes where its key bindings conflict, e.g., magit.

Vanilla configuration examples

Per mode (no use of global mode):

(add-hook 'prog-mode-hook 'evil-vimish-fold-mode)
(add-hook 'text-mode-hook 'evil-vimish-fold-mode)

Globally for a set of modes:

(setq evil-vimish-fold-target-modes '(prog-mode conf-mode text-mode))
(global-evil-vimish-fold-mode 1)

use-package configuration examples

A configuration using mode hooks (no use of global mode):

(use-package vimish-fold
  :ensure
  :after evil)

(use-package evil-vimish-fold
  :ensure
  :after vimish-fold
  :hook ((prog-mode conf-mode text-mode) . evil-vimish-fold-mode))

or

A configuration that sets the lighter, i.e., visual indicator of the mode's activation in the modeline, sets target modes, then turns on global mode:

(use-package vimish-fold
  :ensure
  :after evil)

(use-package evil-vimish-fold
  :ensure
  :after vimish-fold
  :init
  (setq evil-vimish-fold-mode-lighter "")
  (setq evil-vimish-fold-target-modes '(prog-mode conf-mode text-mode))
  :config
  (global-evil-vimish-fold-mode))

License

Copyright © 2015 Alex Murray

Distributed under GNU GPL, version 3.