summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-07-29 22:36:03 +0000
committerBram Moolenaar <Bram@vim.org>2005-07-29 22:36:03 +0000
commit4be06f9e1b7ccde37f783e09b6ae35f69aa67995 (patch)
tree4f1e3168c803127f244be4c79d3fc032dda6dca6
parent661b1820956743fd67f957f8dbbc45a93fe38dc9 (diff)
updated for version 7.0119v7.0119
-rw-r--r--runtime/doc/eval.txt124
-rw-r--r--runtime/doc/index.txt3
-rw-r--r--runtime/doc/insert.txt28
-rw-r--r--runtime/doc/options.txt6
-rw-r--r--runtime/doc/syntax.txt5
-rw-r--r--runtime/doc/tags5
-rw-r--r--runtime/doc/todo.txt59
-rw-r--r--runtime/doc/version7.txt3
-rw-r--r--src/diff.c1
-rw-r--r--src/edit.c1386
-rw-r--r--src/eval.c44
-rw-r--r--src/getchar.c2
-rw-r--r--src/globals.h31
-rw-r--r--src/message.c164
-rw-r--r--src/po/README.txt4
-rw-r--r--src/po/af.po1291
-rw-r--r--src/po/ca.po1394
-rw-r--r--src/po/cleanup.vim7
-rw-r--r--src/po/cs.cp1250.po1290
-rw-r--r--src/po/cs.po1290
-rw-r--r--src/po/de.po1426
-rw-r--r--src/po/es.po1453
-rw-r--r--src/po/fr.po1394
-rw-r--r--src/po/ga.po1544
-rw-r--r--src/po/it.po1613
-rw-r--r--src/po/ja.po1543
-rw-r--r--src/po/ja.sjis.po1543
-rw-r--r--src/po/ko.po1426
-rw-r--r--src/po/no.po1428
-rw-r--r--src/po/pl.cp1250.po1607
-rw-r--r--src/po/pl.po1607
-rw-r--r--src/po/ru.cp1251.po1428
-rw-r--r--src/po/ru.po1428
-rw-r--r--src/po/sk.cp1250.po1302
-rw-r--r--src/po/sk.po1302
-rw-r--r--src/po/sv.po1429
-rw-r--r--src/po/uk.cp1251.po1323
-rw-r--r--src/po/uk.po1323
-rw-r--r--src/po/vi.po1428
-rw-r--r--src/po/zh_CN.UTF-8.po1299
-rw-r--r--src/po/zh_CN.cp936.po1299
-rw-r--r--src/po/zh_CN.po1299
-rw-r--r--src/po/zh_TW.UTF-8.po1428
-rw-r--r--src/po/zh_TW.po1428
-rw-r--r--src/proto.h1
-rw-r--r--src/proto/eval.pro2
-rw-r--r--src/search.c29
-rw-r--r--src/tag.c2
-rw-r--r--src/version.h4
49 files changed, 1203 insertions, 40272 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 6168b01f56..d11b77de46 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt* For Vim version 7.0aa. Last change: 2005 Jul 28
+*eval.txt* For Vim version 7.0aa. Last change: 2005 Jul 29
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1585,6 +1585,7 @@ mode() String current editing mode
nextnonblank( {lnum}) Number line nr of non-blank line >= {lnum}
nr2char( {expr}) String single char with ASCII value {expr}
prevnonblank( {lnum}) Number line nr of non-blank line <= {lnum}
+printf( {fmt}, {expr1}...) String format text
range( {expr} [, {max} [, {stride}]])
List items from {expr} to {max}
readfile({fname} [, {binary} [, {max}]])
@@ -3337,6 +3338,127 @@ nr2char({expr}) *nr2char()*
characters. nr2char(0) is a real NUL and terminates the
string, thus results in an empty string.
+printf({fmt}, {expr1} ...) *printf()*
+ Return a String with {fmt}, where "%" items are replaced by
+ the formatted form of their respective arguments. Example: >
+ :echo printf("%4d: E%d %.30s", lnum, err, text)
+< May result in:
+ 99: E42 asdfasdfasdfasdfasdfasdfasdfas ~
+
+ Often used items are:
+ %s string
+ %6s string right-aligned in 6 characters
+ %c character
+ %d decimal number
+ %5d decimal number padded with spaces to 5 characters
+ %x hex number
+ %04x hex number padded with zeros to at least 4 characters
+ %X hex number using upper case letters
+ %o octal number
+ %% the % character
+
+ Conversion specifications start with '%' and end with the
+ conversion type. All other characters are copied unchanged to
+ the result.
+
+ The "%" starts a conversion specification. The following
+ arguments appear in sequence. Overview:
+
+ % flags min-field-width .precision type
+
+ - Zero or more of the following flags:
+
+ # The value should be converted to an "alternate
+ form". For c, d, and s conversions, this option
+ has no effect. For o conversions, the precision
+ of the number is increased to force the first
+ character of the output string to a zero (except
+ if a zero value is printed with an explicit
+ precision of zero).
+ For x and X conversions, a non-zero result has
+ the string "0x" (or "0X" for X conversions)
+ prepended to it.
+
+ 0 (zero) Zero padding. For all conversions the converted
+ value is padded on the left with zeros rather
+ than blanks. If a precision is given with a
+ numeric conversion (d, o, x, and X), the 0 flag
+ is ignored.
+
+ - A negative field width flag; the converted value
+ is to be left adjusted on the field boundary.
+ The converted value is padded on the right with
+ blanks, rather than on the left with blanks or
+ zeros. A - overrides a 0 if both are given.
+
+ ' ' (space) A blank should be left before a positive
+ number produced by a signed conversion (d).
+
+ + A sign must always be placed before a number
+ produced by a signed conversion. A + overrides
+ a space if both are used.
+
+ - An optional decimal digit string specifying a minimum
+ field width. If the converted value has fewer characters
+ than the field width, it will be padded with spaces on the
+ left (or right, if the left-adjustment flag has been
+ given) to fill out the field width.
+
+ - An optional precision, in the form of a period '.'
+ followed by an optional digit string. If the digit string
+ is omitted, the precision is taken as zero. This gives
+ the minimum number of digits to appear for d, o, x, and X
+ conversions, or the maximum number of characters to be
+ printed from a string for s conversions.
+
+ - A character that specifies the type of conversion to be
+ applied, see below.
+
+ A field width or precision, or both, may be indicated by an
+ asterisk '*' instead of a digit string. In this case, a
+ Number argument supplies the field width or precision. A
+ negative field width is treated as a left adjustment flag
+ followed by a positive field width; a negative precision is
+ treated as though it were missing. Example: >
+ :echo printf("%d: %.*s", nr, columns, line)
+< This limits the length of the text used from "line" to
+ "columns" bytes.
+
+ The conversion specifiers and their meanings are:
+
+ doxX The Number argument is converted to signed decimal
+ (d), unsigned octal (o), or unsigned hexadecimal (x
+ and X) notation. The letters "abcdef" are used for
+ x conversions; the letters "ABCDEF" are used for X
+ conversions. The precision, if any, gives the minimum
+ number of digits that must appear; if the converted
+ value requires fewer digits, it is padded on the left
+ with zeros.
+
+ c The Number argument is converted to a byte, and
+ the resulting character is written.
+
+ s The String argument is used. If a precision is
+ specified, no more bytes than the number specified are
+ written.
+
+ % A '%' is written. No argument is converted. The
+ complete conversion specification is "%%".
+
+ Each argument can be Number or String and is converted
+ automatically to fit the conversion specifier.
+
+ In no case does a non-existent or small field width cause
+ truncation of a numeric field; if the result of a conversion
+ is wider than the field width, the field is expanded to
+ contain the conversion result.
+
+ *E766* *767*
+ The number of {exprN} arguments must exactly match the number
+ of "%" items. If there are not sufficient or too many
+ arguments an error is given.
+
+
prevnonblank({lnum}) *prevnonblank()*
Return the line number of the first line at or above {lnum}
that is not blank. Example: >
diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt
index 6146ee3dec..b7be0b881b 100644
--- a/runtime/doc/index.txt
+++ b/runtime/doc/index.txt
@@ -1,4 +1,4 @@
-*index.txt* For Vim version 7.0aa. Last change: 2005 Jul 28
+*index.txt* For Vim version 7.0aa. Last change: 2005 Jul 29
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -150,6 +150,7 @@ commands in CTRL-X submode *i_CTRL-X_index*
|i_CTRL-X_CTRL-K| CTRL-X CTRL-K complete identifiers from dictionary
|i_CTRL-X_CTRL-L| CTRL-X CTRL-L complete whole lines
|i_CTRL-X_CTRL-N| CTRL-X CTRL-N next completion
+|i_CTRL-X_CTRL-O| CTRL-X CTRL-O occult completion
|i_CTRL-X_CTRL-P| CTRL-X CTRL-P previous completion
|i_CTRL-X_CTRL-T| CTRL-X CTRL-T complete identifiers from thesaurus
|i_CTRL-X_CTRL-Y| CTRL-X CTRL-Y scroll down
diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt
index 95ef238c02..8389fe5a3a 100644
--- a/runtime/doc/insert.txt
+++ b/runtime/doc/insert.txt
@@ -1,4 +1,4 @@
-*insert.txt* For Vim version 7.0aa. Last change: 2005 Jul 26
+*insert.txt* For Vim version 7.0aa. Last change: 2005 Jul 29
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -547,7 +547,7 @@ entering new data while keeping all the columns aligned.
==============================================================================
7. Insert mode completion *ins-completion*
-In Insert and Replace modes, there are several commands to complete part of a
+In Insert and Replace mode, there are several commands to complete part of a
keyword or line that has been typed. This is useful if you are using
complicated keywords (e.g., function names with capitals and underscores).
@@ -565,7 +565,9 @@ Completion can be done for:
7. file names |i_CTRL-X_CTRL-F|
8. definitions or macros |i_CTRL-X_CTRL-D|
9. Vim command-line |i_CTRL-X_CTRL-V|
-10. keywords in 'complete' |i_CTRL-N|
+10. User defined completion |i_CTRL-X_CTRL-U|
+11. Occult completion |i_CTRL-X_CTRL-O|
+12. keywords in 'complete' |i_CTRL-N|
All these (except 2) are done in CTRL-X mode. This is a sub-mode of Insert
and Replace modes. You enter CTRL-X mode by typing CTRL-X and one of the
@@ -839,7 +841,8 @@ CTRL-X CTRL-D Search in the current and included files for the
Completing Vim commands *compl-vim*
Completion is context-sensitive. It works like on the Command-line. It
-completes an Ex command as well as its arguments.
+completes an Ex command as well as its arguments. This is useful when writing
+a Vim script.
*i_CTRL-X_CTRL-V*
CTRL-X CTRL-V Guess what kind of item is in front of the cursor and
@@ -858,7 +861,7 @@ CTRL-X CTRL-V Guess what kind of item is in front of the cursor and
completion, for example: >
:imap <Tab> <C-X><C-V>
-User defined completing *compl-function*
+User defined completion *compl-function*
Completion is done by a function that can be defined by the user with the
'completefunc' option. See the option for how the function is called and an
@@ -875,6 +878,21 @@ CTRL-X CTRL-U Guess what kind of item is in front of the cursor and
previous one.
+Occult completion *compl-occult*
+
+Completion is done by a supernatural being.
+
+ *i_CTRL-X_CTRL-O*
+CTRL-X CTRL-O Guess what kind of item is in front of the cursor and
+ find the first match for it.
+ CTRL-O or
+ CTRL-N Use the next match. This match replaces the previous
+ one.
+
+ CTRL-P Use the previous match. This match replaces the
+ previous one.
+
+
Completing keywords from different sources *compl-generic*
*i_CTRL-N*
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 88e440ad09..6c658b08c7 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1,4 +1,4 @@
-*options.txt* For Vim version 7.0aa. Last change: 2005 Jul 28
+*options.txt* For Vim version 7.0aa. Last change: 2005 Jul 29
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1585,7 +1585,7 @@ A jump table for the options with a short description can be found at |Q_op|.
local to buffer
{not in Vi}
This option specifies a completion function to be used for CTRL-X
- CTRL-X. The function will be invoked with four arguments:
+ CTRL-U. The function will be invoked with four arguments:
a:line the text of the current line
a:base the text with which matches should match
a:col column in a:line where the cursor is, first column is
@@ -2282,8 +2282,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|viminfo-file|. And Vim expects the terminal to use utf-8 too. Thus
setting 'encoding' to one of these values instead of utf-8 only has
effect for encoding used for files when 'fileencoding' is empty.
- "utf-16" is NOT supported (and probably never will be, since it's such
- an ugly encoding). *utf-16*
When 'encoding' is set to a Unicode encoding, and 'fileencodings' was
not set yet, the default for 'fileencodings' is changed.
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index 324d45238a..dfe93cabc1 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -1,4 +1,4 @@
-*syntax.txt* For Vim version 7.0aa. Last change: 2005 Jul 28
+*syntax.txt* For Vim version 7.0aa. Last change: 2005 Jul 29
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -3648,7 +3648,8 @@ also tell where it was last set. Example: >
Last set from /home/mool/vim/vim7/runtime/syntax/syncolor.vim ~
For details about when this message is given and when it's valid see
-|:set-verbose|.
+|:set-verbose|. When ":hi clear" is used then the script where this command
+is used will be mentioned for the default values.
*highlight-args* *E416* *E417* *E423*
There are three types of terminals for highlighting:
diff --git a/runtime/doc/tags b/runtime/doc/tags
index cce8395e32..ac15db6631 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -1596,6 +1596,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
45.4 usr_45.txt /*45.4*
45.5 usr_45.txt /*45.5*
755 spell.txt /*755*
+767 eval.txt /*767*
90.1 usr_90.txt /*90.1*
90.2 usr_90.txt /*90.2*
90.3 usr_90.txt /*90.3*
@@ -3734,6 +3735,7 @@ E762 spell.txt /*E762*
E763 spell.txt /*E763*
E764 spell.txt /*E764*
E765 options.txt /*E765*
+E766 eval.txt /*E766*
E77 message.txt /*E77*
E78 motion.txt /*E78*
E79 message.txt /*E79*
@@ -4449,6 +4451,7 @@ compl-filename insert.txt /*compl-filename*
compl-function insert.txt /*compl-function*
compl-generic insert.txt /*compl-generic*
compl-keyword insert.txt /*compl-keyword*
+compl-occult insert.txt /*compl-occult*
compl-tag insert.txt /*compl-tag*
compl-vim insert.txt /*compl-vim*
compl-whole-line insert.txt /*compl-whole-line*
@@ -5334,6 +5337,7 @@ i_CTRL-X_CTRL-I insert.txt /*i_CTRL-X_CTRL-I*
i_CTRL-X_CTRL-K insert.txt /*i_CTRL-X_CTRL-K*
i_CTRL-X_CTRL-L insert.txt /*i_CTRL-X_CTRL-L*
i_CTRL-X_CTRL-N insert.txt /*i_CTRL-X_CTRL-N*
+i_CTRL-X_CTRL-O insert.txt /*i_CTRL-X_CTRL-O*
i_CTRL-X_CTRL-P insert.txt /*i_CTRL-X_CTRL-P*
i_CTRL-X_CTRL-T insert.txt /*i_CTRL-X_CTRL-T*
i_CTRL-X_CTRL-U insert.txt /*i_CTRL-X_CTRL-U*
@@ -5996,6 +6000,7 @@ print-intro print.txt /*print-intro*
print-options print.txt /*print-options*
print.txt print.txt /*print.txt*
printcap-syntax syntax.txt /*printcap-syntax*
+printf() eval.txt /*printf()*
printing print.txt /*printing*
printing-formfeed print.txt /*printing-formfeed*
profile repeat.txt /*profile*
diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index e680568916..656bb18560 100644
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1,4 +1,4 @@
-*todo.txt* For Vim version 7.0aa. Last change: 2005 Jul 28
+*todo.txt* For Vim version 7.0aa. Last change: 2005 Jul 29
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -30,8 +30,6 @@ be worked on, but only if you sponsor Vim development. See |sponsor|.
*known-bugs*
-------------------- Known bugs and current work -----------------------
-Is it simple to let ":verbose hi mailSubject" mention where it was last set?
-
Mac unicode patch (Da Woon Jung):
- selecting proportional font breaks display
- UTF-8 text causes display problems. Font replacement causes this.
@@ -55,10 +53,31 @@ Awaiting response:
the screen.
- mblen(NULL, 0) also in Vim 6.3?
+Implement printf("blah %d: %s", nr, str)? Use vim_snprintf code.
PLANNED FOR VERSION 7.0:
-- "INTELLISENSE". First cleanup the Insert-mode completion.
+- Occult completion: Understands the programming language and finds matches
+ that make sense. Esp. members of classes/structs.
+
+ It's not much different from other Insert-mode completion, use the same
+ mechanism. Use CTRL-X CTRL-O.
+
+ Separately develop the completion logic and the UI. When adding UI stuff
+ make it work for all completion methods.
+
+ First cleanup the Insert-mode completion.
+
+ UI:
+ - Use 'wildmenu' kind of thing.
+ - Put the list of choices right under the place where they would be
+ inserted.
+
+ Completion logic:
+ Use 'coupler' option to list items that connect words. For C: ".,->".
+ In function arguments suggest variables of expected type.
+
+ Ideas from others:
http://www.vim.org/scripts/script.php?script_id=747
www.vim.org script 1213 (Java Development Environment) (Fuchuan Wang)
http://sourceforge.net/projects/insenvim
@@ -67,24 +86,22 @@ PLANNED FOR VERSION 7.0:
and http://stud4.tuwien.ac.at/~e0125672/icomplete/
http://cedet.sourceforge.net/intellisense.shtml (for Emacs)
Ivan Villanueva has something for Java.
- Ideas from Emads:
- http://www.xref-tech.com/xrefactory/more_c_completion.html
- Can't call it Intellisense, it is a trademark by Microsoft.
- Ideas from the Vim 7 BOF at SANE:
- - It's not possible to have one solution for all languages. Design an
- interface for completion plugins. The matches can be done in a
- Vim-script list.
- - For interpreted languages, use the interpreter to obtain information.
- Should work for Java (Eclipse does this), Python, Tcl, etc.
- Richard Emberson mentioned working on an interface to Java.
- - Check Readline for its completion interface.
- - Use ctags for other languages. Writing a file could trigger running
- ctags, merging the tags of the changed file.
- Also see "Visual Assist" http://www.wholetomato.com/products:
- - Put the list of choices right under the place where they would be
- inserted.
+ Emads: http://www.xref-tech.com/xrefactory/more_c_completion.html
+ Ideas from the Vim 7 BOF at SANE:
+ - It's not possible to have one solution for all languages. Design an
+ interface for completion plugins. The matches can be done in a
+ Vim-script list.
+ - For interpreted languages, use the interpreter to obtain information.
+ Should work for Java (Eclipse does this), Python, Tcl, etc.
+ Richard Emberson mentioned working on an interface to Java.
+ - Check Readline for its completion interface.
+ - Use ctags for other languages. Writing a file could trigger running
+ ctags, merging the tags of the changed file.
+ "Visual Assist" http://www.wholetomato.com/products:
+ Completion in .NET framework SharpDevelop: http://www.icsharpcode.net
+
- Pre-expand abbreviations, show which abbrevs would match?
- - Completion in .NET framework SharpDevelop: http://www.icsharpcode.net
+
- UNDO TREE: keep all states of the text, don't delete undo info.
When making a change, instead of clearing any future undo (thus redo)
info, make a new branch.
diff --git a/runtime/doc/version7.txt b/runtime/doc/version7.txt
index 126d767658..7094070f71 100644
--- a/runtime/doc/version7.txt
+++ b/runtime/doc/version7.txt
@@ -1,4 +1,4 @@
-*version7.txt* For Vim version 7.0aa. Last change: 2005 Jul 28
+*version7.txt* For Vim version 7.0aa. Last change: 2005 Jul 29
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -409,6 +409,7 @@ New functions: ~
|max()| maximum value in a List or Dictionary
|min()| minimum value in a List or Dictionary
|mkdir()| create a directory
+|printf()| format text
|readfile()| read a file into a list of lines
|remove()| remove one or more items from a List or Dictionary
|repeat()| repeat "expr" "count" times (Christophe Poucet)
diff --git a/src/diff.c b/src/diff.c
index 4acba3df7b..3265986951 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -1009,6 +1009,7 @@ ex_diffsplit(eap)
{
/* Pretend it was a ":split fname" command */
eap->cmdidx = CMD_split;
+ curwin->w_p_diff = TRUE;
do_exedit(eap, old_curwin);
if (curwin != old_curwin) /* split must have worked */
diff --git a/src/edit.c b/src/edit.c
index 48883fde69..01a6591f79 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -31,6 +31,8 @@
#define CTRL_X_THESAURUS (10 + CTRL_X_WANT_IDENT)
#define CTRL_X_CMDLINE 11
#define CTRL_X_FUNCTION 12
+#define CTRL_X_OCCULT 13
+#define CTRL_X_LOCAL_MSG 14 /* only used in "ctrl_x_msgs" */
#define CHECK_KEYS_TIME 30
@@ -40,9 +42,7 @@ static char *ctrl_x_msgs[] =
{
N_(" Keyword completion (^N^P)"), /* ctrl_x_mode == 0, ^P/^N compl. */
N_(" ^X mode (^E^Y^L^]^F^I^K^D^U^V^N^P)"),
- /* Scroll has it's own msgs, in it's place there is the msg for local
- * ctrl_x_mode = 0 (eg continue_status & CONT_LOCAL) -- Acevedo */
- N_(" Keyword Local completion (^N^P)"),
+ NULL,
N_(" Whole line completion (^L^N^P)"),
N_(" File name completion (^F^N^P)"),
N_(" Tag completion (^]^N^P)"),
@@ -53,6 +53,8 @@ static char *ctrl_x_msgs[] =
N_(" Thesaurus completion (^T^N^P)"),
N_(" Command-line completion (^V^N^P)"),
N_(" User defined completion (^U^N^P)"),
+ N_(" Occult completion (^O^N^P)"),
+ N_(" Keyword Local completion (^N^P)"),
};
static char_u e_hitend[] = N_("Hit end of paragraph");
@@ -76,28 +78,35 @@ struct Completion
/*
* All the current matches are stored in a list.
- * "first_match" points to the start of the list.
- * "curr_match" points to the currently selected entry.
- * "shown_match" is different from curr_match during ins_compl_get_exp().
+ * "compl_first_match" points to the start of the list.
+ * "compl_curr_match" points to the currently selected entry.
+ * "compl_shown_match" is different from compl_curr_match during
+ * ins_compl_get_exp().
*/
-static struct Completion *first_match = NULL;
-static struct Completion *curr_match = NULL;
-static struct Completion *shown_match = NULL;
-
-static int started_completion = FALSE;
-static int completion_matches = 0;
-static char_u *complete_pat = NULL;
-static int complete_direction = FORWARD;
-static int shown_direction = FORWARD;
-static int completion_pending = FALSE;
-static pos_T initial_pos;
-static colnr_T complete_col = 0; /* column where the text starts
+static struct Completion *compl_first_match = NULL;
+static struct Completion *compl_curr_match = NULL;
+static struct Completion *compl_shown_match = NULL;
+
+/* When the first completion is done "compl_started" is set. When it's
+ * FALSE the word to be completed must be located. */
+static int compl_started = FALSE;
+
+static int compl_matches = 0;
+static char_u *compl_pattern = NULL;
+static int compl_direction = FORWARD;
+static int compl_shows_dir = FORWARD;
+static int compl_pending = FALSE;
+static pos_T compl_startpos;
+static colnr_T compl_col = 0; /* column where the text starts
that is being completed */
-static int save_sm;
-static char_u *original_text = NULL; /* text before completion */
-static int continue_mode = 0;
-static expand_T complete_xp;
-
+static int save_sm = -1;
+static char_u *compl_orig_text = NULL; /* text as it was before
+ completion started */
+static int compl_cont_mode = 0;
+static expand_T compl_xp;
+
+static void ins_ctrl_x __ARGS((void));
+static int has_compl_option __ARGS((int dict_opt));
static int ins_compl_add __ARGS((char_u *str, int len, char_u *, int dir, int reuse));
static void ins_compl_add_matches __ARGS((int num_matches, char_u **matches, int dir));
static int ins_compl_make_cyclic __ARGS((void));
@@ -145,6 +154,7 @@ static int cindent_on __ARGS((void));
#endif
static void ins_reg __ARGS((void));
static void ins_ctrl_g __ARGS((void));
+static void ins_ctrl_hat __ARGS((void));
static int ins_esc __ARGS((long *count, int cmdchar));
#ifdef FEAT_RIGHTLEFT
static void ins_ctrl_ __ARGS((void));
@@ -152,6 +162,8 @@ static void ins_ctrl_ __ARGS((void));
#ifdef FEAT_VISUAL
static int ins_start_select __ARGS((int c));
#endif
+static void ins_insert __ARGS((int replaceState));
+static void ins_ctrl_o __ARGS((void));
static void ins_shift __ARGS((int c, int lastc));
static void ins_del __ARGS((void));
static int ins_bs __ARGS((int c, int mode, int *inserted_space_p));
@@ -178,6 +190,7 @@ static int ins_eol __ARGS((int c));
static int ins_digraph __ARGS((void));
#endif
static int ins_copychar __ARGS((linenr_T lnum));
+static int ins_ctrl_ey __ARGS((int tc));
#ifdef FEAT_SMARTINDENT
static void ins_try_si __ARGS((int c));
#endif
@@ -735,121 +748,12 @@ edit(cmdchar, startln, count)
*/
switch (c)
{
- /* toggle insert/replace mode */
- case K_INS:
- case K_KINS:
-#ifdef FEAT_FKMAP
- if (p_fkmap && p_ri)
- {
- beep_flush();
- EMSG(farsi_text_3); /* encoded in Farsi */
- break;
- }
-#endif
-#ifdef FEAT_AUTOCMD
- set_vim_var_string(VV_INSERTMODE,
- (char_u *)((State & REPLACE_FLAG) ? "i" :
- replaceState == VREPLACE ? "v" : "r"), 1);
- apply_autocmds(EVENT_INSERTCHANGE, NULL, NULL, FALSE, curbuf);
-#endif
- if (State & REPLACE_FLAG)
- State = INSERT | (State & LANGMAP);
- else
- State = replaceState | (State & LANGMAP);
- AppendCharToRedobuff(K_INS);
- showmode();
-#ifdef CURSOR_SHAPE
- ui_cursor_shape(); /* may show different cursor shape */
-#endif
- break;
-
-#ifdef FEAT_INS_EXPAND
- /* Enter CTRL-X mode */
- case Ctrl_X:
- /* CTRL-X after CTRL-X CTRL-V doesn't do anything, so that CTRL-X
- * CTRL-V works like CTRL-N */
- if (ctrl_x_mode != CTRL_X_CMDLINE)
- {
- /* if the next ^X<> won't ADD nothing, then reset
- * continue_status */
- if (continue_status & CONT_N_ADDS)
- continue_status = (continue_status | CONT_INTRPT);
- else
- continue_status = 0;
- /* We're not sure which CTRL-X mode it will be yet */
- ctrl_x_mode = CTRL_X_NOT_DEFINED_YET;
- edit_submode = (char_u *)_(CTRL_X_MSG(ctrl_x_mode));
- edit_submode_pre = NULL;
- showmode();
- }
- break;
-#endif
-
- /* end of Select mode mapping - ignore */
- case K_SELECT:
- break;
-
- /* suspend when 'insertmode' set */
- case Ctrl_Z:
- if (!p_im)
- goto normalchar; /* insert CTRL-Z as normal char */
- stuffReadbuff((char_u *)":st\r");
- c = Ctrl_O;
- /*FALLTHROUGH*/
-
- /* execute one command */
- case Ctrl_O:
- if (echeck_abbr(Ctrl_O + ABBR_OFF))
- break;
- count = 0;
-#ifdef FEAT_VREPLACE
- if (State & VREPLACE_FLAG)
- restart_edit = 'V';
- else
-#endif
- if (State & REPLACE_FLAG)
- restart_edit = 'R';
- else
- restart_edit = 'I';
-#ifdef FEAT_VIRTUALEDIT
- if (virtual_active())
- ins_at_eol = FALSE; /* cursor always keeps its column */