Monday, 9 November 2009
When converting program source into literate source using Lyx, it is
convenient in the first instance to allocate a listings inset for each
source file, but as I annotate and break up each listing it becomes
cumbersome to split the listing into parts.
I find that generally I want to select part of the inset I am working on
and move it to a new inset either above or below the current inset.
Perhaps I will select from the current position to the start of the
inset and want to split into two insets: i.e. split-at-cursor
Lyx 1.6.3 and before is pretty bad at that; but these macros can be
assigned to keystrokes:
To move selected text into a listing inset below; I assigned this to
command-sequence cut ; char-delete-backward ; escape ; listing-insert ;
To move selected text into a listing inset above; I assigned this to
SHIFT-CTRL-ALT-? (because ? is on the same key as /)
command-sequence cut ; escape ; up ; char-forward ; listing-insert ;
paste ; char-delete-backward
This makes it easy to split insets.