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.select()
. - The text which will be used is word-under-cursor in normal mode, and visually selected in visual mode.
- Selection-mode will be started. (where you can chose which occurrences of text you want to iedit)
- You select which instances of text you want to iedit. (see config for keymaps)
- You press
<esc>
to exit selection-mode and start iedit-mode. - You do some editing.
- You stop iedit-mode with
iedit.stop()
.
iedit.select()
- start selection for iedit; text will be word-under-cursor in normal mode and visually selected in visual mode.iedit.select_all()
- select all for iedit; text will be same asiedit.select()
iedit.stop()
- stop ieditiedit.toggle()
- if iedit is on runsiedit.stop()
, otherwise runsiedit.select()
Whenever a new selection is started, iedit.stop()
is called automatically.
Using iedit.setup()
is not required, it just changes the config.
The default config is:
{
select={
map={
q={'done'},
['<Esc>']={'select','done'},
['<CR>']={'toggle'},
n={'toggle','next'},
p={'toggle','prev'},
N={'next'},
P={'prev'},
a={'all'},
--Mapping to use while in selection-mode
--Possible values are:
-- • `done` Done with selection
-- • `next` Go to next occurrence
-- • `prev` Go to previous occurrence
-- • `select` Select current
-- • `unselect` Unselect current
-- • `toggle` Toggle current
-- • `all` Select all
},
highlight={
current='CurSearch',
selected='Search'
}
},
highlight='IncSearch',
}
Set merge=false
in a (non-array) table in the config to not merge with the default config.
If you want to donate then you need to find the correct link (hint: catorce):