spacemacs/contrib/iedit/README.md
2014-12-05 22:15:55 -05:00

4.5 KiB

iedit contribution layer for Spacemacs

Table of Contents

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 e.

Install

To use this contribution add it to your ~/.spacemacs

(defvar dotspacemacs-configuration-layers '(iedit)
  "List of contribution to load."
)

Key bindings

State transitions

To iedit state:

  • SPC s e initiates the iedit state in normal mode.
  • e initiates the iedit state while expanding region.
  • ESC in iedit-insert state returns to iedit state.

To iedit-insert state

  • i in iedit state triggers the iedit-insert state.

To normal state

  • ESC in iedit state returns to normal state.
  • C-g returns to normal mode
  • fd returns to normal mode (if evil-escape is enabled)

To sum-up, in iedit-insert state you have to press ESC twice to go back to the normal state. You can also at any time press C-g or fd to return to normal state.

In iedit state

Key Binding                 |                 Description

--------------------------------|------------------------------------------------------------ ESC | go back to normal state # | prefix all occurrences with an increasing number b | make all occurrences blank B | toggle buffering (use it for large buffers with a lof of occurrences) c | evil-change (for convenience) d | delete the occurrences D | down-case the occurrences f | restrict the scope to the function "gg" | go to first occurrence G | go to last occurrence i | switch to iedit-insert state I | toggle case-sensitivity h | evil-backward-char j | evil-next-visual-line k | evil-previous-visual-line l | evil-forward-char J | increase the edition scope by one line below K | increase the edition scope by one line above L | restrict the scope to the current line n | go to next occurrence N | go to previous occurrence p | replace occurrences with last yanked (copied) text r | (replace) delete the occurrences and switch to iedit-insert state v | toggle visibility of lines with no occurrence u | undo (for convenience) U | Up-case the occurrences

In iedit-insert state

Key Binding            |                 Description

---------------------------|------------------------------------------------------------ ESC | go back to iedit state C-g | go back to normal state

Examples

  • manual selection of several words then replace: v w w SPC s e r "toto" ESC ESC
  • append text to a word on two lines: SPC v i w SPC s e j i "toto" ESC ESC
  • replace symbol with expand-region: SPC v v e r "toto" ESC ESC
  • replace symbol with yanked (copied) text with expand region: v e p ESC ESC

Tips

The first N put the cursor at the beginning of the edited selection.