Dear friend, do not imitate what is evil but what is good.
Anyone who does what is good is from God.
Anyone who does what is evil has not seen God.
3 John 1:11 (NIV)
Imitation is a plugin for the gedit text editor, that allows the user to edit a document in multiple places simultaneously. It does this by enabling the user to place marks in different parts of a document that act as virtual text cursors. It is designed to aid repetitive programming tasks.
Imitation is best explained by a demo video:
To save some confusion over plugin names:
Multi-edit (hyphen) was created by me for gedit 2
Multi Edit (no hyphen) was based on my work but created by another author
Imitation is a sequel to Multi-edit created by me for gedit 3
An "install" script is included in the source code which will be the quickest option for most users (it does the following steps for you). However, if it does not work or you'd like to do things manually, just do the following:
Install the GSettings schema (needed for config)
Locate your system's gschema directory (assuming /usr/share/glib-2.0/schemas)
Place "org.gnome.gedit.plugins.imitation.gschema.xml" in the gschema directory
Apply the changes by running "glib-compile-schemas /usr/share/glib-2.0/schemas"
Install the plugin
Choose either the user (~/.local/share/gedit/plugins/) or system (/usr/lib/gedit/plugins) directory
Place "imitation.plugin" (file) and "imitation" (folder) in the chosen directory
Activate Imitation in gedit's preferences
I may look into packaging the plugin for Ubuntu if I get round to it.
Any feedback is most welcome and appreciated. You can email jon@ this website.
Imitation relies on GSettings for configuration, and GSettings currently uses dconf as the default backend. So you can simply use dconf-editor, and edit settings at the GSettings path /org/gnome/gedit/plugins/imitation. I might at some stage bother creating a config GUI but at the moment it doesn't seem necessary.
Imitation may seem a bit complex at first, but it is easy to learn, and powerful to use. There are two main aspects to Imitation: marking and editing.
Before you can start editing in imitation mode, you need to first mark the places you'd like to edit. Marking can be done in five different ways, depending on the key you press and whether you have selected any text or not.
Mark toggle (<Control>e) This is the most basic way of placing marks. It toggles (add|remove) a mark at the cursor.
Without selection: word-offset mode (also sticks to end-of-lines if started from one)
With selection: matches mode selects the next match to selection (and the match number if multiple matches per line)
Unlike Multi-edit, Imitation's vertical marking will skip lines with less characters than the cursor's line offset. This is useful when there are blank lines between code segments.
Clearing all marks: Move the cursor (unless in sticky mode) or press Escape
Sticky mode: Using "mark toggle" will also trigger "sticky mode", where you can move your cursor around with marks staying in place. In vertical marking, they will be cleared as soon as you move your cursor, unless you enable sticky mode. Sticky mode stays enabled until you clear all marks.
For the most part editing with Imitation is mostly similar to editing with a normal cursor. There are however a few differences:
Your normal cursor will no longer work (only marks will preform edits)
Delete is limited to plain Backspace and Delete keys (no modifiers like <Control> etc)
You can insert incrementing values using (in order of mark placement):