changeset 725:0a9371c70540 v7.0220

updated for version 7.0220
author vimboss
date Fri, 10 Mar 2006 21:46:58 +0000
parents a35dce0cabc5
children d0d7131a797e
files runtime/doc/todo.txt runtime/doc/version7.txt src/eval.c src/ex_cmds.c src/proto/edit.pro
diffstat 5 files changed, 100 insertions(+), 50 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1,4 +1,4 @@
-*todo.txt*      For Vim version 7.0aa.  Last change: 2006 Mar 09
+*todo.txt*      For Vim version 7.0aa.  Last change: 2006 Mar 10
 
 
 		  VIM REFERENCE MANUAL	  by Bram Moolenaar
@@ -30,6 +30,11 @@ be worked on, but only if you sponsor Vi
 							*known-bugs*
 -------------------- Known bugs and current work -----------------------
 
+--remote-tab to open file in new tab in existing Vim server?
+--remote-tab-silent
+--remote-tab-wait
+--remote-tab-wait-silent
+
 Win32: Describe how to do debugging. (George Reilly)
 
 Mac unicode patch (Da Woon Jung):
@@ -45,58 +50,19 @@ 8   Add patch from Muraoka Taro (Mar 16)
 - With 'nopaste' pasting is wrong, with 'paste' Command-V doesn't work.
   (Alan Schmitt)
 
-Add ShellCmdPre/ShellCmdPost/ShellFilterPre/ShellFilterPost ?
-Useful for updating the diretory listing in netrw.
 
 CONSIDERED FOR VERSION 7.0:
 
 Omni completion:
     ccomplete:
     - For C add tag "kind" field to each match?
-    - Flickering because of syntax highlighting redrawing further lines.
     - When a typedef or struct is local to a file only use it in that file?
 
     UI:
-    - Add an "auto" mode: after typing a character (or string) completion is
-      done for the longest common string.  plugin defines the possible
-      characters/strings. (Martin Stubenschrott)
-      And/or: Provide a function to popup the menu, so that an insert mode
-      mapping can start it (with a specific selection).
     - Show "info" from a match in preview window (with an option or by opening
       a preview window with a specific name).
       Or use one window for matches, another for context/info (Doug Kearns,
       2005 Sep 13)
-    - Ideas on: http://www.wholetomato.com/
-
-    Completion logic:
-	Ideas from others:
-	http://www.vim.org/scripts/script.php?script_id=747
-	    http://sourceforge.net/projects/insenvim
-		or http://insenvim.sourceforge.net
-	    Java, XML, HTML, C++, JSP, SQL, C#
-	    MS-Windows only, lots of dependencies (e.g. Perl, Internet
-		explorer), uses .dll shared libraries.
-	    For C++ uses $INCLUDE environment var.
-	    Uses Perl for C++.
-	    Uses ctags to find the info:
-		ctags -f $allTagsFile --fields=+aiKmnsSz --language-force=C++ --C++-kinds=+cefgmnpsut-dlux -u $files
-
-	www.vim.org script 1213 (Java Development Environment) (Fuchuan Wang)
-	IComplete: http://www.vim.org/scripts/script.php?script_id=1265
-	    and http://stud4.tuwien.ac.at/~e0125672/icomplete/
-	http://cedet.sourceforge.net/intellisense.shtml (for Emacs)
-	Ivan Villanueva has something for Java.
-	Emads: http://www.xref-tech.com/xrefactory/more_c_completion.html
-	Ideas from the Vim 7 BOF at SANE:
-	- 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.
-	Completion in .NET framework SharpDevelop: http://www.icsharpcode.net
-
-        - Pre-expand abbreviations, show which abbrevs would match?
 
 -   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)
@@ -2186,6 +2152,36 @@ 8   When editing "tt.gz", which is in DO
     them save the file itself besides the swapfile.
 
 
+Omni completion:
+-   Ideas from the Vim 7 BOF at SANE:
+	- 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.
+-   Ideas from others:
+	http://www.wholetomato.com/
+	http://www.vim.org/scripts/script.php?script_id=747
+	    http://sourceforge.net/projects/insenvim
+		or http://insenvim.sourceforge.net
+	    Java, XML, HTML, C++, JSP, SQL, C#
+	    MS-Windows only, lots of dependencies (e.g. Perl, Internet
+		explorer), uses .dll shared libraries.
+	    For C++ uses $INCLUDE environment var.
+	    Uses Perl for C++.
+	    Uses ctags to find the info:
+		ctags -f $allTagsFile --fields=+aiKmnsSz --language-force=C++ --C++-kinds=+cefgmnpsut-dlux -u $files
+	www.vim.org script 1213 (Java Development Environment) (Fuchuan Wang)
+	IComplete: http://www.vim.org/scripts/script.php?script_id=1265
+	    and http://stud4.tuwien.ac.at/~e0125672/icomplete/
+	http://cedet.sourceforge.net/intellisense.shtml (for Emacs)
+	Ivan Villanueva has something for Java.
+	Emads: http://www.xref-tech.com/xrefactory/more_c_completion.html
+	Completion in .NET framework SharpDevelop: http://www.icsharpcode.net
+-   Pre-expand abbreviations, show which abbrevs would match?
+
+
 Insert mode completion/expansion:
 -   GUI implementation of the popup menu.
 8   When there is no word before the cursor but something like "sys." complete
@@ -2605,6 +2601,7 @@ 7   ":abbr b byte", append "b " to an ex
 8   To make a mapping work with a prepended "x to select a register, store the
     last _typed_ register name and access it with "&.
 8   Add ":amap", like ":amenu".
+7   Add a mapping that works always, for remapping the keyboard.
 8   Add ":cab!", abbreviations that only apply to Command-line mode and not to
     entering search strings.
 8   Add a flag to ":abbrev" to eat the character that triggers the
@@ -2625,12 +2622,17 @@ 7   When someone tries to unmap with a t
 7   Make it possible to map 'wildchar', but only when it's a special character
     (like CTRL-E).  Currently it's only recognized when typed.  Useful for
     mapping a key to do something and then completion.
-7   Add a mapping that works always, for remapping the keyboard.
 6   Context-sensitive abbreviations: Specify syntax group(s) in which the
     abbreviations are to be used.
 -   Add mappings that take arguments.  Could work like the ":s" command.  For
     example, for a mouse escape sequence:
 	:mapexp  <Esc>{\([0-9]*\),\([0-9]*\);	H\1j\2l
+-   Add optional <Number> argument for mappings:
+    :map <Number>q	     ^W^W<Number>G
+    :map <Number>q<Number>t  ^W^W<Number1-1>G<Number2>l
+    :map q<Char>	    :s/<Char>/\u\0/g
+    Or implicit:
+    :map q			<Register>d<Number>$
 -   Make it possible to include a <Nul> in the lhs and rhs of a mapping.
 -   Add command to repeat a whole mapping ("." only repeats the last change in
     a mapping).  Also: Repeat a whole insert command, including any mappings
@@ -2645,17 +2647,9 @@ 6   When using mappings in Insert mode, 
     mappings first, then remove them again when a mapping matches.  Avoids
     that characters that are the start of some mapping are not shown until you
     hit another character.
--   Add optional <Number> argument for mappings:
-    :map <Number>q	     ^W^W<Number>G
-    :map <Number>q<Number>t  ^W^W<Number1-1>G<Number2>l
-    :map q<Char>	    :s/<Char>/\u\0/g
-    Or implicit:
-    :map q			<Register>d<Number>$
 -   Add mappings for replace mode: ":rmap".  How do we then enter mappings for
     non-replace Insert mode?
 -   Add separate mappings for Visual-character/block/line mode?
-6   Alias for Normal mode commands, works like :substitute?  Would allow
-    mappings with arguments.
 -   Add 'mapstop' command, to stop recursive mappings.
 -   List mappings that have a raw escape sequence both with the name of the key
     for that escape sequence (if there is one) and the sequence itself.
--- a/runtime/doc/version7.txt
+++ b/runtime/doc/version7.txt
@@ -1,4 +1,4 @@
-*version7.txt*  For Vim version 7.0aa.  Last change: 2006 Mar 09
+*version7.txt*  For Vim version 7.0aa.  Last change: 2006 Mar 10
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -32,6 +32,7 @@ POSIX compatibility			|new-posix|
 Debugger support			|new-debug-support|
 Remote file explorer			|new-netrw-explore|
 Define an operator			|new-define-operator|
+Mapping to an expression		|new-map-expression|
 Location list				|new-location-list|
 Various new items			|new-items-7|
 
@@ -400,6 +401,17 @@ through the |g@| operator.
 See |:map-operator| for the explanation and an example.
 
 
+Mapping to an expression				*new-map-expression*
+------------------------
+
+The {rhs} argument of a mapping can be an expression.  That means the
+resulting characters can depend on the context.  Example: >
+	:inoremap <expr> . InsertDot()
+Here the dot will be mapped to whatever InsertDot() returns.
+
+Also works for abbreviations.  See |:map-<expr>| for the details.
+
+
 Location list						*new-location-list*
 -------------
 
@@ -647,6 +659,9 @@ New autocommand events: ~
 
 |SpellFileMissing|	when a spell file can't be found
 
+|ShellCmdPost|		after executing a shell command
+|ShellFilterPost|	after filtering with a shell command
+
 |SourcePre|		before sourcing a Vim script
 
 |CursorHoldI|		the user doesn't press a key for a while in Insert mode
--- a/src/eval.c
+++ b/src/eval.c
@@ -467,6 +467,7 @@ static void f_char2nr __ARGS((typval_T *
 static void f_cindent __ARGS((typval_T *argvars, typval_T *rettv));
 static void f_col __ARGS((typval_T *argvars, typval_T *rettv));
 #if defined(FEAT_INS_EXPAND)
+static void f_complete __ARGS((typval_T *argvars, typval_T *rettv));
 static void f_complete_add __ARGS((typval_T *argvars, typval_T *rettv));
 static void f_complete_check __ARGS((typval_T *argvars, typval_T *rettv));
 #endif
@@ -6884,6 +6885,7 @@ static struct fst
     {"cindent",		1, 1, f_cindent},
     {"col",		1, 1, f_col},
 #if defined(FEAT_INS_EXPAND)
+    {"complete",	2, 2, f_complete},
     {"complete_add",	1, 1, f_complete_add},
     {"complete_check",	0, 0, f_complete_check},
 #endif
@@ -8102,6 +8104,35 @@ f_col(argvars, rettv)
 
 #if defined(FEAT_INS_EXPAND)
 /*
+ * "complete()" function
+ */
+/*ARGSUSED*/
+    static void
+f_complete(argvars, rettv)
+    typval_T	*argvars;
+    typval_T	*rettv;
+{
+    int	    startcol;
+
+    if ((State & INSERT) == 0)
+    {
+	EMSG(_("E785: complete() can only be used in Insert mode"));
+	return;
+    }
+    if (argvars[1].v_type != VAR_LIST || argvars[1].vval.v_list == NULL)
+    {
+	EMSG(_(e_invarg));
+	return;
+    }
+
+    startcol = get_tv_number_chk(&argvars[0], NULL);
+    if (startcol <= 0)
+	return;
+
+    set_completion(startcol - 1, argvars[1].vval.v_list);
+}
+
+/*
  * "complete_add()" function
  */
 /*ARGSUSED*/
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -949,9 +949,14 @@ do_bang(addr_count, eap, forceit, do_in,
 	do_shell(newcmd, 0);
     }
     else				/* :range! */
+    {
 	/* Careful: This may recursively call do_bang() again! (because of
 	 * autocommands) */
 	do_filter(line1, line2, eap, newcmd, do_in, do_out);
+#ifdef FEAT_AUTOCMD
+	apply_autocmds(EVENT_SHELLFILTERPOST, NULL, NULL, FALSE, curbuf);
+#endif
+    }
     if (free_newcmd)
 	vim_free(newcmd);
 }
@@ -1419,6 +1424,10 @@ do_shell(cmd, flags)
 
     /* display any error messages now */
     display_errors();
+
+#ifdef FEAT_AUTOCMD
+    apply_autocmds(EVENT_SHELLCMDPOST, NULL, NULL, FALSE, curbuf);
+#endif
 }
 
 /*
--- a/src/proto/edit.pro
+++ b/src/proto/edit.pro
@@ -9,6 +9,7 @@ void backspace_until_column __ARGS((int 
 int vim_is_ctrl_x_key __ARGS((int c));
 int ins_compl_add_infercase __ARGS((char_u *str, int len, int icase, char_u *fname, int dir, int flags));
 int ins_compl_add __ARGS((char_u *str, int len, int icase, char_u *fname, char_u *extra, int cdir, int flags));
+void set_completion __ARGS((int startcol, list_T *list));
 void ins_compl_show_pum __ARGS((void));
 char_u *find_word_start __ARGS((char_u *ptr));
 char_u *find_word_end __ARGS((char_u *ptr));