spacemacs: move evilnc functions to evilnc init func
as well as the key bindings also import "gc" and "gy" bindings from evil-commentary
This commit is contained in:
parent
18b8e3ff76
commit
7313fdfe55
|
@ -557,48 +557,6 @@ argument takes the kindows rotate backwards."
|
|||
|
||||
(add-hook 'after-save-hook 'byte-compile-current-buffer)
|
||||
|
||||
;; doubled all the commenting functions so that the inverse operations
|
||||
;; can be called without setting a flag
|
||||
(defun comment-or-uncomment-lines-inverse (&optional NUM)
|
||||
(interactive "p")
|
||||
(let ((evilnc-invert-comment-line-by-line t))
|
||||
(evilnc-comment-or-uncomment-lines NUM)))
|
||||
|
||||
(defun comment-or-uncomment-lines (&optional NUM)
|
||||
(interactive "p")
|
||||
(let ((evilnc-invert-comment-line-by-line nil))
|
||||
(evilnc-comment-or-uncomment-lines NUM)))
|
||||
|
||||
(defun copy-and-comment-lines-inverse (&optional NUM)
|
||||
(interactive "p")
|
||||
(let ((evilnc-invert-comment-line-by-line t))
|
||||
(evilnc-copy-and-comment-lines NUM)))
|
||||
|
||||
(defun copy-and-comment-lines (&optional NUM)
|
||||
(interactive "p")
|
||||
(let ((evilnc-invert-comment-line-by-line nil))
|
||||
(evilnc-copy-and-comment-lines NUM)))
|
||||
|
||||
(defun quick-comment-or-uncomment-to-the-line-inverse (&optional NUM)
|
||||
(interactive "p")
|
||||
(let ((evilnc-invert-comment-line-by-line t))
|
||||
(evilnc-comment-or-uncomment-to-the-line NUM)))
|
||||
|
||||
(defun quick-comment-or-uncomment-to-the-line (&optional NUM)
|
||||
(interactive "p")
|
||||
(let ((evilnc-invert-comment-line-by-line nil))
|
||||
(evilnc-comment-or-uncomment-to-the-line NUM)))
|
||||
|
||||
(defun comment-or-uncomment-paragraphs-inverse (&optional NUM)
|
||||
(interactive "p")
|
||||
(let ((evilnc-invert-comment-line-by-line t))
|
||||
(evilnc-comment-or-uncomment-paragraphs NUM)))
|
||||
|
||||
(defun comment-or-uncomment-paragraphs (&optional NUM)
|
||||
(interactive "p")
|
||||
(let ((evilnc-invert-comment-line-by-line nil))
|
||||
(evilnc-comment-or-uncomment-paragraphs NUM)))
|
||||
|
||||
;; From http://xugx2007.blogspot.ca/2007/06/benjamin-rutts-emacs-c-development-tips.html
|
||||
(setq compilation-finish-function
|
||||
(lambda (buf str)
|
||||
|
|
|
@ -154,15 +154,6 @@ Ensure that helm is required before calling FUNC."
|
|||
(evil-leader/set-key "cc" 'helm-make-projectile)
|
||||
(evil-leader/set-key "cC" 'compile)
|
||||
(evil-leader/set-key "cr" 'recompile)
|
||||
;; Commenting -----------------------------------------------------------------
|
||||
(evil-leader/set-key "cl" 'comment-or-uncomment-lines)
|
||||
(evil-leader/set-key "cL" 'comment-or-uncomment-lines-inverse)
|
||||
(evil-leader/set-key "cp" 'comment-or-uncomment-paragraphs)
|
||||
(evil-leader/set-key "cP" 'comment-or-uncomment-paragraphs-inverse)
|
||||
(evil-leader/set-key "ct" 'quick-comment-or-uncomment-to-the-line)
|
||||
(evil-leader/set-key "cT" 'quick-comment-or-uncomment-to-the-line-inverse)
|
||||
(evil-leader/set-key "cy" 'copy-and-comment-lines)
|
||||
(evil-leader/set-key "cY" 'copy-and-comment-lines-inverse)
|
||||
;; narrow & widen -------------------------------------------------------------
|
||||
(evil-leader/set-key
|
||||
"nr" 'narrow-to-region
|
||||
|
|
|
@ -1028,12 +1028,65 @@ Example: (evil-map visual \"<\" \"<gv\")"
|
|||
;; other commenting functions in funcs.el with keybinds in keybindings.el
|
||||
(defun spacemacs/init-evil-nerd-commenter ()
|
||||
(use-package evil-nerd-commenter
|
||||
:commands (evilnc-comment-operator)
|
||||
:commands evilnc-comment-operator
|
||||
:init
|
||||
(progn
|
||||
(evil-leader/set-key
|
||||
";" 'evilnc-comment-operator))))
|
||||
;; double all the commenting functions so that the inverse operations
|
||||
;; can be called without setting a flag
|
||||
(defun spacemacs/comment-or-uncomment-lines-inverse (&optional arg)
|
||||
(interactive "p")
|
||||
(let ((evilnc-invert-comment-line-by-line t))
|
||||
(evilnc-comment-or-uncomment-lines arg)))
|
||||
|
||||
(defun spacemacs/comment-or-uncomment-lines (&optional arg)
|
||||
(interactive "p")
|
||||
(let ((evilnc-invert-comment-line-by-line nil))
|
||||
(evilnc-comment-or-uncomment-lines arg)))
|
||||
|
||||
(defun spacemacs/copy-and-comment-lines-inverse (&optional arg)
|
||||
(interactive "p")
|
||||
(let ((evilnc-invert-comment-line-by-line t))
|
||||
(evilnc-copy-and-comment-lines arg)))
|
||||
|
||||
(defun spacemacs/copy-and-comment-lines (&optional arg)
|
||||
(interactive "p")
|
||||
(let ((evilnc-invert-comment-line-by-line nil))
|
||||
(evilnc-copy-and-comment-lines arg)))
|
||||
|
||||
(defun spacemacs/quick-comment-or-uncomment-to-the-line-inverse
|
||||
(&optional arg)
|
||||
(interactive "p")
|
||||
(let ((evilnc-invert-comment-line-by-line t))
|
||||
(evilnc-comment-or-uncomment-to-the-line arg)))
|
||||
|
||||
(defun spacemacs/quick-comment-or-uncomment-to-the-line (&optional arg)
|
||||
(interactive "p")
|
||||
(let ((evilnc-invert-comment-line-by-line nil))
|
||||
(evilnc-comment-or-uncomment-to-the-line arg)))
|
||||
|
||||
(defun spacemacs/comment-or-uncomment-paragraphs-inverse (&optional arg)
|
||||
(interactive "p")
|
||||
(let ((evilnc-invert-comment-line-by-line t))
|
||||
(evilnc-comment-or-uncomment-paragraphs arg)))
|
||||
|
||||
(defun spacemacs/comment-or-uncomment-paragraphs (&optional arg)
|
||||
(interactive "p")
|
||||
(let ((evilnc-invert-comment-line-by-line nil))
|
||||
(evilnc-comment-or-uncomment-paragraphs arg)))
|
||||
|
||||
(define-key evil-normal-state-map "gc" 'evilnc-comment-operator)
|
||||
(define-key evil-normal-state-map "gy" 'spacemacs/copy-and-comment-lines)
|
||||
|
||||
(evil-leader/set-key
|
||||
";" 'evilnc-comment-operator
|
||||
"cl" 'spacemacs/comment-or-uncomment-lines
|
||||
"cL" 'spacemacs/comment-or-uncomment-lines-inverse
|
||||
"cp" 'spacemacs/comment-or-uncomment-paragraphs
|
||||
"cP" 'spacemacs/comment-or-uncomment-paragraphs-inverse
|
||||
"ct" 'spacemacs/quick-comment-or-uncomment-to-the-line
|
||||
"cT" 'spacemacs/quick-comment-or-uncomment-to-the-line-inverse
|
||||
"cy" 'spacemacs/copy-and-comment-lines
|
||||
"cY" 'spacemacs/copy-and-comment-lines-inverse))))
|
||||
|
||||
(defun spacemacs/init-evil-matchit ()
|
||||
(use-package evil-matchit
|
||||
|
|
Loading…
Reference in a new issue