enter image description here

evil-vimish-fold is really great for custom folds. However it's not clear to me how you would accomplish syntax based folds.

Does evil-vimish-fold work with JavaScript mode? Can I set evil-vimish-fold's foldmethod

The following is what I would do in vim ftplugin/javascript.vim

syntax region foldBraces start=/{/ end=/}/ transparent fold keepend extend
setlocal foldmethod=syntax
setlocal foldlevel=99
  • In addition to asking this forum to invent a new feature, you may wish to consider opening an issue on Github as a "feature request". The author of this library created it not too long ago -- it is still in its infancy.
    – lawlist
    Commented Jul 20, 2016 at 0:14

1 Answer 1


This answer does not address evil-vimish-mode. Instead, if you're agnostic about which particular package does the folding for you, you can try the built-in Hideshow mode (manual, wiki page).

From the manual:

Hideshow mode is a buffer-local minor mode that allows you to selectively display portions of a program, which are referred to as blocks. Type M-x hs-minor-mode to toggle this minor mode (see Minor Modes).

When you use Hideshow mode to hide a block, the block disappears from the screen, to be replaced by an ellipsis (three periods in a row). Just what constitutes a block depends on the major mode. In C mode and related modes, blocks are delimited by braces...

You can enable it with:

(add-hook 'js-mode-hook #'hs-minor-mode)

It's got some odd default keybindings (C-c @ ...), so you'll probably want to rebind them to something more comfortable.

Here's an old blog post from Emacs-Fu that describes Hideshow. For an example with JavaScript, see this old blog post where it discusses "Code Folding."

  • I kind of wish manual folding and hideshow were rolled into one. But this minor mode totally gets the job done. Thanks.
    – Tom
    Commented Aug 4, 2016 at 19:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.