A lua rewrite of emacs's iedit.
Edit one occurrence of text and simultaneously have other selected occurrences edited in the same way.
- You start iedit with
iedit.toggle(). - The text which will be used is word-under-cursor in normal mode, and visually selected in visual mode.
- You do some editing on the text, other instances of text will be changed.
- You stop iedit-mode with
iedit.toggle().
-
iedit.toggle(match)- toggle iedit-mode; when enabling: text will be word-under-cursor in normal mode and visually selected in visual mode. -
iedit.toggle_current_occurrence()- toggle current occurrence to be included/decluded if cursor on occurrence -
iedit.goto_next_occurrence(wrap)- goto next (active) occurrence -
iedit.goto_prev_occurrence(wrap)- goto previous (active) occurrence -
iedit.goto_first_occurrence()- goto first (active) occurrence -
iedit.goto_last_occurrence()- goto last (active) occurrence
Restrictions are line-wise. Node can fall outside of this restriction when they are manually toggled. When changing restriction range, matching is redone (which means that manually toggled nodes get reset).
iedit.restrict_current_line()- restrict to current lineiedit.restrict_visual()- restrict to visually selected rangeiedit.restrict_range(start_row, end_row)- restrict to rangeiedit.expand_up()- expand restriction upiedit.expand_down()- expand restriction downiedit.unexpand_up()- unexpand restriction upiedit.unexpand_down()- unexpand restriction downiedit.expand_next_occurrence()- expand restriction to next occurrence after restriction endiedit.expand_prev_occurrence()- expand restriction to prev occurrence before restriction startiedit.unexpand_next_occurrence()- unexpand restriction to next occurrence after restriction startiedit.unexpand_prev_occurrence()- unexpand restriction to prev occurrence before restriction end
Using iedit.setup() is not required, it just changes the config.
The default config is:
{
highlight = 'IncSearch',
end_right_gravity = true,
right_gravity = false,
}Arbitrary same-width pattern is not possible, as there is no (easy) way to get how the extmarked content get's changed, only what the change is. This disables case-toggle and use-(i)search.
If you want to donate then you need to find the correct link (hint: catorce):