repalce fill-or-unfill with unfill package

This commit is contained in:
d12frosted 2016-12-14 20:51:43 +02:00
parent aaefaa3573
commit d76c5a75d5
No known key found for this signature in database
GPG Key ID: 8F60E862D6F5CE8F
3 changed files with 9 additions and 13 deletions

View File

@ -19,14 +19,3 @@
;; correctly (see https://github.com/syl20bnr/spacemacs/issues/3278)
(call-interactively #'kill-region)
(backward-kill-word arg)))
;; http://endlessparentheses.com/fill-and-unfill-paragraphs-with-a-single-key.html
(defun spacemacs/fill-or-unfill ()
"Like `fill-paragraph', but unfill if used twice."
(interactive)
(let ((fill-column
(if (eq last-command 'spacemacs/fill-or-unfill)
(progn (setq this-command nil)
(point-max))
fill-column)))
(call-interactively #'fill-paragraph)))

View File

@ -10,4 +10,3 @@
;;; License: GPLv3
(global-set-key (kbd "C-w") 'spacemacs/backward-kill-word-or-region)
(global-set-key [remap fill-paragraph] #'spacemacs/fill-or-unfill)

View File

@ -10,7 +10,8 @@
;;; License: GPLv3
(defconst better-defaults-packages
'(mwim)
'(mwim
unfill)
"The list of Lisp packages required by the mwim layer.")
(defun better-defaults/init-mwim ()
@ -25,3 +26,10 @@
(if better-defaults-move-to-end-of-code-first
(global-set-key (kbd "C-e") 'mwim-end-of-code-or-line)
(global-set-key (kbd "C-e") 'mwim-end-of-line-or-code)))))
(defun better-defaults/init-unfill ()
(use-package unfill
:defer t
:commands (unfill-region unfill-paragraph unfill-toggle)
:init
(global-set-key [remap fill-paragraph] #'unfill-toggle)))