From d3bf6ec34bfa9f5c7e4182e308015f4f17d14db3 Mon Sep 17 00:00:00 2001 From: Keith Pinson Date: Wed, 14 Oct 2020 15:44:55 -0400 Subject: [PATCH] [editing] Integrate evil-vimish-fold via dotspacemacs-folding-method Not confident that I have plugged this in everywhere that I should have. However I tested locally and it seems to be working. --- CHANGELOG.org | 6 ++++-- core/core-dotspacemacs.el | 2 +- core/templates/.spacemacs.template | 2 +- layers/+spacemacs/spacemacs-editing/README.org | 2 +- layers/+spacemacs/spacemacs-editing/packages.el | 14 ++++++++++++++ layers/LAYERS.org | 2 +- 6 files changed, 22 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.org b/CHANGELOG.org index 539f8911068a..a6bea1730a1d 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -1310,7 +1310,7 @@ =dotspacemacs-command-key=. This variable represents the key to press after the leader key to execute =M-x=. Default value is ~SPC~. - New variable =dotspacemacs-folding-method= to allow choosing between - different code folding methods. Currently supported are =evil= and =origami=. + different code folding methods. Currently supported are =evil=, =origami= and =vimish=. Default value is =evil=. (thanks to ralesi) - New variable =dotspacemacs-ex-substitute-global=, if non-nil then the behavior of the =g= flag in =:substitute= ex-command is inverted. @@ -1342,7 +1342,9 @@ *** Distribution layer changes - Add package =evil-ediff= (thanks to justbur) - Add package =evil-visual-mark-mode= (thanks to nixmaniack) -- Add package =origmai= (used only if new variable =dotspacemacs-folding-method= +- Add packages =vimish-fold= and =evil-vimish-fold= (used only if new variable =dotspacemacs-folding-method= + is set to =origami=) (thanks to Keith Pinson) +- Add package =origami= (used only if new variable =dotspacemacs-folding-method= is set to =origami=) (thanks to ralesi) - Add package =link-hint=: - ~SPC x o~ to use avy to select a link in the frame and open it diff --git a/core/core-dotspacemacs.el b/core/core-dotspacemacs.el index 0514ab011007..468ac360cb3c 100644 --- a/core/core-dotspacemacs.el +++ b/core/core-dotspacemacs.el @@ -243,7 +243,7 @@ pressing ` m`. Set it to `nil` to disable it.") running Emacs in terminal.") (defvar dotspacemacs-folding-method 'evil - "Code folding method. Possible values are `evil' and `origami'.") + "Code folding method. Possible values are `evil', `origami' and `vimish'.") (defvar dotspacemacs-default-layout-name "Default" "Name of the default layout.") diff --git a/core/templates/.spacemacs.template b/core/templates/.spacemacs.template index a426ecd57e57..db2fa6ee35f9 100644 --- a/core/templates/.spacemacs.template +++ b/core/templates/.spacemacs.template @@ -376,7 +376,7 @@ It should only modify the values of Spacemacs settings." ;; (default nil) dotspacemacs-line-numbers nil - ;; Code folding method. Possible values are `evil' and `origami'. + ;; Code folding method. Possible values are `evil', `origami' and `vimish'. ;; (default 'evil) dotspacemacs-folding-method 'evil diff --git a/layers/+spacemacs/spacemacs-editing/README.org b/layers/+spacemacs/spacemacs-editing/README.org index ca5fe4c14b15..26d75f3f9713 100644 --- a/layers/+spacemacs/spacemacs-editing/README.org +++ b/layers/+spacemacs/spacemacs-editing/README.org @@ -20,7 +20,7 @@ This layer adds packages to improve editing with Spacemacs. - Support for selecting, copying and opening links using =avy= via =link-hint=. - Adding of sample text via =lorem-ipsum=. - Transient state for moving text via =move-text=. -- Support for folding of code via =origami=. +- Support for folding of code via =origami= and =evil-vimish-fold=. - Support for password generation via =password-generator=. - Support for improving parenthesis handling via =smartparens=. - Automatic whitespace cleanup on save via =spacemacs-whitespace-cleanup=. diff --git a/layers/+spacemacs/spacemacs-editing/packages.el b/layers/+spacemacs/spacemacs-editing/packages.el index 0bd2a50f5349..2cd50cab91d0 100644 --- a/layers/+spacemacs/spacemacs-editing/packages.el +++ b/layers/+spacemacs/spacemacs-editing/packages.el @@ -31,6 +31,8 @@ string-inflection undo-tree uuidgen + (vimish-fold :toggle (eq 'vimish dotspacemacs-folding-method)) + (evil-vimish-fold :toggle (eq 'vimish dotspacemacs-folding-method)) ws-butler)) ;; Initialization of packages @@ -275,6 +277,18 @@ ;; Note: The key binding for the fold transient state is defined in ;; evil config +(defun spacemacs-editing/init-vimish-fold () + (use-package vimish-fold + :ensure + :after evil)) + +(defun spacemacs-editing/init-evil-vimish-fold () + (use-package evil-vimish-fold + :ensure + :after vimish-fold + :init + (setq evil-vimish-fold-target-modes '(prog-mode conf-mode text-mode)) + :config (global-evil-vimish-fold-mode))) (defun spacemacs-editing/init-password-generator () (use-package password-generator diff --git a/layers/LAYERS.org b/layers/LAYERS.org index c020424ca899..364615ba042b 100644 --- a/layers/LAYERS.org +++ b/layers/LAYERS.org @@ -840,7 +840,7 @@ Features: - Support for selecting, copying and opening links using =avy= via =link-hint=. - Adding of sample text via =lorem-ipsum=. - Transient state for moving text via =move-text=. -- Support for folding of code via =origami=. +- Support for folding of code via =origami= or =evil-vimish-fold=. - Support for password generation via =password-generator=. - Support for improving parenthesis handling via =smartparens=. - Automatic whitespace cleanup on save via =spacemacs-whitespace-cleanup=.