Move iedit layer to spacemacs layer

This commit is contained in:
syl20bnr 2014-12-17 21:26:52 -05:00
parent 0b073dbaa1
commit 24fbeb4aed
7 changed files with 146 additions and 357 deletions

View file

@ -1,108 +0,0 @@
# iedit contribution layer for Spacemacs
<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc/generate-toc again -->
**Table of Contents**
- [iedit contribution layer for Spacemacs](#iedit-contribution-layer-for-spacemacs)
- [Install](#install)
- [Key bindings](#key-bindings)
- [State transitions](#state-transitions)
- [In iedit state](#in-iedit-state)
- [In iedit-insert state](#in-iedit-insert-state)
- [Examples](#examples)
<!-- markdown-toc end -->
This layer replaces [auto-highlight-symbol][] back end by [iedit][].
It comes with two new evil states:
- iedit state
- iedit-insert state
These states color code is `red`.
It has also a nice integration with [expand-region][] for quick edit
of the current selected text by pressing <kbd>e</kbd>.
## Install
To use this contribution add it to your `~/.spacemacs`
```elisp
(setq-default dotspacemacs-configuration-layers '(iedit)
"List of contribution to load."
)
```
## Key bindings
### State transitions
Key Binding | From | To
-------------------|:------------------:|:-------------------------:
<kbd>SPC s e</kbd> | normal or visual | iedit
<kbd>e</kbd> | expand-region | iedit
<kbd>ESC</kbd> | iedit | normal
<kbd>C-g</kbd> | iedit | normal
<kbd>fd</kbd> | iedit | normal
<kbd>ESC</kbd> | iedit-insert | iedit
<kbd>C-g</kbd> | iedit-insert | normal
<kbd>fd</kbd> | iedit-insert | normal
To sum-up, in `iedit-insert state` you have to press <kbd>ESC</kbd> twice to
go back to the `normal state`. You can also at any time press <kbd>C-g</kbd>
or <kbd>fd</kbd> to return to `normal state`.
**Note:** evil commands which switch to `insert state` will switch in
`iedit-insert state`.
### In iedit state
`iedit state` inherits from `normal state`, the following key bindings are
specific to `iedit state`.
Key Binding | Description
------------------|------------------------------------------------------------
<kbd>ESC</kbd> | go back to `normal state`
<kbd>TAB</kbd> | toggle current occurrence
<kbd>0</kbd> | go to the beginning of the current occurrence
<kbd>$</kbd> | go to the end of the current occurrence
<kbd>#</kbd> | prefix all occurrences with an increasing number (<kbd>SPC u</kbd> to choose the starting number).
<kbd>A</kbd> | go to the end of the current occurrence and switch to `iedit-insert state`
<kbd>D</kbd> | delete the occurrences
<kbd>F</kbd> | restrict the scope to the function
<kbd>gg</kbd> | go to first occurrence
<kbd>G</kbd> | go to last occurrence
<kbd>I</kbd> | go to the beginning of the current occurrence and switch to `iedit-insert state`
<kbd>J</kbd> | increase the edition scope by one line below
<kbd>K</kbd> | increase the edition scope by one line above
<kbd>L</kbd> | restrict the scope to the current line
<kbd>n</kbd> | go to next occurrence
<kbd>N</kbd> | go to previous occurrence
<kbd>p</kbd> | replace occurrences with last yanked (copied) text
<kbd>S</kbd> | (substitute) delete the occurrences and switch to `iedit-insert state`
<kbd>V</kbd> | toggle visibility of lines with no occurrence
<kbd>U</kbd> | Up-case the occurrences
<kbd>C-U</kbd> | down-case the occurrences
**Note:** <kbd>0</kbd>, <kbd>$</kbd>, <kbd>A</kbd> and <kbd>I</kbd> have the
default Vim behavior when used outside of an occurrence.
### In iedit-insert state
Key Binding | Description
---------------------------|------------------------------------------------------------
<kbd>ESC</kbd> | go back to `iedit state`
<kbd>C-g</kbd> | go back to `normal state`
## Examples
- manual selection of several words then replace: <kbd>v w w SPC s e S "toto" ESC ESC</kbd>
- append text to a word on two lines: <kbd>v i w SPC s e J i "toto" ESC ESC</kbd>
- substitute symbol _with expand-region_: <kbd>SPC v v e S "toto" ESC ESC</kbd>
- replace symbol with yanked (copied) text _with expand region_: <kbd>SPC v e p ESC ESC</kbd>
[auto-highlight-symbol]: https://github.com/gennad/auto-highlight-symbol
[iedit]: https://github.com/tsdh/iedit
[expand-region]: https://github.com/magnars/expand-region.el

View file

@ -1,33 +0,0 @@
(defvar iedit-post-extensions '(evil-iedit-state))
(defun iedit/init-evil-iedit-state ()
(spacemacs/defface-state-color 'iedit "firebrick1")
(spacemacs/defface-state-color 'iedit-insert "firebrick1")
(defun iedit//lazy-load ()
(require 'evil-iedit-state)
(setq evil-iedit-state-cursor `(,(spacemacs/state-color 'iedit) box))
(setq evil-iedit-insert-state-cursor `((spacemacs/state-color 'iedit-insert) (bar . 2)))
(evil-leader/set-key "se" 'evil-iedit-state/iedit-mode)
;; activate leader in iedit and iedit-insert states
(define-key evil-iedit-state-map
(kbd evil-leader/leader) evil-leader--default-map)
;; evil-escape support
(when (and (boundp 'evil-escape-mode)
(symbol-value evil-escape-mode))
(key-chord-define evil-iedit-state-map
evil-escape-key-sequence
'evil-iedit-state/quit-iedit-mode)
(key-chord-define evil-iedit-insert-state-map
evil-escape-key-sequence
'evil-iedit-state/quit-iedit-mode)))
;; override the basic edit mode from ahs everywhere
(eval-after-load 'auto-highlight-symbol
'(progn
(evil-leader/set-key "se" 'evil-iedit-state/iedit-mode)
(defalias 'ahs-edit-mode 'evil-iedit-state/iedit-mode)))
(add-to-hooks 'iedit//lazy-load '(prog-mode-hook markdown-mode-hook)))

View file

@ -1,203 +0,0 @@
(require 'evil)
(require 'iedit)
(evil-define-state iedit
"`iedit state' interfacing iedit mode."
:tag " <E> "
:enable (normal)
:cursor box
:message "-- IEDIT --"
;; force iedit mode
(if (evil-replace-state-p) (call-interactively 'iedit-mode)))
(evil-define-state iedit-insert
"Replace insert state in `iedit state'."
:tag " <Ei> "
:enable (insert)
:cursor (bar . 2)
:message "-- IEDIT-INSERT --")
(defun evil-iedit-state/iedit-mode (&optional arg)
"Start `iedit-mode'."
(interactive "P")
(if (fboundp 'ahs-clear) (ahs-clear))
(iedit-mode arg)
(evil-iedit-state))
(defun evil-iedit-state/quit-iedit-mode ()
"Quit iedit-mode and return to `normal state'."
(interactive)
(iedit-done)
(evil-normal-state))
(defmacro evil-iedit-state||swith-to-insert-state-after-command (command &optional interactive)
"Call COMMAND and switch to iedit-insert state.
If INTERACTIVE is non-nil then COMMAND is called interactively."
`(progn
(if ,interactive
(call-interactively ',command)
(funcall ',command))
;; required to correctly update the cursors
(evil-iedit-state)
(evil-iedit-insert-state)))
(defun evil-iedit-state//goto-overlay-start ()
"Return the position of the start of the current overlay."
(let ((overlay (iedit-find-current-occurrence-overlay)))
(if overlay
(goto-char (overlay-start overlay))
(call-interactively 'evil-digit-argument-or-evil-beginning-of-line))))
(defun evil-iedit-state//goto-overlay-end ()
"Return the position of the end of the current overlay."
(let ((overlay (iedit-find-current-occurrence-overlay)))
(if overlay
(goto-char (overlay-end overlay))
(call-interactively 'evil-end-of-line))))
(defun evil-iedit-state/evil-beginning-of-line (count)
"Go to the beginning of the current overlay."
(interactive "p")
(evil-iedit-state//goto-overlay-start))
(defun evil-iedit-state/evil-end-of-line ()
"Go to the beginning of the current overlay."
(interactive)
(evil-iedit-state//goto-overlay-end))
(defun evil-iedit-state/evil-append-line ()
"Put the point at then end of current overlay and switch to
`iedit-insert state'."
(interactive)
(evil-iedit-state||swith-to-insert-state-after-command
evil-iedit-state//goto-overlay-end))
(defun evil-iedit-state/evil-insert-line ()
"Put the point at then end of current overlay and switch to
`iedit-insert state'."
(interactive)
(evil-iedit-state||swith-to-insert-state-after-command
evil-iedit-state//goto-overlay-start))
(defun evil-iedit-state/substitute ()
"Wipe all the occurrences and switch in `iedit-insert state'"
(interactive)
(iedit-delete-occurrences)
(evil-iedit-insert-state))
(defun evil-iedit-state/evil-change ()
"Wipe all the occurrences and switch in `iedit-insert state'"
(interactive)
(evil-iedit-state||swith-to-insert-state-after-command evil-change t))
(defun evil-iedit-state/evil-append ()
"Append and switch to `iedit-insert state'"
(interactive)
(evil-iedit-state||swith-to-insert-state-after-command evil-append t))
(defun evil-iedit-state/evil-open-below ()
"Insert new line below and switch to `iedit-insert state'"
(interactive)
(evil-iedit-state||swith-to-insert-state-after-command evil-open-below t))
(defun evil-iedit-state/evil-open-above ()
"Insert new line above and switch to `iedit-insert state'"
(interactive)
(evil-iedit-state||swith-to-insert-state-after-command evil-open-above t))
(defun evil-iedit-state/evil-substitute ()
"Append and switch to `iedit-insert state'"
(interactive)
(evil-iedit-state||swith-to-insert-state-after-command evil-substitute t))
(defun evil-iedit-state/paste-replace (count)
"Replace the selection with the yanked text."
(interactive "P")
(iedit-delete-occurrences)
(evil-paste-before count))
;; expand-region integration, add an "e" command
(eval-after-load 'expand-region
'(progn
(defun evil-iedit-state/iedit-mode-from-expand-region (&optional arg)
"Start `iedit-mode'."
(interactive "P")
(evil-iedit-state/iedit-mode arg)
;; hack to leave expand-region temporary overlay map
;; we choose a letter that is not in `iedit state'
(setq unread-command-events (listify-key-sequence "kj")))
(defadvice er/prepare-for-more-expansions-internal
(around iedit/prepare-for-more-expansions-internal activate)
ad-do-it
(let ((default-msg (car ad-return-value))
(default-bindings (cdr ad-return-value)))
(message "%s" default-bindings)
(setq ad-return-value
(cons (concat default-msg ", e to edit")
(add-to-list 'default-bindings
'("e" evil-iedit-state/iedit-mode-from-expand-region))))))))
;; redefine iedit-done to prevent iedit from putting the occurrence on the
;; kill-ring for no useful reason.
(defun iedit-done ()
"Exit Iedit mode.
Save the current occurrence string locally and globally. Save
the initial string globally."
(when iedit-buffering
(iedit-stop-buffering))
(setq iedit-last-occurrence-local (iedit-current-occurrence-string))
(setq iedit-last-occurrence-global iedit-last-occurrence-local)
(setq iedit-last-initial-string-global iedit-initial-string-local)
;; this is the hack
;; (if iedit-last-occurrence-local
;; (kill-new iedit-last-occurrence-local)) ; Make occurrence the latest kill in the kill ring.
(setq iedit-num-lines-to-expand-up 0)
(setq iedit-num-lines-to-expand-down 0)
(iedit-cleanup)
(setq iedit-initial-string-local nil)
(setq iedit-mode nil)
(force-mode-line-update)
(remove-hook 'kbd-macro-termination-hook 'iedit-done t)
(remove-hook 'change-major-mode-hook 'iedit-done t)
(remove-hook 'iedit-aborting-hook 'iedit-done t)
(run-hooks 'iedit-mode-end-hook))
(define-key evil-iedit-state-map "#" 'iedit-number-occurrences)
(define-key evil-iedit-state-map "$" 'evil-iedit-state/evil-end-of-line)
(evil-redirect-digit-argument evil-iedit-state-map "0" 'evil-iedit-state/evil-beginning-of-line)
(define-key evil-iedit-state-map "a" 'evil-iedit-state/evil-append)
(define-key evil-iedit-state-map "A" 'evil-iedit-state/evil-append-line)
(define-key evil-iedit-state-map "c" 'evil-iedit-state/evil-change)
(define-key evil-iedit-state-map "D" 'iedit-delete-occurrences)
(define-key evil-iedit-state-map "F" 'iedit-restrict-function)
(define-key evil-iedit-state-map "gg" 'iedit-goto-first-occurrence)
(define-key evil-iedit-state-map "G" 'iedit-goto-last-occurrence)
(define-key evil-iedit-state-map "i" 'evil-iedit-insert-state)
(define-key evil-iedit-state-map "I" 'evil-iedit-state/evil-insert-line)
(define-key evil-iedit-state-map "J" 'iedit-expand-down-a-line)
(define-key evil-iedit-state-map "K" 'iedit-expand-up-a-line)
(define-key evil-iedit-state-map "L" 'iedit-restrict-current-line)
(define-key evil-iedit-state-map "n" 'iedit-next-occurrence)
(define-key evil-iedit-state-map "N" 'iedit-prev-occurrence)
(define-key evil-iedit-state-map "o" 'evil-iedit-state/evil-open-below)
(define-key evil-iedit-state-map "O" 'evil-iedit-state/evil-open-above)
(define-key evil-iedit-state-map "p" 'evil-iedit-state/paste-replace)
(define-key evil-iedit-state-map "s" 'evil-iedit-state/evil-substitute)
(define-key evil-iedit-state-map "S" 'evil-iedit-state/substitute)
(define-key evil-iedit-state-map "V" 'iedit-toggle-unmatched-lines-visible)
(define-key evil-iedit-state-map "U" 'iedit-upcase-occurrences)
(define-key evil-iedit-state-map (kbd "C-U") 'iedit-downcase-occurrences)
(define-key evil-iedit-state-map (kbd "C-g")'evil-iedit-state/quit-iedit-mode)
(define-key evil-iedit-state-map [tab] 'iedit-toggle-selection)
(define-key evil-iedit-state-map [backspace] 'iedit-blank-occurrences)
(define-key evil-iedit-state-map [escape] 'evil-iedit-state/quit-iedit-mode)
(define-key evil-iedit-insert-state-map (kbd "C-g") 'evil-iedit-state/quit-iedit-mode)
(define-key evil-iedit-insert-state-map [escape] 'evil-iedit-state)
;; unbound iedit commands:
;; toggle buffering
;; toggle case sensitive
(provide 'evil-iedit-state)

View file

@ -1,5 +0,0 @@
(defvar iedit-packages '(iedit))
(defun iedit/init-iedit ()
(use-package iedit :defer t))

View file

@ -7,6 +7,7 @@
erlang
flycheck
git-gutter-fringe
evil-iedit-state
rainbow-delimiters
ruby-end
smartparens
@ -95,6 +96,10 @@ must be defined in `dotspacemacs/init' function to take effect.")
(defun erlang-elixir/init-git-gutter-fringe ()
(add-hook 'erlang-mode-hook 'git-gutter-mode))
(defun erlang-elixir/init-evil-iedit-state ()
(add-hook 'erlang-mode-hook 'spacemacs/evil-state-lazy-loading))
(defun erlang-elixir/init-rainbow-delimiters ()
(add-hook 'erlang-mode-hook 'turn-on-rainbow-delimiters-mode))

View file

@ -96,6 +96,12 @@
- [Region narrowing](#region-narrowing)
- [Line formatting](#line-formatting)
- [Auto-completion](#auto-completion)
- [Replacing text with iedit](#replacing-text-with-iedit)
- [iedit states key bindings](#iedit-states-key-bindings)
- [State transitions](#state-transitions)
- [In iedit state](#in-iedit-state)
- [In iedit-insert state](#in-iedit-insert-state)
- [Examples](#examples)
- [Commenting](#commenting)
- [Deleting files](#deleting-files)
- [Editing Lisp code](#editing-lisp-code)
@ -114,7 +120,7 @@
- [Python](#python)
- [JavaScript](#javascript)
- [rcirc](#rcirc)
- [HTML](#html)
- [HTML and CSS](#html-and-css)
- [Emacs Server](#emacs-server)
- [Connecting to the Emacs server](#connecting-to-the-emacs-server)
- [Keeping the server alive](#keeping-the-server-alive)
@ -509,7 +515,7 @@ than just a Vim emulation. It has more states than Vim for instance.
### States
`Spacemacs` has 6 states:
`Spacemacs` has 8 states:
- **Normal** (orange) - like the `normal mode of Vim`, used to execute and
combine commands
@ -522,7 +528,16 @@ than just a Vim emulation. It has more states than Vim for instance.
- **Emacs** (blue) - exclusive to `Evil`, using this state is like using a
regular Emacs without Vim
- **Lisp** (pink) - exclusive to `Spacemacs`, used to navigate Lisp code and
modify it
modify it (see [Editing Lisp code](#editing-lisp-code))
- **Iedit** (red) - exclusive to `Spacemacs`, used to navigate between multiple
regions of text using `iedit`
(see [Replacing text with iedit](#replacing-text-with-iedit))
- **Iedit Insert** (red) - exclusive to `Spacemacs`, used to replace multiple
regions of text using `iedit`
(see [Replacing text with iedit](#replacing-text-with-iedit))
Note: Technically speaking there are also the `operator` and `replace` evil
states.
### Base States
@ -1231,7 +1246,7 @@ Key Binding | Description
-----------------------|------------------------------------------------------------
<kbd>*</kbd> | initiate navigation micro-state
<kbd>SPC s b</kbd> | go to the last searched occurrence of the last highlighted symbol
<kbd>SPC s e</kbd> | edit all occurrences of the current symbol
<kbd>SPC s e</kbd> | edit all occurrences of the current symbol(*)
<kbd>SPC s h</kbd> | highlight the current symbol and all its occurrence within the current range
<kbd>SPC s R</kbd> | change range to default (`whole buffer`)
@ -1239,7 +1254,7 @@ In 'Spacemacs' highlight symbol micro-state:
Key Binding | Description
--------------|------------------------------------------------------------
<kbd>e</kbd> | edit occurrences
<kbd>e</kbd> | edit occurrences (*)
<kbd>n</kbd> | go to next occurrence
<kbd>N</kbd> | go to previous occurrence
<kbd>d</kbd> | go to next definition occurrence
@ -1248,6 +1263,8 @@ Key Binding | Description
<kbd>R</kbd> | go to home occurrence (reset position to starting occurrence)
Any other key | leave the navigation micro-state
(*) using [iedit][] or the default implementation of `auto-highlight-symbol`
The micro-state text in minibuffer display the following information:
<M> [6/11]* press (n/N) to navigate, (e) to edit, (r) to change range or (R) for reset
@ -1454,6 +1471,88 @@ Used together these key bindings are very powerful to quickly reformat the code.
<kbd>S-TAB</kbd> | select previous candidate
<kbd>return</kbd> | complete word, if word is already completed insert a carriage return
### Replacing text with iedit
`Spacemacs` uses the powerful [iedit][] mode through [evil-iedit-state][] to
quickly edit multiple occurrences of a symbol or selection.
`evil-iedit-state` defines two new evil states:
- `iedit state`
- `iedit-insert state`
The color code for these states is `red`.
`evil-iedit-state` has also a nice integration with [expand-region][] for quick
edition of the current selected text by pressing <kbd>e</kbd>.
#### iedit states key bindings
##### State transitions
Key Binding | From | To
-------------------|:------------------:|:-------------------------:
<kbd>SPC s e</kbd> | normal or visual | iedit
<kbd>e</kbd> | expand-region | iedit
<kbd>ESC</kbd> | iedit | normal
<kbd>C-g</kbd> | iedit | normal
<kbd>fd</kbd> | iedit | normal
<kbd>ESC</kbd> | iedit-insert | iedit
<kbd>C-g</kbd> | iedit-insert | normal
<kbd>fd</kbd> | iedit-insert | normal
To sum-up, in `iedit-insert state` you have to press <kbd>ESC</kbd> twice to
go back to the `normal state`. You can also at any time press <kbd>C-g</kbd>
or <kbd>fd</kbd> to return to `normal state`.
**Note:** evil commands which switch to `insert state` will switch in
`iedit-insert state`.
##### In iedit state
`iedit state` inherits from `normal state`, the following key bindings are
specific to `iedit state`.
Key Binding | Description
------------------|------------------------------------------------------------
<kbd>ESC</kbd> | go back to `normal state`
<kbd>TAB</kbd> | toggle current occurrence
<kbd>0</kbd> | go to the beginning of the current occurrence
<kbd>$</kbd> | go to the end of the current occurrence
<kbd>#</kbd> | prefix all occurrences with an increasing number (<kbd>SPC u</kbd> to choose the starting number).
<kbd>A</kbd> | go to the end of the current occurrence and switch to `iedit-insert state`
<kbd>D</kbd> | delete the occurrences
<kbd>F</kbd> | restrict the scope to the function
<kbd>gg</kbd> | go to first occurrence
<kbd>G</kbd> | go to last occurrence
<kbd>I</kbd> | go to the beginning of the current occurrence and switch to `iedit-insert state`
<kbd>J</kbd> | increase the edition scope by one line below
<kbd>K</kbd> | increase the edition scope by one line above
<kbd>L</kbd> | restrict the scope to the current line
<kbd>n</kbd> | go to next occurrence
<kbd>N</kbd> | go to previous occurrence
<kbd>p</kbd> | replace occurrences with last yanked (copied) text
<kbd>S</kbd> | (substitute) delete the occurrences and switch to `iedit-insert state`
<kbd>V</kbd> | toggle visibility of lines with no occurrence
<kbd>U</kbd> | Up-case the occurrences
<kbd>C-U</kbd> | down-case the occurrences
**Note:** <kbd>0</kbd>, <kbd>$</kbd>, <kbd>A</kbd> and <kbd>I</kbd> have the
default Vim behavior when used outside of an occurrence.
##### In iedit-insert state
Key Binding | Description
---------------------------|------------------------------------------------------------
<kbd>ESC</kbd> | go back to `iedit state`
<kbd>C-g</kbd> | go back to `normal state`
#### Examples
- manual selection of several words then replace: <kbd>v w w SPC s e S "toto" ESC ESC</kbd>
- append text to a word on two lines: <kbd>v i w SPC s e J i "toto" ESC ESC</kbd>
- substitute symbol _with expand-region_: <kbd>SPC v v e S "toto" ESC ESC</kbd>
- replace symbol with yanked (copied) text _with expand region_: <kbd>SPC v e p ESC ESC</kbd>
### Commenting
Comments are handled by [evil-nerd-commenter][], it's bound to the following keys.
@ -1939,6 +2038,8 @@ developers to elisp hackers!
[projectile]: https://github.com/bbatsov/projectile
[hdescbinds]: https://github.com/emacs-helm/helm-descbinds
[hflyspell]: https://gist.github.com/cofi/3013327
[iedit]: https://github.com/tsdh/iedit
[evil-iedit-state]: https://github.com/syl20bnr/evil-iedit-state
[evil-little-word]: https://github.com/tarao/evil-plugins#evil-little-wordel
[evil-visualstar]: https://github.com/bling/evil-visualstar
[evil-exchange]: https://github.com/Dewdrops/evil-exchange

View file

@ -18,13 +18,14 @@
evil-args
evil-escape
evil-exchange
evil-search-highlight-persist
evil-iedit-state
evil-jumper
evil-leader
evil-lisp-state
evil-nerd-commenter
evil-numbers
evil-org
evil-search-highlight-persist
evil-surround
evil-terminal-cursor-changer
evil-visualstar
@ -55,6 +56,7 @@
highlight
hl-anything
ido-vertical-mode
iedit
json-mode
ledger-mode
let-alist
@ -345,7 +347,6 @@ which require an initialization must be listed explicitly in the list.")
(eval '(ahs-change-range ahs-default-range) nil))
(evil-leader/set-key
"se" 'ahs-edit-mode
"sb" 'spacemacs/goto-last-searched-ahs-symbol
"sh" 'spacemacs/symbol-highlight
"sR" 'spacemacs/symbol-highlight-reset-range)
@ -371,7 +372,9 @@ which require an initialization must be listed explicitly in the list.")
(let ((map (make-sparse-keymap)))
(define-key map (kbd "d") 'ahs-forward-definition)
(define-key map (kbd "D") 'ahs-backward-definition)
(define-key map (kbd "e") 'ahs-edit-mode)
(if (ht-contains? config-system-all-packages 'evil-iedit-state)
(define-key map (kbd "e") 'evil-iedit-state/iedit-mode)
(define-key map (kbd "e") 'ahs-edit-mode))
(define-key map (kbd "n") 'ahs-forward)
(define-key map (kbd "N") 'ahs-backward)
(define-key map (kbd "R") 'ahs-back-to-start)
@ -601,6 +604,31 @@ determine the state to enable when escaping from the insert state.")
(use-package evil-exchange
:init (evil-exchange-install)))
(defun spacemacs/init-evil-iedit-state ()
(spacemacs/defface-state-color 'iedit "firebrick1")
(spacemacs/defface-state-color 'iedit-insert "firebrick1")
(defun spacemacs/evil-state-lazy-loading ()
(require 'evil-iedit-state)
(setq evil-iedit-state-cursor `(,(spacemacs/state-color 'iedit) box))
(setq evil-iedit-insert-state-cursor `((spacemacs/state-color 'iedit-insert) (bar . 2)))
;; activate leader in iedit and iedit-insert states
(define-key evil-iedit-state-map
(kbd evil-leader/leader) evil-leader--default-map)
;; evil-escape support
(when (and (boundp 'evil-escape-mode)
(symbol-value evil-escape-mode))
(key-chord-define evil-iedit-state-map
evil-escape-key-sequence
'evil-iedit-state/quit-iedit-mode)
(key-chord-define evil-iedit-insert-state-map
evil-escape-key-sequence
'evil-iedit-state/quit-iedit-mode)))
(evil-leader/set-key "se" 'evil-iedit-state/iedit-mode)
(add-to-hooks 'spacemacs/evil-state-lazy-loading '(prog-mode-hook
markdown-mode-hook)))
(defun spacemacs/init-evil-jumper ()
(use-package evil-jumper
:init
@ -1239,6 +1267,10 @@ determine the state to enable when escaping from the insert state.")
(add-to-list 'ido-setup-hook 'spacemacs//ido-vertical-define-keys))
))
(defun spacemacs/init-iedit ()
(use-package iedit
:defer t))
(defun spacemacs/init-json-mode ()
(use-package json-mode
:defer t))