iedit in actionλ︎
How to do things with iedit
Changing multiple occurrencesλ︎
First select one instance of a character or word that occurs multiple times in the buffer. This is typically done with visual mode,
SPC s e will highlight all occurrences and put you in iedit state.
Any Vim style editing will change all occurrences.
fd will end iedit state and return to Vim normal state.
IEdit defaults to selecting all matches.
C-; in iedit state allows you to edit the selections.
Once editing the selections, use
n to jump to next word/region and
N to the previous.
M-; will toggle the selection of the current word/region.
iedit and narrowing
iedit selects all occurrences in a buffer. If you only want to change one part of the text (or a specific function), then you can narrow to just edit that specific region. See narrow for more details
iedit a functionλ︎
In iedit state you can:
F to limit the scope to the current function
L to limit the scope to the current line
J to increase the scope (starting from the current line) one line below
K to increase the scope one line above
Navigate between the occurrences with
TAB to remove an occurrence.
iedit - replace multiple wordsλ︎
- manual selection of several words then replace:
v w w SPC s e S "toto" ESC ESC
append text to a word on two lines:
v i w SPC s e J i "toto" ESC ESC
substitute symbol /with expand-region/:
SPC v v e S "toto" ESC ESC
replace symbol with yanked (copied) text /with expand region/:
SPC v e p ESC ESC
iedit example - multiple find and replaceλ︎
If you have text you want to edit in multiple places at the same time, rather than the traditional find/replace, you can select all the regions and use multiple cursors to edit all regions simultaneously.
- Put the cursor over the word you want to replace
vto enter visual (select) mode
SPC vto select word or region
vincreases the selected region
Vto reduce selected region
efor iedit state
C-;to edit selection
njump to next matching selected region
pjump to previous matching selected region
M-jdeselect current region
Ssubstitute text in all regions
Ddelete all selected regions
Space se matches all instances of a region under the cursor (iedit state)