-
Notifications
You must be signed in to change notification settings - Fork 2
/
evil-mc-extras.el
78 lines (63 loc) · 2.13 KB
/
evil-mc-extras.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
;;; evil-mc-extras.el --- Extra functionality for evil-mc
;; Copyright @ 2016 Gabriel Adomnicai <[email protected]>
;; Author: Gabriel Adomnicai <[email protected]>
;; Maintainer: Gabriel Adomnicai <[email protected]>
;; Version: 0.0.1
;; Keywords: evil editing multiple-cursors vim evil-multiple-cursors evil-mc evil-mc-extras
;; Homepage: https://github.com/gabesoft/evil-mc-extras
;;
;; Package-Requires: ((emacs "24.3") (evil "1.2.12") (cl-lib "0.5") (evil-mc "0.0.2") (evil-numbers "0.4"))
;; This file is NOT part of GNU Emacs.
;;; Commentary:
;; This library provides functions that build upon the core functionality from evil-mc
;;
;; Install:
;;
;; (require 'evil-mc-extras)
;;
;;
;; Usage:
;;
;; (evil-mc-extras-mode 1) ; enable for a single buffer
;;
;; (global-evil-mc-extras-mode 1) ; enable for all buffers
;;
;;
;; See the README for more details
;;; Code:
(require 'evil)
(require 'evil-mc-extras-num)
(defvar evil-mc-extras-key-map
(let ((map (make-sparse-keymap))
(keys '(("gr+" . evil-mc-inc-num-at-each-cursor)
("gr-" . evil-mc-dec-num-at-each-cursor))))
(dolist (key-data keys)
(evil-define-key 'normal map (kbd (car key-data)) (cdr key-data))
(evil-define-key 'visual map (kbd (car key-data)) (cdr key-data)))
map))
;;;###autoload
(define-minor-mode evil-mc-extras-mode
"Toggle evil multiple cursors extras in a single buffer."
:group 'evil-mc-extras
:init-value nil
:keymap evil-mc-extras-key-map
(evil-normalize-keymaps))
(put 'evil-mc-extras-mode 'permanent-local t)
(define-globalized-minor-mode global-evil-mc-extras-mode
evil-mc-extras-mode evil-mc-extras-initialize)
;;;###autoload
(defun evil-mc-extras-initialize ()
"Enable `evil-mc-extras-mode' in the current buffer."
(evil-mc-extras-mode 1))
;;;###autoload
(defun turn-on-evil-mc-extras-mode ()
"Turn on `evil-mc-extras-mode' in the current buffer."
(interactive)
(evil-mc-extras-mode 1))
;;;###autoload
(defun turn-off-evil-mc-extras-mode ()
"Turn off `evil-mc-extras-mode' in the current buffer."
(interactive)
(evil-mc-extras-mode -1))
(provide 'evil-mc-extras)
;;; evil-mc-extras.el ends here