summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2004-12-27 21:59:20 +0000
committerBram Moolenaar <Bram@vim.org>2004-12-27 21:59:20 +0000
commit86b68359978c933419279e599d0a8cf536095d77 (patch)
tree4291920506f596f1c934c9cf3af5641bdc63b900
parentb5bf5b8fae9ff5e2f7704686efae2814be1e18f7 (diff)
updated for version 7.0025v7.0025
-rw-r--r--runtime/doc/change.txt12
-rw-r--r--runtime/doc/index.txt3
-rw-r--r--runtime/doc/options.txt20
-rw-r--r--runtime/doc/quickfix.txt63
-rw-r--r--runtime/doc/tags5
-rw-r--r--runtime/doc/todo.txt43
-rw-r--r--runtime/doc/version7.txt11
-rw-r--r--runtime/optwin.vim5
-rw-r--r--src/buffer.c23
-rw-r--r--src/charset.c2
-rw-r--r--src/digraph.c4
-rw-r--r--src/edit.c1
-rw-r--r--src/eval.c15
-rw-r--r--src/ex_cmds.c3
-rw-r--r--src/ex_cmds.h6
-rw-r--r--src/ex_cmds2.c60
-rw-r--r--src/ex_docmd.c66
-rw-r--r--src/ex_getln.c7
-rw-r--r--src/fileio.c3
-rw-r--r--src/fold.c10
-rw-r--r--src/gui_gtk.c3
-rw-r--r--src/if_xcmdsrv.c4
-rw-r--r--src/main.c2
-rw-r--r--src/mbyte.c4
-rw-r--r--src/menu.c1
-rw-r--r--src/message.c1
-rw-r--r--src/misc1.c39
-rw-r--r--src/misc2.c25
-rw-r--r--src/option.c9
-rw-r--r--src/os_mswin.c3
-rw-r--r--src/os_win32.c21
-rw-r--r--src/proto/buffer.pro1
-rw-r--r--src/proto/ex_cmds2.pro1
-rw-r--r--src/proto/ex_docmd.pro4
-rw-r--r--src/proto/quickfix.pro3
-rw-r--r--src/quickfix.c242
-rw-r--r--src/regexp.c5
-rw-r--r--src/structs.h3
-rw-r--r--src/syntax.c14
-rw-r--r--src/tag.c4
-rw-r--r--src/term.c3
41 files changed, 536 insertions, 218 deletions
diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt
index 08fdc1d544..4ed7200ffc 100644
--- a/runtime/doc/change.txt
+++ b/runtime/doc/change.txt
@@ -1,4 +1,4 @@
-*change.txt* For Vim version 7.0aa. Last change: 2004 Dec 17
+*change.txt* For Vim version 7.0aa. Last change: 2004 Dec 24
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1332,10 +1332,12 @@ a Automatic formatting of paragraphs. Every time text is inserted or
deleted the paragraph will be reformatted. See |auto-format|.
When the 'c' flag is present this only happens for recognized
comments.
-n When formatting text, recognize numbered lists. The indent of the
- text after the number is used for the next line. The number may
- optionally be followed by '.', ':', ')', ']' or '}'. Note that
- 'autoindent' must be set too. Doesn't work well together with "2".
+n When formatting text, recognize numbered lists. This actually uses
+ the 'formatlistpat' option, thus any kind of list can be used. The
+ indent of the text after the number is used for the next line. The
+ default is to find a number, optionally be followed by '.', ':', ')',
+ ']' or '}'. Note that 'autoindent' must be set too. Doesn't work
+ well together with "2".
Example: >
1. the first item
wraps
diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt
index 9350cf860e..a0bc07b63f 100644
--- a/runtime/doc/index.txt
+++ b/runtime/doc/index.txt
@@ -1,4 +1,4 @@
-*index.txt* For Vim version 7.0aa. Last change: 2004 Dec 23
+*index.txt* For Vim version 7.0aa. Last change: 2004 Dec 24
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1059,6 +1059,7 @@ The commands are sorted on the non-optional part of their name.
|:cabclear| :cabc[lear] clear all abbreviations for Command-line mode
|:call| :cal[l] call a function
|:catch| :cat[ch] part of a :try command
+|:cbuffer| :cb[uffer] parse error messages and jump to first error
|:cc| :cc go to specific error
|:cclose| :ccl[ose] close quickfix window
|:cd| :cd change directory
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index c9baebe855..a43e24ee8e 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1,4 +1,4 @@
-*options.txt* For Vim version 7.0aa. Last change: 2004 Dec 21
+*options.txt* For Vim version 7.0aa. Last change: 2004 Dec 24
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -2728,6 +2728,20 @@ A jump table for the options with a short description can be found at |Q_op|.
NOTE: This option is set to the Vi default value when 'compatible' is
set and to the Vim default value when 'compatible' is reset.
+ *'formatlistpat'* *'flp'*
+'formatlistpat' 'flp' string (default: "^\s*\d\+[\]:.)}\t ]\s*")
+ local to buffer
+ {not in Vi}
+ A pattern that is used to recognize a list header. This is used for
+ the "n" flag in 'formatoptions'.
+ The pattern must match exactly the text that will be the indent for
+ the line below it. You can use |\ze| to mark the end of the match
+ while still checking more characters. There must be a character
+ following the pattern, when it matches the whole line it is handled
+ like there is no match.
+ The default recognizes a number, followed by an optional punctuation
+ character and white space.
+
*'formatprg'* *'fp'*
'formatprg' 'fp' string (default "")
global
@@ -2795,7 +2809,9 @@ A jump table for the options with a short description can be found at |Q_op|.
When your "grep" accepts the "-H" argument, use this to make ":grep"
also work well with a single file: >
:set grepprg=grep\ -nH
-< See also the section |:make_makeprg|, since most of the comments there
+< Special value: When 'grepprg' is set to "internal" the ":grep" works
+ like ":vimgrep".
+ See also the section |:make_makeprg|, since most of the comments there
apply equally to 'grepprg'.
For Win32, the default is "findstr /n" if "findstr.exe" can be found,
otherwise it's "grep -n".
diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt
index 4f8174b073..23a7146616 100644
--- a/runtime/doc/quickfix.txt
+++ b/runtime/doc/quickfix.txt
@@ -1,4 +1,4 @@
-*quickfix.txt* For Vim version 7.0aa. Last change: 2004 Jun 16
+*quickfix.txt* For Vim version 7.0aa. Last change: 2004 Dec 27
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -105,6 +105,14 @@ The following quickfix commands can be used:
Read the error file. Just like ":cfile" but don't
jump to the first error.
+ *:cb* *:cbuffer* *E681*
+:cb[uffer] [bufnr] Read the error list from the current buffer.
+ When [bufnr] is given it must be the number of a
+ loaded buffer. That buffer will then be used instead
+ of the current buffer.
+ A range can be specified for the lines to be used.
+ Otherwise all lines in the buffer are used.
+
*:cl* *:clist*
:cl[ist] [from] [, [to]]
List all errors that are valid |quickfix-valid|.
@@ -266,7 +274,37 @@ If 'shellpipe' is empty, the {errorfile} part will be omitted. This is useful
for compilers that write to an errorfile themselves (e.g., Manx's Amiga C).
==============================================================================
-5. Using :grep *grep* *lid*
+5. Using :vimgrep and :grep *grep* *lid*
+
+Vim has two ways to find matches for a pattern: Internal and external. The
+advantage of the internal grep is that it works on all systems and uses the
+powerful Vim search patterns. An external grep program can be used when the
+Vim grep does not do what you want.
+
+The internal method may be a bit slower, because files are read into memory.
+The advantage is that line separators and encoding are automatically
+recognized, as if a file is being edited. And multi-line patterns can be
+used.
+
+
+5.1 using Vim's internal grep
+
+ *:vim* *:vimgrep*
+:vim[grep][!] /{pattern}/ {file} ...
+ Search for {pattern} in the files {file} ... and set
+ the error list to the matches.
+ {pattern} if a Vim search pattern. Instead of
+ enclosing it in / any character can be used, so long
+ as it does not appear in {pattern}.
+
+ *:vimgrepa* *:vimgrepadd*
+:vimgrepa[dd][!] /{pattern}/ {file} ...
+ Just like ":vimgrep", but instead of making a new list
+ of errors the matches are appended to the current
+ list.
+
+
+5.2 External grep
Vim can interface with "grep" and grep-like programs (such as the GNU
id-utils) in a similar way to its compiler integration (see |:make| above).
@@ -277,6 +315,9 @@ id-utils) in a similar way to its compiler integration (see |:make| above).
*:gr* *:grep*
:gr[ep][!] [arguments] Just like ":make", but use 'grepprg' instead of
'makeprg' and 'grepformat' instead of 'errorformat'.
+ When 'grepprg' is "internal" this works like
+ |:vimgrep|. Note that the pattern needs to be
+ enclosed in separator characters then.
*:grepa* *:grepadd*
:grepa[dd][!] [arguments]
Just like ":grep", but instead of making a new list of
@@ -290,7 +331,7 @@ id-utils) in a similar way to its compiler integration (see |:make| above).
":grepadd" jumps to the first error, which is not
allowed with |:bufdo|.
-5.1 Setting up grep
+5.3 Setting up external grep
If you have a standard "grep" program installed, the :grep command may work
well with the defaults. The syntax is very similar to the standard command: >
@@ -322,7 +363,7 @@ error in |quickfix| mode. You can then use the |:cnext|, |:clist|, etc.
commands to see the other matches.
-5.2 Using :grep with id-utils
+5.4 Using :grep with id-utils
You can set up :grep to work with the GNU id-utils like this: >
@@ -336,31 +377,31 @@ works just as you'd expect.
(provided you remembered to mkid first :)
-5.3 Browsing source code with :grep
+5.5 Browsing source code with :vimgrep or :grep
Using the stack of error lists that Vim keeps, you can browse your files to
look for functions and the functions they call. For example, suppose that you
have to add an argument to the read_file() function. You enter this command: >
- :grep read_file *.c
+ :vimgrep /\<read_file\>/ *.c
You use ":cn" to go along the list of matches and add the argument. At one
place you have to get the new argument from a higher level function msg(), and
need to change that one too. Thus you use: >
- :grep msg *.c
+ :vimgrep /\<msg\>/ *.c
While changing the msg() functions, you find another function that needs to
-get the argument from a higher level. You can again use ":grep" to find these
-functions. Once you are finished with one function, you can use >
+get the argument from a higher level. You can again use ":vimgrep" to find
+these functions. Once you are finished with one function, you can use >
:colder
to go back to the previous one.
-This works like browsing a tree: ":grep" goes one level deeper, creating a
+This works like browsing a tree: ":vimgrep" goes one level deeper, creating a
list of branches. ":colder" goes back to the previous level. You can mix
-this use of ":grep" and "colder" to browse all the locations in a tree-like
+this use of ":vimgrep" and "colder" to browse all the locations in a tree-like
way. If you do this consistently, you will find all locations without the
need to write down a "todo" list.
diff --git a/runtime/doc/tags b/runtime/doc/tags
index ee4d28febe..51755a18ba 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -210,6 +210,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
'fkmap' options.txt /*'fkmap'*
'fl' vi_diff.txt /*'fl'*
'flash' vi_diff.txt /*'flash'*
+'flp' options.txt /*'flp'*
'fml' options.txt /*'fml'*
'fmr' options.txt /*'fmr'*
'fo' options.txt /*'fo'*
@@ -226,6 +227,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
'foldnestmax' options.txt /*'foldnestmax'*
'foldopen' options.txt /*'foldopen'*
'foldtext' options.txt /*'foldtext'*
+'formatlistpat' options.txt /*'formatlistpat'*
'formatoptions' options.txt /*'formatoptions'*
'formatprg' options.txt /*'formatprg'*
'fp' options.txt /*'fp'*
@@ -1723,6 +1725,8 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
:call eval.txt /*:call*
:cat eval.txt /*:cat*
:catch eval.txt /*:catch*
+:cb quickfix.txt /*:cb*
+:cbuffer quickfix.txt /*:cbuffer*
:cc quickfix.txt /*:cc*
:ccl quickfix.txt /*:ccl*
:cclose quickfix.txt /*:cclose*
@@ -3559,6 +3563,7 @@ E678 pattern.txt /*E678*
E679 syntax.txt /*E679*
E68 pattern.txt /*E68*
E680 autocmd.txt /*E680*
+E681 quickfix.txt /*E681*
E69 pattern.txt /*E69*
E70 pattern.txt /*E70*
E71 pattern.txt /*E71*
diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index 426bef60b9..7abbd5bdcd 100644
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1,4 +1,4 @@
-*todo.txt* For Vim version 7.0aa. Last change: 2004 Dec 24
+*todo.txt* For Vim version 7.0aa. Last change: 2004 Dec 27
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -30,6 +30,16 @@ be worked on, but only if you sponsor Vim development. See |sponsor|.
*known-bugs*
-------------------- Known bugs and current work -----------------------
+Python 2.4 breaks uploading with rsync, 2.3 is OK.
+
+- Use a builtin grep command for ":grep"? Makes it possible to add the
+ column number.
+ Patch from Yegappan Lakshmanan, Nov 4.
+Don't expand wildcards in pattern (first arg)
+completion for all files after first arg.
+Use a buffer to load the file, so that gzip files can be searched and long
+lines work.
+
Patch for mch_FullName() also in Vim 6.3? os_mswin.c
Win32: "gvim -V100" should use dialog with scrollbar. Using
@@ -50,25 +60,6 @@ Included NetBeans patches (Gordon Prieur, Oct 20)
PLANNED FOR VERSION 7.0:
-- Include many PATCHES:
- - VimResized - When the Vim window has been resized (SIGWINCH)
- patch from Yakov Lerner, 2003 July 24.
- - Patch for specifying an expression for numbered lists. (Hugo Haas,
- 2004 Aug 7)
- - Add the ":cbuffer" command: read list of errors from a buffer instead
- of from a file. (Yegappan Lakshmanan, Oct 31, but avoid the temp file)
- Perhaps ":cexpr" could read from a list?
- Add %b to 'errorformat': buffer number. (Yegappan Lakshmanan / Suresh
- Govindachar)
-- Use a builtin grep command for ":grep"? Makes it possible to add the
- column number. Can use the code of ":helpgrep".
- Patch from Yegappan Lakshmanan, Nov 4. Or use ":grep" and set 'grepprg'
- to something special? Could also do both.
- Also support using "**" in filename, so that a directory tree can be
- searched.
- Also see the "minigrep.vim" script on www.vim.org.
-
-
- Drop the kvim support? There is no maintenance and "yzis" is supposed to
replace it.
- In the kvim/KDE source files fix the formatting.
@@ -77,8 +68,6 @@ PLANNED FOR VERSION 7.0:
- KDE GUI Input method patch. (Yasuhiro Matsumoto) (upd. Oct 25 2004)
After including patches:
-- Change ga_room into ga_maxlen, so that it doesn't need to be
- incremented/decremented each time.
- For string variables, use length instead of NUL termination?
+ can include NUL characters
- setline() will have problems with NL vs NUL.
@@ -105,6 +94,8 @@ After including patches:
- Improve the interface between the generic GUI code and the system-specific
code. Generic code handles text window with scrollbars, system-specific
code menu, toolbar, etc.
+- Support using "**" in filename for ":next", ":vimgrep", etc., so that a
+ directory tree can be searched.
- Store messages to allow SCROLLING BACK for all commands. And other "less"
like commands.
- "INTELLISENSE". First cleanup the Insert-mode completion.
@@ -180,6 +171,11 @@ After including patches:
"foldcolumn". (Benji Fisher, 2004 Jun 21)
- FileChangedShellPost autocommand event: after (not) reloading a changed
file. Can be used to update statusline oslt.
+- VimResized autocmd event: When the Vim window has been resized (SIGWINCH)
+ patch from Yakov Lerner, 2003 July 24.
+ It's not clear that this doesn't cause problems when the executed
+ commands do something like changing 'lines'. Esp. because the
+ screen has not yet been allocated with the new size.
- Running a shell command from the GUI still has limitations. Look into how
the Vim shell project can help: http://vimshell.wana.at
8 When a file is change outside of Vim and unmodified in Vim there is no
@@ -3067,6 +3063,9 @@ Debug mode:
Various improvements:
8 Add ":rename" command: rename the file of the current buffer and rename
the buffer. Buffer may be modified.
+- Perhaps ":cexpr" could read errors from a list?
+ Add %b to 'errorformat': buffer number. (Yegappan Lakshmanan / Suresh
+ Govindachar)
6 In the quickfix window statusline add the command used to get the list of
errors, e.g. ":make foo", ":grep something *.c".
7 Add a ":cstring" command. Works like ":cfile" but reads from a string
diff --git a/runtime/doc/version7.txt b/runtime/doc/version7.txt
index 41706e9abf..39d0946575 100644
--- a/runtime/doc/version7.txt
+++ b/runtime/doc/version7.txt
@@ -158,6 +158,9 @@ Options: ~
'wildoptions' "tagfile" value enables listing the file name of
matching tags for CTRL-D command line completion.
(based on an idea from Yegappan Lakshmanan)
+'formatlistpat' pattern to recognize a numbered list for formatting.
+ (idea by Hugo Haas)
+
Ex commands: ~
@@ -180,6 +183,8 @@ Win32: The ":winpos" command now also works in the console. (Vipin Aravind)
|:viusage| Help for Vi commands (Nvi command).
+|:cbuffer| Read error lines from a buffer. (partly by Yegappan
+ Lakshmanan)
New functions: ~
@@ -354,6 +359,9 @@ in a Vim server to "utf-8", and using "vim --remote fname" in a console,
"fname" is converted from the console encoding to utf-8. Also allows Vims
with different 'encoding' settings to exchange messages.
+Internal: Changed ga_room into ga_maxlen, so that it doesn't need to be
+incremented/decremented each time.
+
==============================================================================
COMPILE TIME CHANGES *compile-changes-7*
@@ -582,4 +590,7 @@ message for the next buffer. Temporarily clear 'shortmess' to avoid that.
Win32: Cannot edit a file starting with # with --remote. Do escape % and #
when building the ":drop" command.
+A comment or | just after a expresion-backtick argument was not recognized.
+E.g. in :e `="foo"`"comment.
+
vim:tw=78:ts=8:ft=help:norl:
diff --git a/runtime/optwin.vim b/runtime/optwin.vim
index c16f5fafc7..adf9fdf8ac 100644
--- a/runtime/optwin.vim
+++ b/runtime/optwin.vim
@@ -1,7 +1,7 @@
" These commands create the option window.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2004 Dec 20
+" Last Change: 2004 Dec 24
" If there already is an option window, jump to that one.
if bufwinnr("option-window") > 0
@@ -667,6 +667,9 @@ call <SID>OptionL("com")
call append("$", "formatoptions\tlist of flags that tell how automatic formatting works")
call append("$", "\t(local to buffer)")
call <SID>OptionL("fo")
+call append("$", "formatlistpat\tpattern to recognize a numbered list")
+call append("$", "\t(local to buffer)")
+call <SID>OptionL("flp")
if has("insert_expand")
call append("$", "complete\tspecifies how Insert mode completion works")
call append("$", "\t(local to buffer)")
diff --git a/src/buffer.c b/src/buffer.c
index 4003b9c986..1ed7a0055f 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1699,6 +1699,7 @@ free_buf_options(buf, free_p_ff)
clear_string_option(&buf->b_p_kp);
clear_string_option(&buf->b_p_mps);
clear_string_option(&buf->b_p_fo);
+ clear_string_option(&buf->b_p_flp);
clear_string_option(&buf->b_p_isk);
#ifdef FEAT_KEYMAP
clear_string_option(&buf->b_p_keymap);
@@ -2541,6 +2542,28 @@ setfname(buf, ffname, sfname, message)
}
/*
+ * Crude way of changing the name of a buffer. Use with care!
+ * The name should be relative to the current directory.
+ */
+ void
+buf_set_name(fnum, name)
+ int fnum;
+ char_u *name;
+{
+ buf_T *buf;
+
+ buf = buflist_findnr(fnum);
+ if (buf != NULL)
+ {
+ vim_free(buf->b_sfname);
+ vim_free(buf->b_ffname);
+ buf->b_sfname = vim_strsave(name);
+ buf->b_ffname = FullName_save(buf->b_sfname, FALSE);
+ buf->b_fname = buf->b_sfname;
+ }
+}
+
+/*
* Take care of what needs to be done when the name of buffer "buf" has
* changed.
*/
diff --git a/src/charset.c b/src/charset.c
index 4560a96d1e..0a46306fc2 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -415,7 +415,6 @@ str_foldcase(str, len)
mch_memmove(ga.ga_data, str, (size_t)len);
GA_CHAR(len) = NUL;
ga.ga_len = len;
- ga.ga_room -= len;
/* Make each character lower case. */
i = 0;
@@ -451,7 +450,6 @@ str_foldcase(str, len)
mch_memmove(GA_PTR(i) + nl, GA_PTR(i) + ol,
STRLEN(GA_PTR(i) + ol) + 1);
ga.ga_len += nl - ol;
- ga.ga_room -= nl - ol;
}
}
(void)utf_char2bytes(lc, GA_PTR(i));
diff --git a/src/digraph.c b/src/digraph.c
index 4c15d498c8..31d7f3788f 100644
--- a/src/digraph.c
+++ b/src/digraph.c
@@ -2230,7 +2230,6 @@ putdigraph(str)
dp->char2 = char2;
dp->result = n;
++user_digraphs.ga_len;
- --user_digraphs.ga_room;
}
}
}
@@ -2450,10 +2449,7 @@ ex_loadkeymap(eap)
vim_free(kp->to);
}
else
- {
++curbuf->b_kmap_ga.ga_len;
- --curbuf->b_kmap_ga.ga_room;
- }
}
vim_free(line);
}
diff --git a/src/edit.c b/src/edit.c
index a2ceb50f7b..15812c7ff4 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -2707,7 +2707,6 @@ expand_by_function(lnum, col, base, matches)
break;
((char_u **)ga.ga_data)[ga.ga_len] = vim_strnsave(p, len);
++ga.ga_len;
- --ga.ga_room;
}
if (*pnext != NUL)
++pnext;
diff --git a/src/eval.c b/src/eval.c
index e06fd167d6..dcd86e519a 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -5972,7 +5972,6 @@ f_inputrestore(argvars, retvar)
if (ga_userinput.ga_len > 0)
{
--ga_userinput.ga_len;
- ++ga_userinput.ga_room;
restore_typeahead((tasave_T *)(ga_userinput.ga_data)
+ ga_userinput.ga_len);
retvar->var_val.var_number = 0; /* OK */
@@ -5999,7 +5998,6 @@ f_inputsave(argvars, retvar)
save_typeahead((tasave_T *)(ga_userinput.ga_data)
+ ga_userinput.ga_len);
++ga_userinput.ga_len;
- --ga_userinput.ga_room;
retvar->var_val.var_number = 0; /* OK */
}
else
@@ -8092,7 +8090,6 @@ error:
ga_grow(&ga, cplen);
mch_memmove((char *)ga.ga_data + ga.ga_len, cpstr, (size_t)cplen);
ga.ga_len += cplen;
- ga.ga_room -= cplen;
instr += inlen;
}
@@ -9109,7 +9106,6 @@ new_script_vars(id)
{
var_init(&SCRIPT_VARS(ga_scripts.ga_len + 1));
++ga_scripts.ga_len;
- --ga_scripts.ga_room;
}
}
}
@@ -9269,10 +9265,7 @@ set_var(name, varp)
if ((v->var_name = vim_strsave(varname)) == NULL)
return;
if (i == gap->ga_len)
- {
++gap->ga_len;
- --gap->ga_room;
- }
}
copy_var(varp, v);
}
@@ -9441,12 +9434,8 @@ ex_execute(eap)
break;
}
if (ga.ga_len)
- {
((char_u *)(ga.ga_data))[ga.ga_len++] = ' ';
- --ga.ga_room;
- }
STRCPY((char_u *)(ga.ga_data) + ga.ga_len, p);
- ga.ga_room -= len;
ga.ga_len += len;
}
@@ -9675,7 +9664,6 @@ ex_function(eap)
((char_u **)(newargs.ga_data))[newargs.ga_len] = arg;
*p = c;
newargs.ga_len++;
- newargs.ga_room--;
if (*p == ',')
++p;
else
@@ -9829,7 +9817,6 @@ ex_function(eap)
goto erret;
((char_u **)(newlines.ga_data))[newlines.ga_len] = theline;
newlines.ga_len++;
- newlines.ga_room--;
}
/* Don't define the function when skipping commands or when an error was
@@ -11398,7 +11385,6 @@ do_string_sub(str, pat, sub, flags)
(void)vim_regsub(&regmatch, sub, (char_u *)ga.ga_data
+ ga.ga_len + i, TRUE, TRUE, FALSE);
ga.ga_len += i + sublen - 1;
- ga.ga_room -= i + sublen - 1;
/* avoid getting stuck on a match with an empty string */
if (tail == regmatch.endp[0])
{
@@ -11406,7 +11392,6 @@ do_string_sub(str, pat, sub, flags)
break;
*((char_u *)ga.ga_data + ga.ga_len) = *tail++;
++ga.ga_len;
- --ga.ga_room;
}
else
{
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 7a176e066f..adac95b836 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -5315,7 +5315,6 @@ ex_helptags(eap)
break;
((char_u *)ga.ga_data)[ga.ga_len++] = lang[0];
((char_u *)ga.ga_data)[ga.ga_len++] = lang[1];
- ga.ga_room -= 2;
}
}
}
@@ -5425,7 +5424,6 @@ helptags_one(dir, ext, tagfname)
sprintf((char *)s, "help-tags\t%s\t1\n", tagfname);
((char_u **)ga.ga_data)[ga.ga_len] = s;
++ga.ga_len;
- --ga.ga_room;
}
}
}
@@ -5516,7 +5514,6 @@ helptags_one(dir, ext, tagfname)
}
((char_u **)ga.ga_data)[ga.ga_len] = s;
++ga.ga_len;
- --ga.ga_room;
sprintf((char *)s, "%s\t%s", p1, fname);
/* find next '*' */
diff --git a/src/ex_cmds.h b/src/ex_cmds.h
index f59d0182e4..b44dd1de2b 100644
--- a/src/ex_cmds.h
+++ b/src/ex_cmds.h
@@ -190,6 +190,8 @@ EX(CMD_call, "call", ex_call,
RANGE|NEEDARG|EXTRA|NOTRLCOM|SBOXOK|CMDWIN),
EX(CMD_catch, "catch", ex_catch,
EXTRA|SBOXOK|CMDWIN),
+EX(CMD_cbuffer, "cbuffer", ex_cbuffer,
+ RANGE|NOTADR|WORD1|TRLBAR),
EX(CMD_cc, "cc", ex_cc,
RANGE|NOTADR|COUNT|TRLBAR|BANG),
EX(CMD_cclose, "cclose", ex_cclose,
@@ -838,6 +840,10 @@ EX(CMD_visual, "visual", ex_edit,
BANG|FILE1|EDITCMD|ARGOPT|TRLBAR),
EX(CMD_view, "view", ex_edit,
BANG|FILE1|EDITCMD|ARGOPT|TRLBAR),
+EX(CMD_vimgrep, "vimgrep", ex_vimgrep,
+ EXTRA|TRLBAR|NEEDARG),
+EX(CMD_vimgrepadd, "vimgrepadd", ex_vimgrep,
+ EXTRA|TRLBAR|NEEDARG),
EX(CMD_viusage, "viusage", ex_viusage,
TRLBAR),
EX(CMD_vmap, "vmap", ex_map,
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 715bf99eb4..a1831332af 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -491,7 +491,6 @@ ex_breakadd(eap)
if (bp->dbg_lnum == 0) /* default line number is 1 */
bp->dbg_lnum = 1;
BREAKP(dbg_breakp.ga_len++).dbg_nr = ++last_breakp;
- --dbg_breakp.ga_room;
++debug_tick;
}
}
@@ -564,7 +563,6 @@ ex_breakdel(eap)
vim_free(BREAKP(todel).dbg_name);
vim_free(BREAKP(todel).dbg_prog);
--dbg_breakp.ga_len;
- ++dbg_breakp.ga_room;
if (todel < dbg_breakp.ga_len)
mch_memmove(&BREAKP(todel), &BREAKP(todel + 1),
(dbg_breakp.ga_len - todel) * sizeof(struct debuggy));
@@ -1063,6 +1061,31 @@ do_one_arg(str)
return str;
}
+/*
+ * Separate the arguments in "str" and return a list of pointers in the
+ * growarray "gap".
+ */
+ int
+get_arglist(gap, str)
+ garray_T *gap;
+ char_u *str;
+{
+ ga_init2(gap, (int)sizeof(char_u *), 20);
+ while (*str != NUL)
+ {
+ if (ga_grow(gap, 1) == FAIL)
+ {
+ ga_clear(gap);
+ return FAIL;
+ }
+ ((char_u **)gap->ga_data)[gap->ga_len++] = str;
+
+ /* Isolate one argument, change it in-place, put a NUL after it. */
+ str = do_one_arg(str);
+ }
+ return OK;
+}
+
#if defined(FEAT_GUI) || defined(FEAT_CLIENTSERVER) || defined(PROTO)
/*
* Redefine the argument list.
@@ -1101,20 +1124,8 @@ do_arglist(str, what, after)
/*
* Collect all file name arguments in "new_ga".
*/