Lines Matching refs:vi

207  * In vi mode, the following datatype is used to implement the
221 * In vi mode, the following datatype is used to record information
222 * needed by the vi-repeat-change command.
229 int input_curpos; /* Whenever vi command mode is entered, the */
232 int command_curpos; /* Whenever vi command mode is entered, the */
245 * to vi mode.
248 ViUndo undo; /* Information needed to implement the vi */
250 ViRepeat repeat; /* Information needed to implement the vi */
252 int command; /* True in vi command-mode */
451 GlEditor editor; /* The style of editing, (eg. vi or emacs) */
455 ViMode vi; /* Parameters used when editing in vi mode */
1063 * When called when vi command mode is enabled, this function saves the
1065 * by the vi undo command.
1070 * If in vi mode, switch to vi command mode.
1075 * In vi mode this is used to delete up to or onto a given or read
1400 {"vi-insert", gl_vi_insert},
1401 {"vi-overwrite", gl_vi_overwrite},
1402 {"vi-insert-at-bol", gl_vi_insert_at_bol},
1403 {"vi-append-at-eol", gl_vi_append_at_eol},
1404 {"vi-append", gl_vi_append},
1409 {"vi-replace-char", gl_vi_replace_char},
1410 {"vi-change-rest-of-line", gl_vi_change_rest_of_line},
1411 {"vi-change-line", gl_vi_change_line},
1412 {"vi-change-to-bol", gl_vi_change_to_bol},
1413 {"vi-change-refind", gl_vi_change_refind},
1414 {"vi-change-invert-refind", gl_vi_change_invert_refind},
1415 {"vi-change-to-column", gl_vi_change_to_column},
1416 {"vi-change-to-parenthesis", gl_vi_change_to_parenthesis},
1440 {"vi-undo", gl_vi_undo},
1441 {"vi-backward-change-word", gl_vi_backward_change_word},
1442 {"vi-forward-change-word", gl_vi_forward_change_word},
1443 {"vi-backward-change-find", gl_vi_backward_change_find},
1444 {"vi-forward-change-find", gl_vi_forward_change_find},
1445 {"vi-backward-change-to", gl_vi_backward_change_to},
1446 {"vi-forward-change-to", gl_vi_forward_change_to},
1447 {"vi-backward-change-char", gl_vi_backward_change_char},
1448 {"vi-forward-change-char", gl_vi_forward_change_char},
1450 {"vi-mode", gl_vi_editing_mode},
1452 {"vi-repeat-change", gl_vi_repeat_change},
1530 {"M-C-v", "vi-mode"},
1534 * Define the default key-bindings in vi mode. Note that in vi-mode
1537 * the cursor one position right, as in vi.
1574 {"M-.", "vi-repeat-change"},
1586 {"M-a", "vi-append"},
1587 {"M-A", "vi-append-at-eol"},
1590 {"M-C", "vi-change-rest-of-line"},
1591 {"M-cb", "vi-backward-change-word"},
1592 {"M-cB", "vi-backward-change-word"},
1593 {"M-cc", "vi-change-line"},
1594 {"M-ce", "vi-forward-change-word"},
1595 {"M-cE", "vi-forward-change-word"},
1596 {"M-cw", "vi-forward-change-word"},
1597 {"M-cW", "vi-forward-change-word"},
1598 {"M-cF", "vi-backward-change-find"},
1599 {"M-cf", "vi-forward-change-find"},
1600 {"M-cT", "vi-backward-change-to"},
1601 {"M-ct", "vi-forward-change-to"},
1602 {"M-c;", "vi-change-refind"},
1603 {"M-c,", "vi-change-invert-refind"},
1604 {"M-ch", "vi-backward-change-char"},
1605 {"M-c^H", "vi-backward-change-char"},
1606 {"M-c^?", "vi-backward-change-char"},
1607 {"M-cl", "vi-forward-change-char"},
1608 {"M-c ", "vi-forward-change-char"},
1609 {"M-c^", "vi-change-to-bol"},
1610 {"M-c0", "vi-change-to-bol"},
1611 {"M-c$", "vi-change-rest-of-line"},
1612 {"M-c|", "vi-change-to-column"},
1613 {"M-c%", "vi-change-to-parenthesis"},
1645 {"M-i", "vi-insert"},
1646 {"M-I", "vi-insert-at-bol"},
1657 {"M-r", "vi-replace-char"},
1658 {"M-R", "vi-overwrite"},
1659 {"M-s", "vi-forward-change-char"},
1660 {"M-S", "vi-change-line"},
1663 {"M-u", "vi-undo"},
1816 gl->vi.undo.line = NULL;
1817 gl->vi.undo.buff_curpos = 0;
1818 gl->vi.undo.ntotal = 0;
1819 gl->vi.undo.saved = 0;
1820 gl->vi.repeat.action.fn = 0;
1821 gl->vi.repeat.action.data = 0;
1822 gl->vi.repeat.count = 0;
1823 gl->vi.repeat.input_curpos = 0;
1824 gl->vi.repeat.command_curpos = 0;
1825 gl->vi.repeat.input_char = '\0';
1826 gl->vi.repeat.saved = 0;
1827 gl->vi.repeat.active = 0;
1828 gl->vi.command = 0;
1829 gl->vi.find_forward = 0;
1830 gl->vi.find_onto = 0;
1831 gl->vi.find_char = '\0';
1948 * Allocate a vi undo buffer.
1950 gl->vi.undo.line = (char *) malloc(linelen + 2);
1951 if(!gl->vi.undo.line) {
1955 gl->vi.undo.line[0] = '\0';
2077 if(gl->vi.undo.line)
2078 free(gl->vi.undo.line);
4239 * If in vi command mode, preserve the current line for potential
4240 * use by vi-undo.
4271 * If in vi command mode, preserve the current line for potential
4272 * use by vi-undo.
4289 * Explicitly reset the cursor position to allow vi command mode
4308 * Move the cursor to the start of the line, or in vi input mode,
4313 gl_delete_chars(gl, nc, gl->editor == GL_EMACS_MODE || gl->vi.command);
4356 * If in vi command mode, preserve the current line for potential
4357 * use by vi-undo.
4379 * In vi overwrite mode, restore any previously overwritten characters
4382 if(gl->editor == GL_VI_MODE && !gl->vi.command && !gl->insert) {
4387 int nrestore = gl->buff_curpos + nc <= gl->vi.undo.ntotal ?
4388 nc : gl->vi.undo.ntotal - gl->buff_curpos;
4393 gl_buffer_string(gl, gl->vi.undo.line + gl->buff_curpos, nrestore,
4404 gl_truncate_buffer(gl, (gl->vi.undo.ntotal > gl->buff_curpos) ?
4405 gl->vi.undo.ntotal : gl->buff_curpos);
4438 return gl_delete_chars(gl, count, gl->vi.command);
4454 * If in vi command mode, preserve the current line for potential
4455 * use by vi-undo.
4459 gl_delete_chars(gl, count, gl->vi.command);
4497 * If in vi command mode, preserve the current line for potential
4498 * use by vi-undo.
4502 * In emacs mode delete to the end of the word. In vi mode delete to the
4511 gl->vi.command);
4526 * If in vi command mode, preserve the current line for potential
4527 * use by vi-undo.
4539 gl->editor == GL_EMACS_MODE || gl->vi.command);
4557 * to do a vi change command, in which case the
4574 * If in vi command mode, preserve the current line for potential
4575 * use by vi-undo.
4583 gl->vi.command = 0;
4646 return gl_delete_find(gl, count, gl->vi.find_char, gl->vi.find_forward,
4647 gl->vi.find_onto, 0);
4656 return gl_delete_find(gl, count, gl->vi.find_char,
4657 !gl->vi.find_forward, gl->vi.find_onto, 0);
4671 * If in vi command mode, preserve the current line for potential
4672 * use by vi-undo.
4707 * If in vi command mode, preserve the current line for potential
4708 * use by vi-undo.
4747 * If in vi command mode, preserve the current line for potential
4748 * use by vi-undo.
4885 * If in vi command mode, preserve the current line for potential
4886 * use by vi-undo.
4974 * If in vi command mode, preserve the current line for potential
4975 * use by vi-undo.
5063 * If in vi command mode, preserve the current line for potential
5064 * use by vi-undo.
5076 * was pasted, whereas vi leaves the cursor over the last character pasted.
5089 int was_command = gl->vi.command;
5101 * If in vi command mode, preserve the current line for potential
5102 * use by vi-undo.
5231 * In vi mode, switch to command mode, since the user is very
5281 * In vi mode, switch to command mode, since the user is very
5338 * In vi mode, switch to command mode, since the user is very
5352 * prefix to the string that precedes the cursor. In vi command mode
5404 * In vi mode, switch to command mode, since the user is very
5414 * prefix to the string that precedes the cursor. In vi command mode
5487 * In vi command mode, switch to append mode so that the character under
5491 if(gl->vi.command && gl_vi_append(gl, 0, NULL))
5610 * In vi command mode, switch to append mode so that the character under
5614 if(gl->vi.command && gl_vi_append(gl, 0, NULL))
5641 * If in vi command mode, preserve the current line for potential use by
5642 * vi-undo.
6025 * In vi-mode, arrange for the above characters to be seen in command
6084 * If in vi command mode, first preserve the current line for potential use
6085 * by vi-undo.
6096 * This function is normally bound to control-D in vi mode. When it is
6499 } else if(argc == 2 && strcmp(argv[1], "vi") == 0) {
6505 "The argument of editor should be vi or emacs.");
6677 * In vi mode, switch to command mode, since the user is very
6717 * In vi mode, switch to command mode, since the user is very
6762 * In vi command mode, a lone '0' means goto-start-of-line.
6764 if(gl->vi.command && gl->number < 0 && count == '0')
6958 gl->vi.command = 0; /* Start in input mode */
6977 * This is an action function that switches to editing using vi bindings
6990 * If in vi command mode, preserve the current line for potential
6991 * use by vi-undo.
6995 * Switch to vi insert mode.
6998 gl->vi.command = 0;
7009 * If in vi command mode, preserve the current line for potential
7010 * use by vi-undo.
7014 * Switch to vi overwrite mode.
7017 gl->vi.command = 0;
7034 * If in vi command mode, preserve the current line for potential
7035 * use by vi-undo.
7069 * This is the action function which implements the vi-style action which
7081 * This is the action function which implements the vi-style action which
7088 gl->vi.command = 0; /* Allow cursor at EOL */
7094 * This is the action function which implements the vi-style action which
7101 gl->vi.command = 0; /* Allow cursor at EOL */
7130 if(gl->vi.repeat.active) {
7131 c = gl->vi.repeat.input_char;
7135 gl->vi.repeat.input_char = c;
7142 * If in vi command mode, preserve the current line for potential
7143 * use by vi-undo.
7171 gl->vi.command = 0; /* Allow cursor at EOL */
7377 if(gl->vi.repeat.active) {
7378 c = gl->vi.find_char;
7385 gl->vi.find_forward = forward;
7386 gl->vi.find_onto = onto;
7387 gl->vi.find_char = c;
7460 int pos = gl->vi.find_char ?
7461 gl_find_char(gl, count, gl->vi.find_forward, gl->vi.find_onto,
7462 gl->vi.find_char) : -1;
7472 int pos = gl->vi.find_char ?
7473 gl_find_char(gl, count, !gl->vi.find_forward, gl->vi.find_onto,
7474 gl->vi.find_char) : -1;
7588 * Search 'n' times, unless the beginning of the input line (or vi insertion
7622 * after the cursor, depending on whether in emacs or vi mode.
7751 return gl_copy_find(gl, count, gl->vi.find_char, gl->vi.find_forward,
7752 gl->vi.find_onto);
7761 return gl_copy_find(gl, count, gl->vi.find_char, !gl->vi.find_forward,
7762 gl->vi.find_onto);
7783 buff_curpos = gl->vi.command ? gl->ntotal-1 : gl->ntotal;
7798 * In vi command mode, this function saves the current line to the
7801 * functions, gl_interpret_char() sets gl->vi.undo.saved to 0 before
7810 if(gl->vi.command && !gl->vi.undo.saved) {
7811 strlcpy(gl->vi.undo.line, gl->line, gl->linelen);
7812 gl->vi.undo.buff_curpos = gl->buff_curpos;
7813 gl->vi.undo.ntotal = gl->ntotal;
7814 gl->vi.undo.saved = 1;
7816 if(gl->vi.command && !gl->vi.repeat.saved &&
7818 gl->vi.repeat.action = gl->current_action;
7819 gl->vi.repeat.count = gl->current_count;
7820 gl->vi.repeat.saved = 1;
7826 * In vi mode, restore the line to the way it was before the last command
7835 char *undo_ptr = gl->vi.undo.line;
7849 if(gl->ntotal > gl->vi.undo.ntotal) {
7859 gl->vi.undo.ntotal = gl->ntotal;
7866 * cursor positions to emulate what vi does.
7868 if(gl->buff_curpos < gl->vi.undo.buff_curpos)
7869 gl->vi.undo.buff_curpos = gl->buff_curpos;
7871 gl->buff_curpos = gl->vi.undo.buff_curpos;
7876 gl->vi.repeat.action.fn = gl_vi_undo;
7877 gl->vi.repeat.action.data = NULL;
7878 gl->vi.repeat.count = 1;
7887 * Delete the following word and leave the user in vi insert mode.
7892 gl->vi.command = 0; /* Allow cursor at EOL */
7897 * Delete the preceding word and leave the user in vi insert mode.
7905 * Delete the following section and leave the user in vi insert mode.
7913 * Delete the preceding section and leave the user in vi insert mode.
7921 * Delete the following section and leave the user in vi insert mode.
7929 * Delete the preceding section and leave the user in vi insert mode.
7938 * in vi insert mode.
7942 return gl_delete_find(gl, count, gl->vi.find_char, gl->vi.find_forward,
7943 gl->vi.find_onto, 1);
7948 * direction, and leave the user in vi insert mode.
7952 return gl_delete_find(gl, count, gl->vi.find_char, !gl->vi.find_forward,
7953 gl->vi.find_onto, 1);
7957 * Delete the following character and leave the user in vi insert mode.
7962 gl->vi.command = 0; /* Allow cursor at EOL */
7967 * Delete the preceding character and leave the user in vi insert mode.
8004 * If in vi mode, switch to vi command mode.
8011 if(gl->editor == GL_VI_MODE && !gl->vi.command) {
8013 gl->vi.command = 1;
8014 gl->vi.repeat.input_curpos = gl->insert_curpos;
8015 gl->vi.repeat.command_curpos = gl->buff_curpos;
8031 * This is the action function which implements the vi-repeat-change
8041 if(!gl->vi.repeat.action.fn)
8047 gl->vi.repeat.active = 1;
8051 status = gl->vi.repeat.action.fn(gl, gl->vi.repeat.count,
8052 gl->vi.repeat.action.data);
8056 gl->vi.repeat.active = 0;
8062 if(status==0 && !gl->vi.command) {
8070 if(gl->vi.repeat.input_curpos >= 0 &&
8071 gl->vi.repeat.input_curpos <= gl->vi.repeat.command_curpos &&
8072 gl->vi.repeat.command_curpos <= gl->vi.undo.ntotal) {
8079 for(i=gl->vi.repeat.input_curpos; i<gl->vi.repeat.command_curpos; i++) {
8080 if(gl_add_char_to_line(gl, gl->vi.undo.line[i]))
8146 * the first close parenthesis (this is what the vi % binding does).
8215 * In vi command mode, all key-sequences entered need to be
8218 } else if(gl->vi.command && c != GL_ESC_CHAR) {
8251 * When doing vi-style editing, an escape at the beginning of any binding
8254 if(keyseq[0] == GL_ESC_CHAR && !gl->vi.command)
8280 * Mark the current line as not yet preserved for use by the vi undo command.
8282 gl->vi.undo.saved = 0;
8283 gl->vi.repeat.saved = 0;
10471 gl->vi.command = 0;
10472 gl->vi.undo.line[0] = '\0';
10473 gl->vi.undo.ntotal = 0;
10474 gl->vi.undo.buff_curpos = 0;
10475 gl->vi.repeat.action.fn = 0;
10476 gl->vi.repeat.action.data = 0;