doomemacs/core/core-evil.el

374 lines
16 KiB
EmacsLisp
Raw Normal View History

2015-06-06 18:40:33 +08:00
;;; core-evil.el --- the root of all evil
2015-06-15 15:05:52 +08:00
;; see lib/evil-defuns.el
2015-06-06 18:40:33 +08:00
2015-06-05 06:23:21 +08:00
(use-package evil
:init
;; highlight matching delimiters where it's important
(defun show-paren-mode-off () (show-paren-mode -1))
(add-hook! evil-insert-state-entry 'show-paren-mode)
(add-hook! evil-insert-state-exit 'show-paren-mode-off)
(add-hook! evil-visual-state-entry 'show-paren-mode)
(add-hook! evil-visual-state-exit 'show-paren-mode-off)
(add-hook! evil-motion-state-entry 'show-paren-mode)
(add-hook! evil-motion-state-exit 'show-paren-mode-off)
(add-hook! evil-operator-state-entry 'show-paren-mode)
(add-hook! evil-operator-state-exit 'show-paren-mode-off)
;; Disable highlights on insert-mode
(add-hook! evil-insert-state-entry 'evil-ex-nohighlight)
2015-06-05 06:23:21 +08:00
:config
2016-01-23 08:34:14 +08:00
(setq-default
evil-magic t
evil-want-C-u-scroll t ; enable C-u for scrolling
evil-ex-visual-char-range t ; column range for ex commands
evil-want-visual-char-semi-exclusive t
evil-ex-search-vim-style-regexp t
evil-ex-interactive-search-highlight 'selected-window
evil-echo-state nil
evil-ex-substitute-global t
evil-insert-skip-empty-lines t
2015-12-23 15:40:41 +08:00
2016-01-23 08:34:14 +08:00
evil-normal-state-tag "N"
evil-insert-state-tag "I"
evil-visual-state-tag "V"
evil-emacs-state-tag "E"
evil-operator-state-tag "O"
evil-motion-state-tag "M"
evil-replace-state-tag "R"
evil-iedit-state-tag "R+"
2015-11-25 19:00:49 +08:00
2016-01-23 08:34:14 +08:00
;; Color-coded state cursors
evil-default-cursor "orange"
evil-normal-state-cursor 'box
evil-emacs-state-cursor '("cyan" box)
evil-insert-state-cursor 'bar
evil-visual-state-cursor 'hollow
evil-iedit-state-cursor 'box)
2015-06-06 18:40:33 +08:00
2016-01-28 09:08:00 +08:00
;; NOTE: a bug in emacs 25 breaks undoing in evil. See
;; https://bitbucket.org/lyro/evil/issues/594/undo-doesnt-behave-like-vim
(setq-default evil-want-fine-undo (if (> emacs-major-version 24) 'fine 'no))
2015-06-06 18:40:33 +08:00
(evil-mode 1)
(evil-select-search-module 'evil-search-module 'evil-search)
2015-06-15 15:05:52 +08:00
2015-10-28 15:31:51 +08:00
(evil-define-key 'normal evil-command-window-mode-map [escape] 'kill-buffer-and-window)
2015-06-06 18:40:33 +08:00
;; modes to map to different default states
2015-12-23 15:40:41 +08:00
(dolist (mode-map '((compilation-mode . normal)
(help-mode . normal)
(message-mode . normal)
(debugger-mode . normal)
(profile-report-mode . emacs)
(Info-mode . emacs)
(view-mode . emacs)
(comint-mode . emacs)
(cider-repl-mode . emacs)
(term-mode . emacs)
(calendar-mode . emacs)
(Man-mode . emacs)
(grep-mode . emacs)
(image-mode . normal)
2015-11-25 19:00:49 +08:00
))
2015-06-06 18:40:33 +08:00
(evil-set-initial-state `,(car mode-map) `,(cdr mode-map)))
;; Shortcuts for the evil expression register
(defmacro $= (str &rest args)
`(calc-eval (format ,str ,@args)))
(defmacro $r (char)
`(evil-get-register ,char))
(defmacro $expand (path)
`(evil-ex-replace-special-filenames ,path))
NARF v0.7.0 vcs: + +git-gutter to conf-modes; -git-gutter from evil-insert-state-exit + switch github-browse-file for browse-at-remote + fix <leader>ob; add <leader>d[./sr] vc bindings + vc-annotate bindings and initial state Workgroups2 integration: + don't mess with buffers (speeds up emacs a lot!) + unicode numbers in display + single display function + remember workgroup uid instead (and smarter :tabrename) + clean up after wg update Org-mode + give highlight precedence to links in org-mode + enable encryption + config clean up + use different font for org + exclude attachments in recentf + redo latex and inline-image config + add narf/org-open-notes + update file templates for org CRM Mode-line + polish mode-line + decouple from spaceline-segments.el + refactor narf|spaceline-env-update + add macro-recording and buffer-size indicators to mode-line + python: '2>&1' in env-command + flycheck fringe indicator: change to arrow Aesthetics + update narf-dark-theme + add narf-minibuffer-active face + change writing indicator in writing-mode Misc + fix whitespace in display-startup-echo-area-message + reset fonts for more unicode characters + custom imenu entries + helm-imenu fontification + enable yascroll-bar in REPLs + reorganize my-commands.el + force quit iedit on ESC in normal mode + update snippets submodule + remove ido init (helm handles it all) [EXPERIMENTAL] + back to Terminus(TTF) font + popwin: update config for git-gutter and vc-diff windows + highlight :g[lobal] and :al[ign] matches + decouple narf/get-buffers+narf/get-all-buffers from wg-mess-with-buffer-list + fix narf/helm-buffers-dwim (add interactive form)
2015-12-12 05:51:04 +08:00
;; buffer-local ex commands, thanks to:
;; http://emacs.stackexchange.com/questions/13186
(defun evil-ex-define-cmd-local (cmd function)
"Locally binds the function FUNCTION to the command CMD."
(unless (local-variable-p 'evil-ex-commands)
(setq-local evil-ex-commands (copy-alist evil-ex-commands)))
(evil-ex-define-cmd cmd function))
;; Shortcuts for `evil-ex-define-cmd'
(defalias 'exmap 'evil-ex-define-cmd)
(defalias 'exmap! 'evil-ex-define-cmd-local)
2015-06-06 18:40:33 +08:00
(progn ; evil hacks
2015-10-28 15:31:51 +08:00
(defadvice evil-force-normal-state (after evil-esc-quit activate)
2015-11-19 18:55:21 +08:00
"Close popups, disable search highlights and quit the minibuffer if open."
2015-12-23 15:40:41 +08:00
(when (minibuffer-window-active-p (minibuffer-window))
(narf-minibuffer-quit))
2015-06-06 18:40:33 +08:00
(ignore-errors
(evil-ex-nohighlight))
2015-12-23 15:40:41 +08:00
(unless (bound-and-true-p org-src-mode)
(narf/popup-close)))
;; Fix disruptive errors w/ hidden buffers caused by workgroups killing windows
;; TODO Delete timer on dead windows
(defadvice evil-ex-hl-do-update-highlight (around evil-ex-hidden-buffer-ignore-errors activate)
(ignore-errors ad-do-it))
;; Monkey-patch an error triggered randomly during column-selection caused
2015-12-11 05:15:09 +08:00
;; by `evil-move-to-column' receiving a float:
;; evil-move-to-column: Wrong type argument: wholenump, 12.0
2015-12-11 05:15:09 +08:00
(defun narf*evil-move-to-column-fix (args)
(mapcar (lambda (i) (if (numberp i) (truncate i) i)) args))
2015-12-11 05:15:09 +08:00
(advice-add 'evil-move-to-column :filter-args 'narf*evil-move-to-column-fix)
(advice-add 'extract-rectangle-line :filter-args 'narf*evil-move-to-column-fix)
2015-06-15 15:05:52 +08:00
;; Hide keystroke display while isearch is active
(add-hook! isearch-mode (setq echo-keystrokes 0))
(add-hook! isearch-mode-end (setq echo-keystrokes 0.02))
2015-10-28 15:31:51 +08:00
(let ((map evil-ex-search-keymap))
(define-key map "\C-w" 'backward-kill-word)
2015-11-10 04:55:03 +08:00
(define-key map "\C-u" 'evil-delete-whole-line))
2015-10-28 15:31:51 +08:00
2015-10-25 12:39:22 +08:00
;; Repeat motions with SPC/S-SPC
(defmacro narf-space-setup! (command next-func prev-func)
`(defadvice ,command
(before ,(intern (format "narf-space--%s" (symbol-name command))) activate)
(define-key evil-motion-state-map (kbd "SPC") ',next-func)
(define-key evil-motion-state-map (kbd "S-SPC") ',prev-func)))
(after! evil-snipe
(narf-space-setup! evil-snipe-f evil-snipe-repeat evil-snipe-repeat-reverse)
(narf-space-setup! evil-snipe-F evil-snipe-repeat evil-snipe-repeat-reverse)
(narf-space-setup! evil-snipe-t evil-snipe-repeat evil-snipe-repeat-reverse)
(narf-space-setup! evil-snipe-T evil-snipe-repeat evil-snipe-repeat-reverse)
(narf-space-setup! evil-snipe-s evil-snipe-repeat evil-snipe-repeat-reverse)
(narf-space-setup! evil-snipe-S evil-snipe-repeat evil-snipe-repeat-reverse)
(narf-space-setup! evil-snipe-x evil-snipe-repeat evil-snipe-repeat-reverse)
(narf-space-setup! evil-snipe-X evil-snipe-repeat evil-snipe-repeat-reverse))
(after! evil-visualstar
(narf-space-setup! evil-visualstar/begin-search-forward evil-ex-search-next evil-ex-search-previous)
(narf-space-setup! evil-visualstar/begin-search-backward evil-ex-search-previous evil-ex-search-next))
(narf-space-setup! evil-ex-search-next evil-ex-search-next evil-ex-search-previous)
(narf-space-setup! evil-ex-search-previous evil-ex-search-next evil-ex-search-previous)
(narf-space-setup! evil-ex-search-forward evil-ex-search-next evil-ex-search-previous)
2015-11-17 15:04:30 +08:00
(narf-space-setup! evil-ex-search-backward evil-ex-search-next evil-ex-search-previous)
;; A monkey patch to add several substitutions to evil-mode's ex commandline
;; other than % and #...
;;
;; % => full path to file (/project/src/thing.c)
;; # => alternative file path (/project/include/thing.h)
;; %:p => path to project root (/project/)
;; %:d => path to current directory (/project/src/)
;; %:e => the file's extension (c)
;; %:r => the full path without its extension (/project/src/thing)
;; %:t => the file's basename (thing.c)
;;
;; Requires projectile (https://github.com/bbatsov/projectile) for
;; project-awareness, and f.el (https://github.com/rejeep/f.el) for file
;; functions.
(defun evil-ex-replace-special-filenames (file-name)
"Replace special symbols in FILE-NAME."
(let ((current-fname (buffer-file-name))
(alternate-fname (and (other-buffer)
(buffer-file-name (other-buffer)))))
(setq file-name
;; %:p:h => the project root (or current directory otherwise)
(replace-regexp-in-string "\\(^\\|[^\\\\]\\)\\(%:p\\)"
2016-01-22 08:35:01 +08:00
(narf/project-root) file-name t t 2))
2015-11-17 15:04:30 +08:00
(setq file-name
2016-01-22 08:35:01 +08:00
;; %:p => the current directory
2015-11-17 15:04:30 +08:00
(replace-regexp-in-string "\\(^\\|[^\\\\]\\)\\(%:d\\)"
default-directory file-name t t 2))
(when current-fname
(setq file-name
;; %:e => ext
(replace-regexp-in-string "\\(^\\|[^\\\\]\\)\\(%:e\\)"
(f-ext current-fname) file-name t t 2))
(setq file-name
;; %:r => filename
(replace-regexp-in-string "\\(^\\|[^\\\\]\\)\\(%:r\\)"
(f-no-ext current-fname) file-name t t 2))
(setq file-name
;; %:t => filename.ext
(replace-regexp-in-string "\\(^\\|[^\\\\]\\)\\(%:t\\)"
(f-base current-fname) file-name t t 2))
(setq file-name
;; % => file path for current frame
(replace-regexp-in-string "\\(^\\|[^\\\\]\\)\\(%\\)"
current-fname file-name t t 2)))
(when alternate-fname
(setq file-name
;; # => file path for alternative frame
(replace-regexp-in-string "\\(^\\|[^\\\\]\\)\\(#\\)"
alternate-fname file-name t t 2)))
(setq file-name
(replace-regexp-in-string "\\\\\\([#%]\\)"
"\\1" file-name t)))
file-name))
NARF v0.7.0 vcs: + +git-gutter to conf-modes; -git-gutter from evil-insert-state-exit + switch github-browse-file for browse-at-remote + fix <leader>ob; add <leader>d[./sr] vc bindings + vc-annotate bindings and initial state Workgroups2 integration: + don't mess with buffers (speeds up emacs a lot!) + unicode numbers in display + single display function + remember workgroup uid instead (and smarter :tabrename) + clean up after wg update Org-mode + give highlight precedence to links in org-mode + enable encryption + config clean up + use different font for org + exclude attachments in recentf + redo latex and inline-image config + add narf/org-open-notes + update file templates for org CRM Mode-line + polish mode-line + decouple from spaceline-segments.el + refactor narf|spaceline-env-update + add macro-recording and buffer-size indicators to mode-line + python: '2>&1' in env-command + flycheck fringe indicator: change to arrow Aesthetics + update narf-dark-theme + add narf-minibuffer-active face + change writing indicator in writing-mode Misc + fix whitespace in display-startup-echo-area-message + reset fonts for more unicode characters + custom imenu entries + helm-imenu fontification + enable yascroll-bar in REPLs + reorganize my-commands.el + force quit iedit on ESC in normal mode + update snippets submodule + remove ido init (helm handles it all) [EXPERIMENTAL] + back to Terminus(TTF) font + popwin: update config for git-gutter and vc-diff windows + highlight :g[lobal] and :al[ign] matches + decouple narf/get-buffers+narf/get-all-buffers from wg-mess-with-buffer-list + fix narf/helm-buffers-dwim (add interactive form)
2015-12-12 05:51:04 +08:00
;; Make :g[lobal] highlight matches
(defvar narf-buffer-match-global evil-ex-substitute-global "")
(defun narf--ex-buffer-match (flag &optional arg)
(let ((hl-name 'evil-ex-buffer-match))
(with-selected-window (minibuffer-selected-window)
(narf/-ex-match-init hl-name)
(narf/-ex-buffer-match arg hl-name (list (if narf-buffer-match-global ?g))))))
(defun narf--ex-global-match (flag &optional arg)
(let ((hl-name 'evil-ex-global-match))
(with-selected-window (minibuffer-selected-window)
(narf/-ex-match-init hl-name)
(let ((result (car-safe (evil-ex-parse-global arg))))
(narf/-ex-buffer-match result hl-name nil (point-min) (point-max))))))
(evil-ex-define-argument-type buffer-match :runner narf--ex-buffer-match)
(evil-ex-define-argument-type global-match :runner narf--ex-global-match)
(evil-define-interactive-code "<//>"
:ex-arg buffer-match
(list (when (evil-ex-p) evil-ex-argument)))
NARF v0.7.0 vcs: + +git-gutter to conf-modes; -git-gutter from evil-insert-state-exit + switch github-browse-file for browse-at-remote + fix <leader>ob; add <leader>d[./sr] vc bindings + vc-annotate bindings and initial state Workgroups2 integration: + don't mess with buffers (speeds up emacs a lot!) + unicode numbers in display + single display function + remember workgroup uid instead (and smarter :tabrename) + clean up after wg update Org-mode + give highlight precedence to links in org-mode + enable encryption + config clean up + use different font for org + exclude attachments in recentf + redo latex and inline-image config + add narf/org-open-notes + update file templates for org CRM Mode-line + polish mode-line + decouple from spaceline-segments.el + refactor narf|spaceline-env-update + add macro-recording and buffer-size indicators to mode-line + python: '2>&1' in env-command + flycheck fringe indicator: change to arrow Aesthetics + update narf-dark-theme + add narf-minibuffer-active face + change writing indicator in writing-mode Misc + fix whitespace in display-startup-echo-area-message + reset fonts for more unicode characters + custom imenu entries + helm-imenu fontification + enable yascroll-bar in REPLs + reorganize my-commands.el + force quit iedit on ESC in normal mode + update snippets submodule + remove ido init (helm handles it all) [EXPERIMENTAL] + back to Terminus(TTF) font + popwin: update config for git-gutter and vc-diff windows + highlight :g[lobal] and :al[ign] matches + decouple narf/get-buffers+narf/get-all-buffers from wg-mess-with-buffer-list + fix narf/helm-buffers-dwim (add interactive form)
2015-12-12 05:51:04 +08:00
(evil-define-interactive-code "<g//>"
:ex-arg global-match
NARF v0.7.0 vcs: + +git-gutter to conf-modes; -git-gutter from evil-insert-state-exit + switch github-browse-file for browse-at-remote + fix <leader>ob; add <leader>d[./sr] vc bindings + vc-annotate bindings and initial state Workgroups2 integration: + don't mess with buffers (speeds up emacs a lot!) + unicode numbers in display + single display function + remember workgroup uid instead (and smarter :tabrename) + clean up after wg update Org-mode + give highlight precedence to links in org-mode + enable encryption + config clean up + use different font for org + exclude attachments in recentf + redo latex and inline-image config + add narf/org-open-notes + update file templates for org CRM Mode-line + polish mode-line + decouple from spaceline-segments.el + refactor narf|spaceline-env-update + add macro-recording and buffer-size indicators to mode-line + python: '2>&1' in env-command + flycheck fringe indicator: change to arrow Aesthetics + update narf-dark-theme + add narf-minibuffer-active face + change writing indicator in writing-mode Misc + fix whitespace in display-startup-echo-area-message + reset fonts for more unicode characters + custom imenu entries + helm-imenu fontification + enable yascroll-bar in REPLs + reorganize my-commands.el + force quit iedit on ESC in normal mode + update snippets submodule + remove ido init (helm handles it all) [EXPERIMENTAL] + back to Terminus(TTF) font + popwin: update config for git-gutter and vc-diff windows + highlight :g[lobal] and :al[ign] matches + decouple narf/get-buffers+narf/get-all-buffers from wg-mess-with-buffer-list + fix narf/helm-buffers-dwim (add interactive form)
2015-12-12 05:51:04 +08:00
(when (evil-ex-p) (evil-ex-parse-global evil-ex-argument)))
(evil-define-operator narf:align (&optional beg end bang pattern)
(interactive "<r><!><//>")
(align-regexp
beg end
(concat "\\(\\s-*\\)"
(if bang
(regexp-quote pattern)
(rxt-pcre-to-elisp pattern)))
1 1))
(evil-define-operator narf:evil-ex-global (beg end pattern command &optional invert)
:motion mark-whole-buffer
:move-point nil
(interactive "<r><g//><!>")
(evil-ex-global beg end pattern command invert))
(exmap "g[lobal]" 'narf:evil-ex-global))
2015-06-15 15:05:52 +08:00
;; evil plugins
(use-package evil-anzu
2015-11-19 04:22:00 +08:00
:config
(setq anzu-cons-mode-line-p nil
2015-11-19 18:55:21 +08:00
anzu-minimum-input-length 2
anzu-search-threshold 500))
(use-package evil-args
:commands (evil-inner-arg evil-outer-arg evil-forward-arg evil-backward-arg evil-jump-out-args)
:init
(define-key evil-inner-text-objects-map "a" #'evil-inner-arg)
2015-11-04 12:44:54 +08:00
(define-key evil-outer-text-objects-map "a" #'evil-outer-arg))
2015-06-15 15:05:52 +08:00
(use-package evil-commentary
:commands (evil-commentary
evil-commentary-yank
evil-commentary-line)
:config (evil-commentary-mode 1))
(use-package evil-exchange
:commands evil-exchange
:config
2015-07-26 19:14:31 +08:00
(advice-add 'evil-force-normal-state :after 'narf*evil-exchange-off))
2015-06-15 15:05:52 +08:00
(use-package evil-iedit-state
:functions (iedit-current-occurrence-string iedit-restrict-region)
:commands (evil-iedit-state evil-iedit-state/iedit-mode)
:config
NARF v0.7.0 vcs: + +git-gutter to conf-modes; -git-gutter from evil-insert-state-exit + switch github-browse-file for browse-at-remote + fix <leader>ob; add <leader>d[./sr] vc bindings + vc-annotate bindings and initial state Workgroups2 integration: + don't mess with buffers (speeds up emacs a lot!) + unicode numbers in display + single display function + remember workgroup uid instead (and smarter :tabrename) + clean up after wg update Org-mode + give highlight precedence to links in org-mode + enable encryption + config clean up + use different font for org + exclude attachments in recentf + redo latex and inline-image config + add narf/org-open-notes + update file templates for org CRM Mode-line + polish mode-line + decouple from spaceline-segments.el + refactor narf|spaceline-env-update + add macro-recording and buffer-size indicators to mode-line + python: '2>&1' in env-command + flycheck fringe indicator: change to arrow Aesthetics + update narf-dark-theme + add narf-minibuffer-active face + change writing indicator in writing-mode Misc + fix whitespace in display-startup-echo-area-message + reset fonts for more unicode characters + custom imenu entries + helm-imenu fontification + enable yascroll-bar in REPLs + reorganize my-commands.el + force quit iedit on ESC in normal mode + update snippets submodule + remove ido init (helm handles it all) [EXPERIMENTAL] + back to Terminus(TTF) font + popwin: update config for git-gutter and vc-diff windows + highlight :g[lobal] and :al[ign] matches + decouple narf/get-buffers+narf/get-all-buffers from wg-mess-with-buffer-list + fix narf/helm-buffers-dwim (add interactive form)
2015-12-12 05:51:04 +08:00
(advice-add 'evil-force-normal-state :after 'evil-iedit-state/quit-iedit-mode)
2015-11-22 05:22:40 +08:00
(define-key evil-iedit-state-map (kbd "<escape>") 'evil-iedit-state/quit-iedit-mode)
2015-10-28 15:31:51 +08:00
(define-key evil-visual-state-map (kbd "SPC") 'narf:iedit-restrict-to-region)
(let ((map evil-iedit-state-map))
;; Don't interfere with evil-snipe
(define-key map "s" nil)
(define-key map "S" nil)
2015-11-10 04:55:03 +08:00
(define-key map "V" 'evil-visual-line)
(define-key map "C" 'evil-iedit-state/substitute) ; instead of s/S
(define-key map "za" 'iedit-toggle-unmatched-lines-visible)))
(use-package evil-indent-plus
:commands
(evil-indent-plus-i-indent
evil-indent-plus-a-indent
evil-indent-plus-i-indent-up
evil-indent-plus-a-indent-up
evil-indent-plus-i-indent-up-down
evil-indent-plus-a-indent-up-down)
:config
(define-key evil-inner-text-objects-map "i" 'evil-indent-plus-i-indent)
(define-key evil-outer-text-objects-map "i" 'evil-indent-plus-a-indent)
(define-key evil-inner-text-objects-map "I" 'evil-indent-plus-i-indent-up)
(define-key evil-outer-text-objects-map "I" 'evil-indent-plus-a-indent-up)
(define-key evil-inner-text-objects-map "J" 'evil-indent-plus-i-indent-up-down)
(define-key evil-outer-text-objects-map "J" 'evil-indent-plus-a-indent-up-down))
2015-06-05 06:23:21 +08:00
2015-06-15 15:05:52 +08:00
(use-package evil-matchit
:commands (evilmi-jump-items evilmi-text-object global-evil-matchit-mode)
:config (global-evil-matchit-mode 1)
:init
(define-key evil-normal-state-map "%" #'evilmi-jump-items)
(define-key evil-inner-text-objects-map "%" #'evilmi-text-object)
(define-key evil-outer-text-objects-map "%" #'evilmi-text-object))
2015-06-15 15:05:52 +08:00
(use-package evil-numbers
2015-10-01 01:47:57 +08:00
:commands (evil-numbers/inc-at-pt evil-numbers/dec-at-pt))
2015-06-15 15:05:52 +08:00
2015-11-10 04:55:03 +08:00
(use-package evil-textobj-anyblock
:commands (evil-textobj-anyblock-inner-block evil-textobj-anyblock-a-block)
:init
2015-11-10 09:49:33 +08:00
(define-key evil-inner-text-objects-map "B" 'evil-textobj-anyblock-inner-block)
(define-key evil-outer-text-objects-map "B" 'evil-textobj-anyblock-a-block))
2015-11-10 04:55:03 +08:00
2015-06-15 15:05:52 +08:00
(use-package evil-search-highlight-persist
2015-07-26 19:14:31 +08:00
:config
(global-evil-search-highlight-persist t)
(advice-add 'evil-force-normal-state :after 'evil-search-highlight-persist-remove-all))
2015-06-15 15:05:52 +08:00
(use-package evil-snipe
:init
(setq-default
evil-snipe-smart-case t
2015-10-29 05:26:54 +08:00
evil-snipe-repeat-keys nil ; using space to repeat
2015-06-15 15:05:52 +08:00
evil-snipe-scope 'line
evil-snipe-repeat-scope 'visible
2015-09-29 21:53:45 +08:00
evil-snipe-override-evil-repeat-keys nil ; causes problems with remapped ;
2015-06-15 15:05:52 +08:00
evil-snipe-symbol-groups '((?\[ "[[{(]")
2015-10-29 05:26:54 +08:00
(?\] "[]})]")
(?\; "[;:]")))
:config
2015-06-15 15:05:52 +08:00
(evil-snipe-mode 1)
(evil-snipe-override-mode 1))
(use-package evil-surround
:commands (global-evil-surround-mode
evil-surround-edit
evil-Surround-edit
evil-surround-region)
:config
(global-evil-surround-mode 1)
2015-11-11 07:10:32 +08:00
(add-hook! org-mode
(mapc (lambda (p) (add-to-list 'evil-surround-pairs-alist p))
'((?l . narf/evil-surround-latex))))
(add-hook! emacs-lisp-mode
(setq evil-surround-pairs-alist
(cons '(?\` . ("`" . "*")) evil-surround-pairs-alist)))
(add-hook! python-mode
(setq evil-surround-pairs-alist
(cons '(?d . ("\"\"\"" . "\"\"\"")) evil-surround-pairs-alist)))
2015-06-15 15:05:52 +08:00
;; Escaped surround characters
2015-11-10 04:55:03 +08:00
(setq-default evil-surround-pairs-alist
(cons '(?\\ . narf/evil-surround-escaped)
evil-surround-pairs-alist)))
2015-06-15 15:05:52 +08:00
(use-package evil-visualstar
:commands (global-evil-visualstar-mode
evil-visualstar/begin-search
evil-visualstar/begin-search-forward
evil-visualstar/begin-search-backward)
:config
(global-evil-visualstar-mode 1))
2015-06-05 06:23:21 +08:00
(provide 'core-evil)
;;; core-evil.el ends here