I am using
web-mode to fold/unfold code. When I fold code, kill buffer and re open it, code folding disappears.
How to preserve code folding even after killing and reopening buffer?
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.Sign up to join this community
I've tried Vimish fold, and it seems to do what you ask. Below is my setup for the keybindings:
(require 'vimish-fold) (vimish-fold-global-mode 1) ;; this registers a region for future folding/unfolding (global-set-key (kbd "C-c v") #'vimish-fold) ;; this unregisters the region under point from folding/unfolding (global-set-key (kbd "C-c d") #'vimish-fold-delete) ;; this is the actual fold/unfold command (global-set-key (kbd "C-c t") #'vimish-fold-toggle)
I think Mark is the author of this mode, so, maybe he'll chime in and write something about it too.