Hi,
In vim it is possible to do a visual block selection ( Ctrl-v ) and press 'I' to insert. SlickEdit does not
support this command. Doing a block selection and press 'c' to change, does work.
Visual block and insert is particular useful to insert comments (e.g. # in Python) in front of large code blocks.
I modified slickedit/macros/vivmode.e and added to following function:
/**
* By default this command handles the 'I' key pressed in visual mode.
* The cursor moves in front of the selected text, and insert mode is turned on.
*
* @return
*/
_command int vi_visual_insert() name_info(','VSARG2_MARK|VSARG2_CMDLINE|VSARG2_REQUIRES_EDITORCTL|VSARG2_LASTKEY){
if (!vi_visual_maybe_command()) {
if (!in_block_visual_mode) {
begin_select();
vi_visual_toggle();
vi_switch_mode('I');
} else {
// switch to block insert mode for block selections
int num_lines = count_lines_in_selection();
end_select();
typeless p;
_save_pos2(p);
begin_select();
int col = p_col;
_select_block();
_restore_pos2(p);
p_col = col;
_select_block();
block_insert_mode();
}
return(0);
}
return(0);
}
It's a copy of the vi_visual_change() function and removed the part that deletes the selected code.
I changed the following line in slickedit/macros/videf.e:
//def 'I' = vi_visual_maybe_command;
def 'I'= vi_visual_insert;
After reloading these two macros, the visual insert works.
It would be nice if vi_visual_insert could be part of the standard slickedit distribution.
Raymond