int rl_vi_insert_beg (int count, int key) { rl_beg_of_line (1, key); rl_vi_insertion_mode (1, key); return (0); }
/* Completion, from vi's point of view. */ int rl_vi_complete (int ignore, int key) { if ((rl_point < rl_end) && (!whitespace (rl_line_buffer[rl_point]))) { if (!whitespace (rl_line_buffer[rl_point + 1])) rl_vi_end_word (1, 'E'); rl_point++; } if (key == '*') rl_complete_internal ('*'); /* Expansion and replacement. */ else if (key == '=') rl_complete_internal ('?'); /* List possible completions. */ else if (key == '\\') rl_complete_internal (TAB); /* Standard Readline completion. */ else rl_complete (0, key); if (key == '*' || key == '\\') { _rl_vi_set_last (key, 1, rl_arg_sign); rl_vi_insertion_mode (ignore, key); } return (0); }
int rl_vi_append_mode (int count, int key) { if (rl_point < rl_end) rl_point++; rl_vi_insertion_mode (1, key); return (0); }
/* Tilde expansion for vi mode. */ int rl_vi_tilde_expand (int ignore, int key) { rl_tilde_expand (0, key); _rl_vi_set_last (key, 1, rl_arg_sign); /* XXX */ rl_vi_insertion_mode (ignore, key); return (0); }
int rl_vi_change_to(int count, int key) { int c, start_pos; if (_rl_uppercase_p (key)) rl_stuff_char ('$'); else if (vi_redoing) rl_stuff_char (_rl_vi_last_motion); start_pos = rl_point; if (rl_vi_domove (key, &c)) { rl_ding (); return -1; } /* These are the motion commands that do not require adjusting the mark. c[wW] are handled by special-case code in rl_vi_domove(), and already leave the mark at the correct location. */ if ((strchr (" l|hwW^0bB", c) == 0) && (rl_mark < rl_end)) rl_mark++; /* The cursor never moves with c[wW]. */ if ((_rl_to_upper (c) == 'W') && rl_point < start_pos) rl_point = start_pos; if (vi_redoing) { if (vi_insert_buffer && *vi_insert_buffer) rl_begin_undo_group (); rl_delete_text (rl_point, rl_mark); if (vi_insert_buffer && *vi_insert_buffer) { rl_insert_text (vi_insert_buffer); rl_end_undo_group (); } } else { rl_begin_undo_group (); /* to make the `u' command work */ rl_kill_text (rl_point, rl_mark); /* `C' does not save the text inserted for undoing or redoing. */ if (_rl_uppercase_p (key) == 0) _rl_vi_doing_insert = 1; _rl_vi_set_last (key, count, rl_arg_sign); rl_vi_insertion_mode (1, key); } return (0); }
int rl_vi_append_mode(int count, int key) { if (rl_point < rl_end) { if (MB_CUR_MAX == 1 || rl_byte_oriented) rl_point++; else { int point = rl_point; rl_forward_char (1, key); if (point == rl_point) rl_point = rl_end; } } rl_vi_insertion_mode (1, key); return (0); }
int rl_vi_subst (int count, int key) { rl_begin_undo_group (); if (uppercase_p (key)) { rl_beg_of_line (1, key); rl_kill_line (1, key); } else rl_delete_text (rl_point, rl_point+count); rl_end_undo_group (); _rl_vi_set_last (key, count, rl_arg_sign); rl_begin_undo_group (); _rl_vi_doing_insert = 1; rl_vi_insertion_mode (1, key); return (0); }