Compare commits

...

24 Commits

Author SHA1 Message Date
Bram Moolenaar
93fc481b57 updated for version 7.4.261
Problem:    When updating the window involves a regexp pattern, an interactive
            substitute to replace a "\n" with a line break fails. (Ingo
            Karkat)
Solution:   Set reg_line_lbr in vim_regsub() and vim_regsub_multi().
2014-04-23 18:48:47 +02:00
Bram Moolenaar
9bdfb0025c updated for version 7.4.260
Problem:    It is possible to define a function with a colon in the name.  It
            is possible to define a function with a lower case character if a
            "#" appears after the name.
Solution:   Disallow using a colon other than with "s:".  Ignore "#" after the
            name.
2014-04-23 17:43:42 +02:00
Bram Moolenaar
62f167f716 updated for version 7.4.259
Problem:    Warning for misplaced "const".
Solution:   Move the "const". (Yukihiro Nakadaira)
2014-04-23 12:52:40 +02:00
Bram Moolenaar
c8836f7025 updated for version 7.4.258
Problem:    Configure fails if $CC contains options.
Solution:   Remove quotes around $CC. (Paul Barker)
2014-04-12 13:12:24 +02:00
Bram Moolenaar
0eac828ab0 updated for version 7.4.257
Problem:    Compiler warning, possibly for mismatch in parameter name.
Solution:   Rename the parameter in the declaration.
2014-04-12 12:26:36 +02:00
Bram Moolenaar
b21a29be56 updated for version 7.4.256
Problem:    Using systemlist() may cause a crash and does not handle NUL
            characters properly.
Solution:   Increase the reference count, allocate memory by length. (Yasuhiro
            Matsumoto)
2014-04-11 10:22:53 +02:00
Bram Moolenaar
e29b1feead updated for version 7.4.255
Problem:    Configure check for smack doesn't work with all shells. (David
            Larson)
Solution:   Remove spaces in set command.
2014-04-10 20:00:15 +02:00
Bram Moolenaar
c09551ab79 updated for version 7.4.254
Problem:    Smack support detection is incomplete.
Solution:   Check for attr/xattr.h and specific macro.
2014-04-10 11:09:17 +02:00
Bram Moolenaar
5a4e160ce4 updated for version 7.4.253
Problem:    Crash when using cpp syntax file with pattern using external
            match. (Havard Garnes)
Solution:   Discard match when end column is before start column.
2014-04-06 21:34:04 +02:00
Bram Moolenaar
7bcdb7d166 updated for version 7.4.252
Problem:    Critical error in GTK, removing timer twice.
Solution:   Clear the timer after removing it. (James McCoy)
2014-04-06 21:08:45 +02:00
Bram Moolenaar
4c7ab1bb57 updated for version 7.4.251
Problem:    Crash when BufAdd autocommand wipes out the buffer.
Solution:   Check for buffer to still be valid. Postpone freeing the buffer
            structure. (Hirohito Higashi)
2014-04-06 20:45:43 +02:00
Bram Moolenaar
75b8156a44 Updated runtime files. 2014-04-06 14:09:13 +02:00
Bram Moolenaar
7e38ea2fb6 Updated runtime files. 2014-04-05 22:55:53 +02:00
Bram Moolenaar
e9a54227f9 updated for version 7.4.250
Problem:    Some test files missing from distribution.
Solution:   Add pattern for newly added tests.
2014-04-05 21:59:39 +02:00
Bram Moolenaar
7d647820ed updated for version 7.4.249
Problem:    Using setreg() with a list of numbers does not work.
Solution:   Use a separate buffer for numbers. (ZyX)
2014-04-05 21:28:56 +02:00
Bram Moolenaar
39c29ed511 updated for version 7.4.248
Problem:    Cannot distinguish between NL and NUL in output of system().
Solution:   Add systemlist(). (ZyX)
2014-04-05 19:44:40 +02:00
Bram Moolenaar
57ebe6e2f9 updated for version 7.4.247
Problem:    When passing input to system() there is no way to keep NUL and
            NL characters separate.
Solution:   Optionally use a list for the system() input. (ZyX)
2014-04-05 18:55:46 +02:00
Bram Moolenaar
4ed89cdf41 updated for version 7.4.246
Problem:    Configure message for detecting smack are out of sequence.
Solution:   Put the messages in the right place. (Kazunobu Kuriyama)
2014-04-05 12:02:25 +02:00
Bram Moolenaar
21e854e5ce updated for version 7.4.245
Problem:    Crash for "vim -u NONE -N  -c '&&'".
Solution:   Check for the pattern to be NULL. (Dominique Pelle)
2014-04-04 19:00:48 +02:00
Bram Moolenaar
57a728d1df updated for version 7.4.244
Problem:    The smack feature causes stray error messages.
Solution:   Remove the error messages.
2014-04-02 23:09:26 +02:00
Bram Moolenaar
5a50c2255c updated for version 7.4.243
Problem:    Cannot use setreg() to add text that includes a NUL.
Solution:   Make setreg() accept a list.
2014-04-02 22:17:10 +02:00
Bram Moolenaar
b7cb42bc38 updated for version 7.4.242
Problem:    getreg() does not distinguish between a NL used for a line break
            and a NL used for a NUL character.
Solution:   Add another argument to return a list. (ZyX)
2014-04-02 19:55:10 +02:00
Bram Moolenaar
41571769c9 updated for version 7.4.241
Problem:    The string returned by submatch() does not distinguish between a
            NL from a line break and a NL that stands for a NUL character.
Solution:   Add a second argument to return a list. (ZyX)
2014-04-02 19:00:58 +02:00
Bram Moolenaar
fe5aab63fe updated for version 7.4.240
Problem:    ":tjump" shows "\n" as "\\n".
Solution:   Skip over "\" that escapes a backslash. (Gary Johnson)
2014-04-02 17:19:04 +02:00
45 changed files with 1302 additions and 335 deletions

View File

@@ -82,9 +82,12 @@ SRC_ALL = \
src/testdir/*.in \
src/testdir/sautest/autoload/*.vim \
src/testdir/test[0-9]*.ok \
src/testdir/test[0-9]*a.ok \
src/testdir/test_[a-z]*.ok \
src/testdir/test49.vim \
src/testdir/test60.vim \
src/testdir/test83-tags? \
src/testdir/test77a.com \
src/testdir/python2/*.py \
src/testdir/python3/*.py \
src/testdir/pythonx/*.py \

View File

@@ -1,4 +1,4 @@
*eval.txt* For Vim version 7.4. Last change: 2014 Mar 27
*eval.txt* For Vim version 7.4. Last change: 2014 Apr 06
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -148,7 +148,7 @@ arguments: >
1.3 Lists ~
*List* *Lists* *E686*
*list* *List* *Lists* *E686*
A List is an ordered sequence of items. An item can be of any type. Items
can be accessed by their index number. Items can be added and removed at any
position in the sequence.
@@ -394,7 +394,7 @@ example, to add up all the numbers in a list: >
1.4 Dictionaries ~
*Dictionaries* *Dictionary*
*dict* *Dictionaries* *Dictionary*
A Dictionary is an associative array: Each entry has a key and a value. The
entry can be located with the key. The entries are stored without a specific
ordering.
@@ -1005,7 +1005,7 @@ function. Example: >
string *expr-string* *E114*
string *string* *expr-string* *E114*
------
"string" string constant *expr-quote*
@@ -1144,7 +1144,7 @@ specified by what is prepended:
|local-variable| l: Local to a function.
|script-variable| s: Local to a |:source|'ed Vim script.
|function-argument| a: Function argument (only inside a function).
|vim-variable| v: Global, predefined by Vim.
|vim-variable| v: Global, predefined by Vim.
The scope name by itself can be used as a |Dictionary|. For example, to
delete all script-local variables: >
@@ -1819,7 +1819,8 @@ getmatches() List list of current matches
getpid() Number process ID of Vim
getpos( {expr}) List position of cursor, mark, etc.
getqflist() List list of quickfix items
getreg( [{regname} [, 1]]) String contents of register
getreg( [{regname} [, 1 [, {list}]]])
String or List contents of register
getregtype( [{regname}]) String type of register
gettabvar( {nr}, {varname} [, {def}])
any variable {varname} in tab {nr} or {def}
@@ -1990,7 +1991,8 @@ strridx( {haystack}, {needle} [, {start}])
Number last index of {needle} in {haystack}
strtrans( {expr}) String translate string to make it printable
strwidth( {expr}) Number display cell length of the String {expr}
submatch( {nr}) String specific match in ":s" or substitute()
submatch( {nr}[, {list}]) String or List
specific match in ":s" or substitute()
substitute( {expr}, {pat}, {sub}, {flags})
String all {pat} in {expr} replaced with {sub}
synID( {lnum}, {col}, {trans}) Number syntax ID at {lnum} and {col}
@@ -2000,6 +2002,7 @@ synIDtrans( {synID}) Number translated syntax ID of {synID}
synconcealed( {lnum}, {col}) List info about concealing
synstack( {lnum}, {col}) List stack of syntax IDs at {lnum} and {col}
system( {expr} [, {input}]) String output of shell command/filter {expr}
systemlist( {expr} [, {input}]) List output of shell command/filter {expr}
tabpagebuflist( [{arg}]) List list of buffer numbers in tab page
tabpagenr( [{arg}]) Number number of current or last tab page
tabpagewinnr( {tabarg}[, {arg}])
@@ -2717,7 +2720,7 @@ exepath({expr}) *exepath()*
Note that the current directory is used when {expr} starts
with "./", which may be a problem for Vim: >
echo exepath(v:progpath)
< If {expr} cannot be found in $PATH or is not executable then
< If {expr} cannot be found in $PATH or is not executable then
an empty string is returned.
*exists()*
@@ -3466,7 +3469,7 @@ getqflist() *getqflist()*
:endfor
getreg([{regname} [, 1]]) *getreg()*
getreg([{regname} [, 1 [, {list}]]]) *getreg()*
The result is a String, which is the contents of register
{regname}. Example: >
:let cliptext = getreg('*')
@@ -3475,6 +3478,11 @@ getreg([{regname} [, 1]]) *getreg()*
getreg('=', 1) returns the expression itself, so that it can
be restored with |setreg()|. For other registers the extra
argument is ignored, thus you can always give it.
If {list} is present and non-zero result type is changed to
|List|. Each list item is one text line. Use it if you care
about zero bytes possibly present inside register: without
third argument both NLs and zero bytes are represented as NLs
(see |NL-used-for-Nul|).
If {regname} is not specified, |v:register| is used.
@@ -5361,6 +5369,8 @@ setqflist({list} [, {action}]) *setqflist()*
*setreg()*
setreg({regname}, {value} [,{options}])
Set the register {regname} to {value}.
{value} may be any value returned by |getreg()|, including
a |List|.
If {options} contains "a" or {regname} is upper case,
then the value is appended.
{options} can also contain a register type specification:
@@ -5373,10 +5383,15 @@ setreg({regname}, {value} [,{options}])
in the longest line (counting a <Tab> as 1 character).
If {options} contains no register settings, then the default
is to use character mode unless {value} ends in a <NL>.
Setting the '=' register is not possible, but you can use >
:let @= = var_expr
< Returns zero for success, non-zero for failure.
is to use character mode unless {value} ends in a <NL> for
string {value} and linewise mode for list {value}. Blockwise
mode is never selected automatically.
Returns zero for success, non-zero for failure.
*E883*
Note: you may not use |List| containing more then one item to
set search and expression registers. Lists containing no
items act like empty strings.
Examples: >
:call setreg(v:register, @*)
@@ -5384,8 +5399,11 @@ setreg({regname}, {value} [,{options}])
:call setreg('a', "1\n2\n3", 'b5')
< This example shows using the functions to save and restore a
register. >
:let var_a = getreg('a', 1)
register (note: you may not reliably restore register value
without using the third argument to |getreg()| as without it
newlines are represented as newlines AND Nul bytes are
represented as newlines as well, see |NL-used-for-Nul|). >
:let var_a = getreg('a', 1, 1)
:let var_amode = getregtype('a')
....
:call setreg('a', var_a, var_amode)
@@ -5797,12 +5815,23 @@ strwidth({expr}) *strwidth()*
Ambiguous, this function's return value depends on 'ambiwidth'.
Also see |strlen()|, |strdisplaywidth()| and |strchars()|.
submatch({nr}) *submatch()*
submatch({nr}[, {list}]) *submatch()*
Only for an expression in a |:substitute| command or
substitute() function.
Returns the {nr}'th submatch of the matched text. When {nr}
is 0 the whole matched text is returned.
Note that a NL in the string can stand for a line break of a
multi-line match or a NUL character in the text.
Also see |sub-replace-expression|.
If {list} is present and non-zero then submatch() returns
a list of strings, similar to |getline()| with two arguments.
NL characters in the text represent NUL characters in the
text.
Only returns more than one item for |:substitute|, inside
|substitute()| this list will always contain one or zero
items, since there are no real line breaks.
Example: >
:s/\d\+/\=submatch(0) + 1/
< This finds the first number in the line and adds one to it.
@@ -5935,11 +5964,19 @@ synstack({lnum}, {col}) *synstack()*
valid positions.
system({expr} [, {input}]) *system()* *E677*
Get the output of the shell command {expr}.
When {input} is given, this string is written to a file and
passed as stdin to the command. The string is written as-is,
you need to take care of using the correct line separators
yourself. Pipes are not used.
Get the output of the shell command {expr} as a string. See
|systemlist()| to get the output as a List.
When {input} is given and is a string this string is written
to a file and passed as stdin to the command. The string is
written as-is, you need to take care of using the correct line
separators yourself.
If {input} is given and is a |List| it is written to the file
in a way |writefile()| does with {binary} set to "b" (i.e.
with a newline between each list item with newlines inside
list items converted to NULs).
Pipes are not used.
Note: Use |shellescape()| or |::S| with |expand()| or
|fnamemodify()| to escape special characters in a command
argument. Newlines in {expr} may cause the command to fail.
@@ -5976,6 +6013,16 @@ system({expr} [, {input}]) *system()* *E677*
Use |:checktime| to force a check.
systemlist({expr} [, {input}]) *systemlist()*
Same as |system()|, but returns a |List| with lines (parts of
output separated by NL) with NULs transformed into NLs. Output
is the same as |readfile()| will output with {binary} argument
set to "b".
Returns an empty string on error, so be careful not to run
into |E706|.
tabpagebuflist([{arg}]) *tabpagebuflist()*
The result is a |List|, where each item is the number of the
buffer associated with each window in the current tab page.
@@ -6408,11 +6455,20 @@ There are three types of features:
Example: >
:if has("gui_running")
< *has-patch*
3. Included patches. First check |v:version| for the version of Vim.
Then the "patch123" feature means that patch 123 has been included for
this version. Example (checking version 6.2.148 or later): >
3. Included patches. The "patch123" feature means that patch 123 has been
included. Note that this form does not check the version of Vim, you need
to inspect |v:version| for that.
Example (checking version 6.2.148 or later): >
:if v:version > 602 || v:version == 602 && has("patch148")
< Note that it's possible for patch 147 to be omitted even though 148 is
< Note that it's possible for patch 147 to be omitted even though 148 is
included.
4. Beyond a certain version or at a certain version and including a specific
patch. The "patch-7.4.123" feature means that the Vim version is 7.5 or
later, or it is version 7.4 and patch 123 was included.
The example above can be simplified to: >
:if has("patch-6.2.148")
< Note that it's possible for patch 147 to be omitted even though 148 is
included.
acl Compiled with |ACL| support.
@@ -7355,6 +7411,8 @@ This does NOT work: >
{pattern}, so long as it does not have a special
meaning (e.g., '|' or '"') and doesn't occur inside
{pattern}.
Information about the exception is available in
|v:exception|. Also see |throw-variables|.
NOTE: It is not reliable to ":catch" the TEXT of
an error message because it may vary in different
locales.

View File

@@ -1,4 +1,4 @@
*recover.txt* For Vim version 7.4. Last change: 2014 Mar 25
*recover.txt* For Vim version 7.4. Last change: 2014 Mar 27
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -84,7 +84,7 @@ created anyway.
The 'swapfile' option can be reset to avoid creating a swapfile. And the
|:noswapfile| modifier can be used to not create a swapfile for a new buffer.
:noswap[file] {command} *:nos* *:noswapfile*
:nos[wapfile] {command} *:nos* *:noswapfile*
Execute {command}. If it contains a command that loads a new
buffer, it will be loaded without creating a swapfile and the
'swapfile' option will be reset. If a buffer already had a

View File

@@ -1,4 +1,4 @@
*starting.txt* For Vim version 7.4. Last change: 2013 Jul 20
*starting.txt* For Vim version 7.4. Last change: 2014 Mar 29
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1276,8 +1276,10 @@ triggered.
When [!] is included an existing file is overwritten.
When [file] is omitted or is a number from 1 to 9, a
name is generated and 'viewdir' prepended. When the
last directory name in 'viewdir' does not exist, this
directory is created.
last path part of 'viewdir' does not exist, this
directory is created. E.g., when 'viewdir' is
"$VIM/vimfiles/view" then "view" is created in
"$VIM/vimfiles".
An existing file is always overwritten then. Use
|:loadview| to load this view again.
When [file] is the name of a file ('viewdir' is not

View File

@@ -1,4 +1,4 @@
*syntax.txt* For Vim version 7.4. Last change: 2014 Feb 25
*syntax.txt* For Vim version 7.4. Last change: 2014 Apr 05
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1959,7 +1959,7 @@ If you don't want to set the variable, use the modeline in EVERY LPC file.
There are several implementations for LPC, we intend to support most widely
used ones. Here the default LPC syntax is for MudOS series, for MudOS v22
and before, you should turn off the sensible modifiers, and this will also
asserts the new efuns after v22 to be invalid, don't set this variable when
assert the new efuns after v22 to be invalid, don't set this variable when
you are using the latest version of MudOS: >
:let lpc_pre_v22 = 1

View File

@@ -4311,6 +4311,7 @@ E88 windows.txt /*E88*
E880 if_pyth.txt /*E880*
E881 autocmd.txt /*E881*
E882 eval.txt /*E882*
E883 eval.txt /*E883*
E89 message.txt /*E89*
E90 message.txt /*E90*
E91 options.txt /*E91*
@@ -5368,6 +5369,7 @@ diW motion.txt /*diW*
dialog gui_w32.txt /*dialog*
dialogs-added version5.txt /*dialogs-added*
dib motion.txt /*dib*
dict eval.txt /*dict*
dict-functions usr_41.txt /*dict-functions*
dict-identity eval.txt /*dict-identity*
dict-modification eval.txt /*dict-modification*
@@ -5512,6 +5514,7 @@ exclusive motion.txt /*exclusive*
exclusive-linewise motion.txt /*exclusive-linewise*
executable() eval.txt /*executable()*
execute-menus gui.txt /*execute-menus*
exepath() eval.txt /*exepath()*
exim starting.txt /*exim*
exists() eval.txt /*exists()*
exp() eval.txt /*exp()*
@@ -6696,6 +6699,7 @@ linewise-register change.txt /*linewise-register*
linewise-visual visual.txt /*linewise-visual*
lisp.vim syntax.txt /*lisp.vim*
lispindent() eval.txt /*lispindent()*
list eval.txt /*list*
list-functions usr_41.txt /*list-functions*
list-identity eval.txt /*list-identity*
list-index eval.txt /*list-index*
@@ -7413,6 +7417,7 @@ profile repeat.txt /*profile*
profiling repeat.txt /*profiling*
profiling-variable eval.txt /*profiling-variable*
progname-variable eval.txt /*progname-variable*
progpath-variable eval.txt /*progpath-variable*
progress.vim syntax.txt /*progress.vim*
pronounce intro.txt /*pronounce*
psql ft_sql.txt /*psql*
@@ -7913,6 +7918,7 @@ strcspn() eval.txt /*strcspn()*
strdisplaywidth() eval.txt /*strdisplaywidth()*
strftime() eval.txt /*strftime()*
stridx() eval.txt /*stridx()*
string eval.txt /*string*
string() eval.txt /*string()*
string-functions usr_41.txt /*string-functions*
string-match eval.txt /*string-match*
@@ -7977,6 +7983,7 @@ sysmouse term.txt /*sysmouse*
system() eval.txt /*system()*
system-functions usr_41.txt /*system-functions*
system-vimrc starting.txt /*system-vimrc*
systemlist() eval.txt /*systemlist()*
s~ change.txt /*s~*
t motion.txt /*t*
t: eval.txt /*t:*
@@ -8420,6 +8427,7 @@ v:operator eval.txt /*v:operator*
v:prevcount eval.txt /*v:prevcount*
v:profiling eval.txt /*v:profiling*
v:progname eval.txt /*v:progname*
v:progpath eval.txt /*v:progpath*
v:register eval.txt /*v:register*
v:scrollstart eval.txt /*v:scrollstart*
v:searchforward eval.txt /*v:searchforward*

View File

@@ -1,4 +1,4 @@
*todo.txt* For Vim version 7.4. Last change: 2014 Mar 27
*todo.txt* For Vim version 7.4. Last change: 2014 Apr 05
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -35,6 +35,8 @@ not be repeated below, unless there is extra information.
-------------------- Known bugs and current work -----------------------
Regexp problems:
- Crash when using cpp syntax file with raw string. (Havard Garnes)
Edit "~/tmp/test.cc" and source "~/tmp/cpp.vim".
- NFA regexp doesn't count tab matches correctly. (Urtica Dioica / gaultheria
Shallon, 2013 Nov 18)
- After patch 7.4.100 there is still a difference between NFA and old engine.
@@ -68,7 +70,17 @@ Problem using ":try" inside ":execute". (ZyX, 2013 Sep 15)
Python: ":py raw_input('prompt')" doesn't work. (Manu Hack)
Using autoconf 2.69 gives a lot of warnings.
Crash in setqflist(). (Benoit Mortgat, 2010 Nov 18)
MS-Windows: Crash opening very long file name starting with "\\".
(Christian Brock, 2012 Jun 29)
Crash in autocmd that unloads buffers in a BufUnload event. (Andrew Pimlott,
2012 Aug 11) Disallow :new when BufUnload is being handled?
Spell files use a latin single quote. Unicode also has another single quote.
Adjust spell file scripts to duplicate words to support both quotes.
(Ron Aaron, 2014 Apr 4)
Problem with 'spellsuggest' file, only works for some words.
(Cesar Romani, 2013 Aug 20) Depends on file name? (Aug 24)
@@ -81,27 +93,20 @@ Adding "~" to 'cdpath' doesn't work for completion? (Davido, 2013 Aug 19)
Syntax file for gnuplot. Existing one is very old. (Andrew Rasmussen, 2014
Feb 24)
Crash with ":%s/\n//g" on long file. (Aidan Marlin, 2014 Jan 15)
Christian Brabandt: patch to run this into a join. (2014 Jan 18)
Suggestion to not save replaced line for undo: Yukihiro Nakadaira, 2014 Jan
25.
Add digraph for Rouble: =P. What's the Unicode?
Bug: "!ls %" expands parenthesis in %, but not spaces. So this doesn't work
either: ':!ls "%"'.
Patch by Gary Johnson, 2014 Mar 6.
Issue 174: Detect Mason files.
No error for missing endwhile. (ZyX, 2014 Mar 20)
Patch to add v:progpath. (Viktor Kojouharov, 2014 Mar 15)
Phpcomplete.vim update. (Complex, 2014 Jan 15)
PHP syntax is extremely slow. (Anhad Jai Singh, 2014 Jan 19)
Win32: use different args for SearchPath()? (Yasuhiro Matsumoto, 2009 Jan 30)
Also fixes wrong result from executable().
Update from Ken Takata, 2014 Jan 10. Newer 2014 Apr 3.
Can we make ":unlet $VAR" use unsetenv() to delete the env var?
What for systems that don't have unsetenv()?
@@ -110,13 +115,9 @@ This does not give an error: (Andre Sihera, 2014 Mar 21)
This neither: (ZyX)
vim -u NONE 1 2 3 -c 'bufdo while 1 | echo 1'
spec ftplugin: patch from Igor Gnatenko, 2014 Jan 26.
Include if maintainers don't respond.
Patch to make has() check for Vim version and patch at the same time.
(Marc Weber, 2013 Jun 7)
Regression on pach 7.4.034. (Ingo Karkat, 2013 Nov 20)
'viewdir' default on MS-Windows is not a good choice, it's a system directory.
Change 'viewdir' to "$HOME/vimfiles/view" and use 'viewdiralt' to also read
from?
Include a plugin manager with Vim? Neobundle seems to be the best currently.
Long message about this from ZyX, 2014 Mar 23. And following replies.
@@ -152,17 +153,18 @@ Out of scope:
- Development work on plugins (although diff with distributed version would be
useful).
Patch to include smack support (Linux security library). (Jose Bollo, 2014 Jan
14) Update Jan 15.
Setting the spell file in a session only reads the local additions, not the
normal spell file. (Enno Nagel, 2014 Mar 29)
Tag list, as used for :tjump, does not unescape regexp. (Gary Johnson, 2014 Jan
6) With patch in another message.
Editing an ascii file as ucs-2 or ucs-4 causes display errors.
(ZyX, 2014 Mar 30)
":Next 1 some-arg" does not complain about trailing argument. Also for
various other commands. (ZyX, 2014 Mar 30)
VMS: Select() doesn't work properly, typing ESC may hang Vim. Use sys$qiow
instead. (Samuel Ferencik, 2013 Sep 28)
Series of patches for NL vs NUL handling. (ZyX, 2013 Nov 3, Nov 9)
Patch for XDG base directory support. (Jean François Bignolles, 2014 Mar 4)
Patch to add flag to shortmess to avoid giving completion messages.
@@ -258,10 +260,6 @@ GTK: problem with 'L' in 'guioptions' changing the window width.
Patch to add option that tells whether small deletes go into the numbered
registers. (Aryeh Leib Taurog, 2013 Nov 18)
Win32: use different args for SearchPath()? (Yasuhiro Matsumoto, 2009 Jan 30)
Also fixes wrong result from executable().
Update from Ken Takata, 2014 Jan 10.
Javascript file where indent gets stuck on: GalaxyMaster, 2012 May 3.
The BufUnload event is triggered when re-using the empty buffer.
@@ -362,9 +360,6 @@ In the ATTENTION message about an existing swap file, mention the name of the
process that is running. It might actually be some other program, e.g. after
a reboot.
MS-Windows: Crash opening very long file name starting with "\\".
(Christian Brock, 2012 Jun 29)
Patch to have text objects defined by arbitrary single characters. (Daniel
Thau, 2013 Nov 20, 2014 Jan 29, 2014 Jan 31)
Ben Fritz: problem with 'selection' set to "exclusive".
@@ -435,9 +430,6 @@ Should be possible to enable/disable matchparen per window or buffer.
Add a check for b:no_match_paren in Highlight_matching_Pair() (Marcin
Szamotulski, 2012 Nov 8)
Crash in autocmd that unloads buffers in a BufUnload event. (Andrew Pimlott,
2012 Aug 11) Disallow :new when BufUnload is being handled?
Issue 72: 'autochdir' causes problems for :vimgrep.
Session file creation: 'autochdir' causes trouble. Keep it off until after
@@ -849,8 +841,6 @@ Patch: Let rare word highlighting overrule good word highlighting.
When 'lines' is 25 and 'scrolloff' is 12, "j" scrolls zero or two lines
instead of one. (Constantin Pan, 2010 Sep 10)
Crash in setqflist(). (Benoit Mortgat, 2010 Nov 18)
Gui menu edit/paste in block mode insert only inserts in one line (Bjorn
Winckler, 2011 May 11)
Requires a map mode for Insert mode started from blockwise Visual mode.

View File

@@ -1,4 +1,4 @@
*usr_41.txt* For Vim version 7.4. Last change: 2014 Jan 10
*usr_41.txt* For Vim version 7.4. Last change: 2014 Apr 05
VIM USER MANUAL - by Bram Moolenaar
@@ -742,6 +742,7 @@ System functions and manipulation of files:
pathshorten() shorten directory names in a path
simplify() simplify a path without changing its meaning
executable() check if an executable program exists
exepath() full path of an executable program
filereadable() check if a file can be read
filewritable() check if a file can be written to
getfperm() get the permissions of a file
@@ -754,7 +755,8 @@ System functions and manipulation of files:
mkdir() create a new directory
delete() delete a file
rename() rename a file
system() get the result of a shell command
system() get the result of a shell command as a string
systemlist() get the result of a shell command as a list
hostname() name of the system
readfile() read a file into a List of lines
writefile() write a List of lines into a file

View File

@@ -1,4 +1,4 @@
*various.txt* For Vim version 7.4. Last change: 2014 Mar 23
*various.txt* For Vim version 7.4. Last change: 2014 Apr 01
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -234,25 +234,41 @@ g8 Print the hex values of the bytes used in the
*:!cmd* *:!* *E34*
:!{cmd} Execute {cmd} with the shell. See also the 'shell'
and 'shelltype' option.
Any '!' in {cmd} is replaced with the previous
external command (see also 'cpoptions'). But not when
there is a backslash before the '!', then that
backslash is removed. Example: ":!ls" followed by
":!echo ! \! \\!" executes "echo ls ! \!".
After the command has been executed, the timestamp of
the current file is checked |timestamp|.
A '|' in {cmd} is passed to the shell, you cannot use
it to append a Vim command. See |:bar|.
If {cmd} contains "%" it is expanded to the current
file name. Special characters are not escaped, use
quotes to avoid their special meaning: >
:!ls "%"
< If the file name contains a "$" single quotes might
work better (but a single quote causes trouble): >
:!ls '%'
< This should always work, but it's more typing: >
:exe "!ls " . shellescape(expand("%"))
<
A newline character ends {cmd}, what follows is
interpreted as a following ":" command. However, if
there is a backslash before the newline it is removed
and {cmd} continues. It doesn't matter how many
backslashes are before the newline, only one is
removed.
On Unix the command normally runs in a non-interactive
shell. If you want an interactive shell to be used
(to use aliases) set 'shellcmdflag' to "-ic".
For Win32 also see |:!start|.
After the command has been executed, the timestamp of
the current file is checked |timestamp|.
Vim redraws the screen after the command is finished,
because it may have printed any text. This requires a
hit-enter prompt, so that you can read any messages.

View File

@@ -2,14 +2,17 @@
" Language: J
" Maintainer: David Bürgin <676c7473@gmail.com>
" URL: https://github.com/glts/vim-j
" Last Change: 2014-03-17
" Last Change: 2014-04-05
if exists('b:did_ftplugin')
finish
endif
let b:did_ftplugin = 1
setlocal iskeyword=48-57,65-90,_,97-122
let s:save_cpo = &cpo
set cpo&vim
setlocal iskeyword=48-57,A-Z,_,a-z
setlocal comments=:NB.
setlocal commentstring=NB.\ %s
setlocal formatoptions-=t
@@ -17,3 +20,56 @@ setlocal shiftwidth=2 softtabstop=2 expandtab
setlocal matchpairs=(:)
let b:undo_ftplugin = 'setlocal matchpairs< expandtab< softtabstop< shiftwidth< formatoptions< commentstring< comments< iskeyword<'
" Section movement with ]] ][ [[ []. The start/end patterns below are amended
" inside the function in order to avoid matching on the current cursor line.
let s:sectionstart = '.\{-}\<\%([0-4]\|13\|noun\|adverb\|conjunction\|verb\|monad\|dyad\)\s\+\%(:\s*0\|def\s\+0\|define\)\>.*'
let s:sectionend = '\s*)\s*'
function! s:SearchSection(end, backwards, visualmode) abort
if a:visualmode !=# ''
normal! gv
endif
let flags = a:backwards ? 'bsW' : 'sW'
if a:end
call search('^' . s:sectionend . (a:backwards ? '\n\_.\{-}\%#' : '$'), flags)
else
call search('^' . s:sectionstart . (a:backwards ? '\n\_.\{-}\%#' : '$'), flags)
endif
endfunction
noremap <script> <buffer> <silent> ]] :<C-U>call <SID>SearchSection(0, 0, '')<CR>
xnoremap <script> <buffer> <silent> ]] :<C-U>call <SID>SearchSection(0, 0, visualmode())<CR>
sunmap <buffer> ]]
noremap <script> <buffer> <silent> ][ :<C-U>call <SID>SearchSection(1, 0, '')<CR>
xnoremap <script> <buffer> <silent> ][ :<C-U>call <SID>SearchSection(1, 0, visualmode())<CR>
sunmap <buffer> ][
noremap <script> <buffer> <silent> [[ :<C-U>call <SID>SearchSection(0, 1, '')<CR>
xnoremap <script> <buffer> <silent> [[ :<C-U>call <SID>SearchSection(0, 1, visualmode())<CR>
sunmap <buffer> [[
noremap <script> <buffer> <silent> [] :<C-U>call <SID>SearchSection(1, 1, '')<CR>
xnoremap <script> <buffer> <silent> [] :<C-U>call <SID>SearchSection(1, 1, visualmode())<CR>
sunmap <buffer> []
let b:undo_ftplugin .= ' | silent! execute "unmap <buffer> ]]"'
\ . ' | silent! execute "unmap <buffer> ]["'
\ . ' | silent! execute "unmap <buffer> [["'
\ . ' | silent! execute "unmap <buffer> []"'
" Browse dialog filter on Windows (see ":help browsefilter")
if has('gui_win32') && !exists('b:browsefilter')
let b:browsefilter = "J Script Files (*.ijs)\t*.ijs\n"
\ . "All Files (*.*)\t*.*\n"
let b:undo_ftplugin .= ' | unlet! b:browsefilter'
endif
" Enhanced "%" matching (see ":help matchit")
if exists('loaded_matchit') && !exists('b:match_words')
let b:match_ignorecase = 0
let b:match_words = '^.\{-}\<\%([0-4]\|13\|noun\|adverb\|conjunction\|verb\|monad\|dyad\)\s\+\%(\:\s*0\|def\s\+0\|define\)\>:^\s*\:\s*$:^\s*)\s*$'
\ . ',\<\%(for\%(_\a\k*\)\=\|if\|select\|try\|whil\%(e\|st\)\)\.:\<\%(case\|catch[dt]\=\|else\%(if\)\=\|fcase\)\.:\<end\.'
let b:undo_ftplugin .= ' | unlet! b:match_ignorecase b:match_words'
endif
let &cpo = s:save_cpo
unlet s:save_cpo

View File

@@ -2,7 +2,7 @@
" Language: J
" Maintainer: David Bürgin <676c7473@gmail.com>
" URL: https://github.com/glts/vim-j
" Last Change: 2014-03-17
" Last Change: 2014-04-05
if exists('b:did_indent')
finish
@@ -10,8 +10,8 @@ endif
let b:did_indent = 1
setlocal indentexpr=GetJIndent()
setlocal indentkeys-=0{,0},\:,0#
setlocal indentkeys+=0),=case.,=catch.,=catchd.,=catcht.,=do.,=else.,=elseif.,=end.,=fcase.
setlocal indentkeys-=0{,0},:,0#
setlocal indentkeys+=0),0<:>,=case.,=catch.,=catchd.,=catcht.,=do.,=else.,=elseif.,=end.,=fcase.
let b:undo_indent = 'setlocal indentkeys< indentexpr<'
@@ -19,19 +19,31 @@ if exists('*GetJIndent')
finish
endif
function GetJIndent()
" If g:j_indent_definitions is true, the bodies of explicit definitions of
" adverbs, conjunctions, and verbs will be indented. Default is false (0).
if !exists('g:j_indent_definitions')
let g:j_indent_definitions = 0
endif
function GetJIndent() abort
let prevlnum = prevnonblank(v:lnum-1)
if prevlnum == 0
return 0
endif
let indent = indent(prevlnum)
if getline(prevlnum) =~# '^\s*\%(case\|catch[dt]\=\|do\|else\%(if\)\=\|fcase\|for\%(_\a\k*\)\=\|if\|select\|try\|whil\%(e\|st\)\)\.'
if getline(prevlnum) !~# '\<end\.'
let indent += shiftwidth()
endif
let prevline = getline(prevlnum)
if prevline =~# '^\s*\%(case\|catch[dt]\=\|do\|else\%(if\)\=\|fcase\|for\%(_\a\k*\)\=\|if\|select\|try\|whil\%(e\|st\)\)\.\%(\%(\<end\.\)\@!.\)*$'
" Increase indentation after an initial control word that starts or
" continues a block and is not terminated by "end."
let indent += shiftwidth()
elseif g:j_indent_definitions && (prevline =~# '\<\%([1-4]\|13\|adverb\|conjunction\|verb\|monad\|dyad\)\s\+\%(:\s*0\|def\s\+0\|define\)\>' || prevline =~# '^\s*:\s*$')
" Increase indentation in explicit definitions of adverbs, conjunctions,
" and verbs
let indent += shiftwidth()
endif
if getline(v:lnum) =~# '^\s*\%(\%(case\|catch[dt]\=\|do\|else\%(if\)\=\|end\|fcase\)\.\)\|)'
" Decrease indentation in lines that start with either control words that
" continue or end a block, or the special items ")" and ":"
if getline(v:lnum) =~# '^\s*\%()\|:\|\%(case\|catch[dt]\=\|do\|else\%(if\)\=\|end\|fcase\)\.\)'
let indent -= shiftwidth()
endif
return indent

View File

@@ -1,7 +1,7 @@
" These commands create the option window.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2013 Jun 29
" Last Change: 2014 Apr 01
" If there already is an option window, jump to that one.
if bufwinnr("option-window") > 0

View File

@@ -2,31 +2,36 @@
" Language: J
" Maintainer: David Bürgin <676c7473@gmail.com>
" URL: https://github.com/glts/vim-j
" Last Change: 2014-03-17
" Last Change: 2014-04-05
if exists('b:current_syntax')
finish
endif
let s:save_cpo = &cpo
set cpo&vim
syntax case match
syntax sync minlines=50
syntax cluster jStdlibItems contains=jStdlibNoun,jStdlibAdverb,jStdlibConjunction,jStdlibVerb
syntax cluster jPrimitiveItems contains=jNoun,jAdverb,jConjunction,jVerb,jCopula
syntax match jControl /\<\%(assert\|break\|case\|catch[dt]\=\|continue\|do\|else\%(if\)\=\|end\|fcase\|for\|if\|return\|select\|throw\|try\|whil\%(e\|st\)\)\./
syntax match jControl /\<\%(for\|goto\|label\)_\a\k*\./
" Standard library names defined in the z locale. A few verbs need to be
" defined with ":syntax match" because they would otherwise take precedence
" over the corresponding jControl items.
syntax keyword jNoun ARGV BINPATH CR CRLF DEL Debug EAV EMPTY FF FHS IF64 IFIOS IFJCDROID IFJHS IFQT IFRASPI IFUNIX IFWIN IFWINCE IFWINE IFWOW64 JB01 JBOXED JCHAR JCMPX JFL JINT JPTR JSIZES JSTR JTYPES JVERSION LF LF2 TAB UNAME UNXLIB adverb andurl conjunction dbhelp dyad libjqt monad noun verb
syntax keyword jAdverb define each every fapplylines inv inverse items leaf rows table
syntax keyword jConjunction bind cuts def on
syntax keyword jVerb AND Endian IFDEF Note OR XOR alpha17 alpha27 anddf android_exec_host andunzip apply boxopen boxxopen bx calendar cd cdcb cder cderx cdf charsub chopstring clear coclass cocreate cocurrent codestroy coerase cofind cofindv cofullname coinfo coinsert coname conames conew conl conouns conounsx copath copathnl copathnlx coreset costate cut cutLF cutopen cutpara datatype dbctx dberm dberr dbg dbjmp dblocals dblxq dblxs dbnxt dbq dbr dbret dbrr dbrrx dbrun dbs dbsig dbsq dbss dbst dbstack dbstk dbstop dbstopme dbstopnext dbstops dbtrace dbview deb debc delstring detab dfh dir dircompare dircompares dirfind dirpath dirss dirssrplc dirtree dirused dlb dltb dltbs dquote drop dropafter dropto dtb dtbs echo empty endian erase evtloop exit expand f2utf8 fappend fappends fboxname fc fcopynew fdir ferase fetch fexist fexists fgets file2url fixdotdot fliprgb fmakex foldpara foldtext fpathcreate fpathname fputs fread freadblock freadr freads frename freplace fsize fss fssrplc fstamp fstringreplace ftype fview fwrite fwritenew fwrites getargs getdate getenv getqtbin hfd hostpathsep ic install iospath isatty isotimestamp isutf8 jcwdpath joinstring jpathsep jsystemdefs list ljust load loadd mema memf memr memw nameclass namelist names nc nl pick quote require rjust rplc script scriptd setbreak show sign sminfo smoutput sort split splitnostring splitstring ss startupandroid startupconsole startupide stderr stdin stdout stringreplace symdat symget symset take takeafter taketo timespacex timestamp timex tmoutput toCRLF toHOST toJ todate todayno tolower topara toupper tsdiff tsrep tstamp type ucp ucpcount unxlib usleep utf8 uucp valdate wcsize weekday weeknumber weeksinyear winpathsep
syntax match jVerb /\<\%(assert\|break\|do\)\>\.\@!/
" Standard library names. A few names need to be defined with ":syntax match"
" because they would otherwise take precedence over the corresponding jControl
" and jDefineExpression items.
syntax keyword jStdlibNoun ARGV BINPATH CR CRLF DEL Debug EAV EMPTY FF FHS IF64 IFIOS IFJCDROID IFJHS IFQT IFRASPI IFUNIX IFWIN IFWINCE IFWINE IFWOW64 JB01 JBOXED JCHAR JCMPX JFL JINT JPTR JSIZES JSTR JTYPES JVERSION LF LF2 TAB UNAME UNXLIB andurl dbhelp libjqt
syntax keyword jStdlibAdverb define each every fapplylines inv inverse items leaf rows table
syntax keyword jStdlibConjunction bind cuts def on
syntax keyword jStdlibVerb AND Endian IFDEF Note OR XOR alpha17 alpha27 anddf android_exec_host andunzip apply boxopen boxxopen bx calendar cd cdcb cder cderx cdf charsub chopstring clear coclass cocreate cocurrent codestroy coerase cofind cofindv cofullname coinfo coinsert coname conames conew conl conouns conounsx copath copathnl copathnlx coreset costate cut cutLF cutopen cutpara datatype dbctx dberm dberr dbg dbjmp dblocals dblxq dblxs dbnxt dbq dbr dbret dbrr dbrrx dbrun dbs dbsig dbsq dbss dbst dbstack dbstk dbstop dbstopme dbstopnext dbstops dbtrace dbview deb debc delstring detab dfh dir dircompare dircompares dirfind dirpath dirss dirssrplc dirtree dirused dlb dltb dltbs dquote drop dropafter dropto dtb dtbs echo empty endian erase evtloop exit expand f2utf8 fappend fappends fboxname fc fcopynew fdir ferase fetch fexist fexists fgets file2url fixdotdot fliprgb fmakex foldpara foldtext fpathcreate fpathname fputs fread freadblock freadr freads frename freplace fsize fss fssrplc fstamp fstringreplace ftype fview fwrite fwritenew fwrites getargs getdate getenv getqtbin hfd hostpathsep ic install iospath isatty isotimestamp isutf8 jcwdpath joinstring jpathsep jsystemdefs list ljust load loadd mema memf memr memw nameclass namelist names nc nl pick quote require rjust rplc script scriptd setbreak show sign sminfo smoutput sort split splitnostring splitstring ss startupandroid startupconsole startupide stderr stdin stdout stringreplace symdat symget symset take takeafter taketo timespacex timestamp timex tmoutput toCRLF toHOST toJ todate todayno tolower topara toupper tsdiff tsrep tstamp type ucp ucpcount unxlib usleep utf8 uucp valdate wcsize weekday weeknumber weeksinyear winpathsep
syntax match jStdlibNoun /\<\%(adverb\|conjunction\|dyad\|monad\|noun\|verb\)\>/
syntax match jStdlibVerb /\<\%(assert\|break\|do\)\>\.\@!/
syntax region jString oneline start=/'/ skip=/''/ end=/'/
" Number patterns. Matching J numbers is difficult. The regular expression
" used for the general case roughly embodies this grammar sketch:
" Numbers. Matching J numbers is difficult. The regular expression used for
" the general case roughly embodies this grammar sketch:
"
" BASE := /_?\d+(\.\d*)?([eE]_?\d+)?/
" RATIONAL := BASE | BASE r BASE
@@ -43,21 +48,87 @@ syntax region jString oneline start=/'/ skip=/''/ end=/'/
syntax match jNumber /\<_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\%(\%(r_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\%([px]_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\%(r_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\)\=\)\=\)\|\%(\%(j\|a[dr]\)_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\%([px]_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\%(\%(j\|a[dr]\)_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\)\=\)\=\)\|\%([px]_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\%(\%(j\|a[dr]\|r\)_\=\d\+\%(\.\d*\)\=\%([eE]_\=\d\+\)\=\)\=\)\)\=/
syntax match jNumber /\<_\=\d\+\%([eE]\d\+\)\=b_\=[0-9a-z]\+/
syntax match jNumber /\<__\=\>/
syntax match jNumber /\<_\./
syntax match jNumber /\<_\=\d\+x\>/
syntax keyword jTodo TODO FIXME XXX contained
syntax region jString oneline start=/'/ skip=/''/ end=/'/
syntax keyword jArgument contained x y u v m n
" Primitives. Order is significant both within the patterns and among
" ":syntax match" statements. Refer to "Parts of speech" in the J dictionary.
syntax match jNoun /\<a[.:]/
syntax match jAdverb /[}~]\|[/\\]\.\=\|\<\%([Mbft]\.\|t:\)/
syntax match jConjunction /"\|`:\=\|[.:@&][.:]\=\|&\.:\|\<\%([dDHT]\.\|[DLS]:\)/
syntax match jVerb /[=!\]]\|[\^?]\.\=\|[;[]:\=\|{\.\|[_/\\]:\|[<>+*\-%$|,#][.:]\=\|[~}"][.:]\|{\%[::]\|\<\%([ACeEiIjLor]\.\|p\.\.\=\|[ipqsux]:\|0:\|_\=[1-9]:\)/
syntax match jCopula /=[.:]/
syntax match jConjunction /;\.\|\^:\|![.:]/
" Explicit noun definition. The difficulty is that the define expression
" "0 : 0" can occur in the middle of a line but the jNounDefine region must
" only start on the next line. The trick is to split the problem into two
" regions and link them with "nextgroup=".
syntax region jNounDefineStart
\ matchgroup=jDefineExpression start=/\<\%(0\|noun\)\s\+\%(\:\s*0\|def\s\+0\|define\)\>/
\ keepend matchgroup=NONE end=/$/
\ contains=@jStdlibItems,@jPrimitiveItems,jNumber,jString,jParenGroup,jParen,jComment
\ oneline skipempty nextgroup=jDefineEnd,jNounDefine
" These two items must have "contained", which allows them to match only after
" jNounDefineStart thanks to the "nextgroup=" above.
syntax region jNounDefine
\ matchgroup=NONE start=/^/
\ matchgroup=jDefineEnd end=/^\s*)\s*$/
\ contained
" This match is necessary in case of an empty noun definition
syntax match jDefineEnd contained /^\s*)\s*$/
" Explicit verb, adverb, and conjunction definition
syntax region jDefine
\ matchgroup=jDefineExpression start=/\<\%([1-4]\|13\|adverb\|conjunction\|verb\|monad\|dyad\)\s\+\%(:\s*0\|def\s\+0\|define\)\>/
\ matchgroup=jDefineEnd end=/^\s*)\s*$/
\ contains=jControl,@jStdlibItems,@jPrimitiveItems,jNumber,jString,jArgument,jParenGroup,jParen,jComment,jDefineMonadDyad
syntax match jDefineMonadDyad contained /^\s*:\s*$/
" Paired parentheses. When a jDefineExpression such as "3 : 0" is
" parenthesised it will erroneously extend jParenGroup to span over the whole
" definition body. This situation receives a special treatment here.
syntax match jParen /(\%(\s*\%([0-4]\|13\|noun\|adverb\|conjunction\|verb\|monad\|dyad\)\s\+\%(:\s*0\|def\s\+0\|define\)\s*)\)\@=/
syntax match jParen contained /\%((\s*\%([0-4]\|13\|noun\|adverb\|conjunction\|verb\|monad\|dyad\)\s\+\%(:\s*0\|def\s\+0\|define\)\s*\)\@<=)/
syntax region jParenGroup
\ matchgroup=jParen start=/(\%(\s*\%([0-4]\|13\|noun\|adverb\|conjunction\|verb\|monad\|dyad\)\s\+\%(:\s*0\|def\s\+0\|define\)\>\)\@!/
\ matchgroup=jParen end=/)/
\ oneline transparent
syntax keyword jTodo contained TODO FIXME XXX
syntax match jComment /NB\..*$/ contains=jTodo,@Spell
syntax match jSharpBang /\%^#!.*$/
highlight default link jControl Statement
highlight default link jNoun Identifier
highlight default link jAdverb Identifier
highlight default link jConjunction Identifier
highlight default link jVerb Function
highlight default link jString String
highlight default link jNumber Number
highlight default link jTodo Todo
highlight default link jComment Comment
highlight default link jSharpBang PreProc
highlight default link jControl Statement
highlight default link jStdlibNoun Identifier
highlight default link jStdlibAdverb Function
highlight default link jStdlibConjunction Function
highlight default link jStdlibVerb Function
highlight default link jString String
highlight default link jNumber Number
highlight default link jNoun Constant
highlight default link jAdverb Normal
highlight default link jConjunction Normal
highlight default link jVerb Normal
highlight default link jCopula Normal
highlight default link jArgument Identifier
highlight default link jParen Delimiter
highlight default link jDefineExpression Define
highlight default link jDefineMonadDyad Delimiter
highlight default link jDefineEnd Delimiter
highlight default link jNounDefine Normal
highlight default link jTodo Todo
highlight default link jComment Comment
highlight default link jSharpBang PreProc
let b:current_syntax = 'j'
let &cpo = s:save_cpo
unlet s:save_cpo

View File

@@ -1880,6 +1880,7 @@ unittest unittests: $(UNITTEST_TARGETS)
# Run individual test, assuming that Vim was already compiled.
test1 test2 test3 test4 test5 test6 test7 test8 test9 \
test_eval \
test_options \
test10 test11 test12 test13 test14 test15 test16 test17 test18 test19 \
test20 test21 test22 test23 test24 test25 test26 test27 test28 test29 \

64
src/auto/configure vendored
View File

@@ -4074,9 +4074,9 @@ if test -z "$CFLAGS"; then
test "$GCC" = yes && CFLAGS="-O2 -fno-strength-reduce -Wall"
fi
if test "$GCC" = yes; then
gccversion=`"$CC" -dumpversion`
gccversion=`$CC -dumpversion`
if test "x$gccversion" = "x"; then
gccversion=`"$CC" --version | sed -e '2,$d' -e 's/darwin.//' -e 's/^[^0-9]*\([0-9]\.[0-9.]*\).*$/\1/g'`
gccversion=`$CC --version | sed -e '2,$d' -e 's/darwin.//' -e 's/^[^0-9]*\([0-9]\.[0-9.]*\).*$/\1/g'`
fi
if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2" -o "$gccversion" = "4.0.1"; then
echo 'GCC [34].0.[12] has a bug in the optimizer, disabling "-O#"'
@@ -4091,7 +4091,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for recent clang version" >&5
$as_echo_n "checking for recent clang version... " >&6; }
CLANG_VERSION_STRING=`"$CC" --version 2>/dev/null | sed -n -e 's/^.*clang.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/p'`
CLANG_VERSION_STRING=`$CC --version 2>/dev/null | sed -n -e 's/^.*clang.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/p'`
if test x"$CLANG_VERSION_STRING" != x"" ; then
CLANG_MAJOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*/\1/p'`
CLANG_MINOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/[0-9][0-9]*\.\([0-9][0-9]*\)\.[0-9][0-9]*/\1/p'`
@@ -4600,6 +4600,8 @@ else
fi
if test "$enable_smack" = "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
ac_fn_c_check_header_mongrel "$LINENO" "linux/xattr.h" "ac_cv_header_linux_xattr_h" "$ac_includes_default"
if test "x$ac_cv_header_linux_xattr_h" = xyes; then :
true
@@ -4608,13 +4610,42 @@ else
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
if test "$enable_smack" = "yes"; then
ac_fn_c_check_header_mongrel "$LINENO" "attr/xattr.h" "ac_cv_header_attr_xattr_h" "$ac_includes_default"
if test "x$ac_cv_header_attr_xattr_h" = xyes; then :
true
else
enable_smack="no"
fi
fi
if test "$enable_smack" = "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XATTR_NAME_SMACKEXEC in linux/xattr.h" >&5
$as_echo_n "checking for XATTR_NAME_SMACKEXEC in linux/xattr.h... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <linux/xattr.h>
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$EGREP "XATTR_NAME_SMACKEXEC" >/dev/null 2>&1; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for llistxattr in -lattr" >&5
$as_echo_n "checking for llistxattr in -lattr... " >&6; }
if ${ac_cv_lib_attr_llistxattr+:} false; then :
$as_echo "no" >&6; }; enable_smack="no"
fi
rm -f conftest*
fi
if test "$enable_smack" = "yes"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for setxattr in -lattr" >&5
$as_echo_n "checking for setxattr in -lattr... " >&6; }
if ${ac_cv_lib_attr_setxattr+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -4628,36 +4659,33 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
#ifdef __cplusplus
extern "C"
#endif
char llistxattr ();
char setxattr ();
int
main ()
{
return llistxattr ();
return setxattr ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_attr_llistxattr=yes
ac_cv_lib_attr_setxattr=yes
else
ac_cv_lib_attr_llistxattr=no
ac_cv_lib_attr_setxattr=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_attr_llistxattr" >&5
$as_echo "$ac_cv_lib_attr_llistxattr" >&6; }
if test "x$ac_cv_lib_attr_llistxattr" = xyes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_attr_setxattr" >&5
$as_echo "$ac_cv_lib_attr_setxattr" >&6; }
if test "x$ac_cv_lib_attr_setxattr" = xyes; then :
LIBS="$LIBS -lattr"
found_smack="yes"
$as_echo "#define HAVE_SMACK 1" >>confdefs.h
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
if test "x$found_smack" = "x"; then
@@ -9275,7 +9303,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no; xim has been disabled" >&5
$as_echo "no; xim has been disabled" >&6; }; enable_xim = "no"
$as_echo "no; xim has been disabled" >&6; }; enable_xim="no"
fi
rm -f conftest*

View File

@@ -676,8 +676,16 @@ free_buffer(buf)
#endif
#ifdef FEAT_AUTOCMD
aubuflocal_remove(buf);
if (autocmd_busy)
{
/* Do not free the buffer structure while autocommands are executing,
* it's still needed. Free it when autocmd_busy is reset. */
buf->b_next = au_pending_free_buf;
au_pending_free_buf = buf;
}
else
#endif
vim_free(buf);
vim_free(buf);
}
/*
@@ -1681,7 +1689,11 @@ buflist_new(ffname, sfname, lnum, flags)
buf->b_p_bl = TRUE;
#ifdef FEAT_AUTOCMD
if (!(flags & BLN_DUMMY))
{
apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, buf);
if (!buf_valid(buf))
return NULL;
}
#endif
}
return buf;
@@ -1857,8 +1869,14 @@ buflist_new(ffname, sfname, lnum, flags)
if (!(flags & BLN_DUMMY))
{
apply_autocmds(EVENT_BUFNEW, NULL, NULL, FALSE, buf);
if (!buf_valid(buf))
return NULL;
if (flags & BLN_LISTED)
{
apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, buf);
if (!buf_valid(buf))
return NULL;
}
# ifdef FEAT_EVAL
if (aborting()) /* autocmds may abort script processing */
return NULL;

View File

@@ -46,10 +46,10 @@ if test -z "$CFLAGS"; then
fi
if test "$GCC" = yes; then
dnl method that should work for nearly all versions
gccversion=`"$CC" -dumpversion`
gccversion=`$CC -dumpversion`
if test "x$gccversion" = "x"; then
dnl old method; fall-back for when -dumpversion doesn't work
gccversion=`"$CC" --version | sed -e '2,$d' -e 's/darwin.//' -e 's/^[[^0-9]]*\([[0-9]]\.[[0-9.]]*\).*$/\1/g'`
gccversion=`$CC --version | sed -e '2,$d' -e 's/darwin.//' -e 's/^[[^0-9]]*\([[0-9]]\.[[0-9.]]*\).*$/\1/g'`
fi
dnl version 4.0.1 was reported to cause trouble on Macintosh by Marcin Dalecki
if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2" -o "$gccversion" = "4.0.1"; then
@@ -68,7 +68,7 @@ dnl warning when that flag is passed to. Accordingly, adjust CFLAGS based on
dnl the version number of the clang in use.
dnl Note that this does not work to get the version of clang 3.1 or 3.2.
AC_MSG_CHECKING(for recent clang version)
CLANG_VERSION_STRING=`"$CC" --version 2>/dev/null | sed -n -e 's/^.*clang.*\([[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\).*$/\1/p'`
CLANG_VERSION_STRING=`$CC --version 2>/dev/null | sed -n -e 's/^.*clang.*\([[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*\).*$/\1/p'`
if test x"$CLANG_VERSION_STRING" != x"" ; then
CLANG_MAJOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*\.[[0-9]][[0-9]]*/\1/p'`
CLANG_MINOR=`echo "$CLANG_VERSION_STRING" | sed -n -e 's/[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*/\1/p'`
@@ -393,16 +393,25 @@ AC_ARG_ENABLE(smack,
[ --disable-smack Do not check for Smack support.],
, enable_smack="yes")
if test "$enable_smack" = "yes"; then
AC_MSG_RESULT(no)
AC_CHECK_HEADER([linux/xattr.h], true, enable_smack="no")
else
AC_MSG_RESULT(yes)
fi
if test "$enable_smack" = "yes"; then
AC_MSG_RESULT(no)
AC_CHECK_LIB(attr, llistxattr,
AC_CHECK_HEADER([attr/xattr.h], true, enable_smack="no")
fi
if test "$enable_smack" = "yes"; then
AC_MSG_CHECKING(for XATTR_NAME_SMACKEXEC in linux/xattr.h)
AC_EGREP_CPP(XATTR_NAME_SMACKEXEC, [#include <linux/xattr.h>],
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no); enable_smack="no")
fi
if test "$enable_smack" = "yes"; then
AC_CHECK_LIB(attr, setxattr,
[LIBS="$LIBS -lattr"
found_smack="yes"
AC_DEFINE(HAVE_SMACK)])
else
AC_MSG_RESULT(yes)
fi
dnl When smack was found don't search for SELinux
@@ -2634,7 +2643,7 @@ if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF" -o -z "$SKIP_
AC_MSG_CHECKING(for XIMText in X11/Xlib.h)
AC_EGREP_CPP(XIMText, [#include <X11/Xlib.h>],
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no; xim has been disabled); enable_xim = "no")
AC_MSG_RESULT(no; xim has been disabled); enable_xim="no")
fi
CPPFLAGS=$cppflags_save

View File

@@ -726,6 +726,7 @@ static void f_synIDtrans __ARGS((typval_T *argvars, typval_T *rettv));
static void f_synstack __ARGS((typval_T *argvars, typval_T *rettv));
static void f_synconcealed __ARGS((typval_T *argvars, typval_T *rettv));
static void f_system __ARGS((typval_T *argvars, typval_T *rettv));
static void f_systemlist __ARGS((typval_T *argvars, typval_T *rettv));
static void f_tabpagebuflist __ARGS((typval_T *argvars, typval_T *rettv));
static void f_tabpagenr __ARGS((typval_T *argvars, typval_T *rettv));
static void f_tabpagewinnr __ARGS((typval_T *argvars, typval_T *rettv));
@@ -807,7 +808,7 @@ static int eval_fname_sid __ARGS((char_u *p));
static void list_func_head __ARGS((ufunc_T *fp, int indent));
static ufunc_T *find_func __ARGS((char_u *name));
static int function_exists __ARGS((char_u *name));
static int builtin_function __ARGS((char_u *name));
static int builtin_function __ARGS((char_u *name, int len));
#ifdef FEAT_PROFILE
static void func_do_profile __ARGS((ufunc_T *fp));
static void prof_sort_list __ARGS((FILE *fd, ufunc_T **sorttab, int st_len, char *title, int prefer_self));
@@ -836,6 +837,8 @@ static void getwinvar __ARGS((typval_T *argvars, typval_T *rettv, int off));
static int searchpair_cmn __ARGS((typval_T *argvars, pos_T *match_pos));
static int search_cmn __ARGS((typval_T *argvars, pos_T *match_pos, int *flagsp));
static void setwinvar __ARGS((typval_T *argvars, typval_T *rettv, int off));
static int write_list __ARGS((FILE *fd, list_T *list, int binary));
static void get_cmd_output_as_rettv __ARGS((typval_T *argvars, typval_T *rettv, int retlist));
#ifdef EBCDIC
@@ -2458,7 +2461,7 @@ ex_let_one(arg, tv, copy, endchars, op)
p = get_tv_string_chk(tv);
if (p != NULL && op != NULL && *op == '.')
{
s = get_reg_contents(*arg == '@' ? '"' : *arg, TRUE, TRUE);
s = get_reg_contents(*arg == '@' ? '"' : *arg, GREG_EXPR_SRC);
if (s != NULL)
{
p = ptofree = concat_str(s, p);
@@ -5121,7 +5124,8 @@ eval7(arg, rettv, evaluate, want_string)
if (evaluate)
{
rettv->v_type = VAR_STRING;
rettv->vval.v_string = get_reg_contents(**arg, TRUE, TRUE);
rettv->vval.v_string = get_reg_contents(**arg,
GREG_EXPR_SRC);
}
if (**arg != NUL)
++*arg;
@@ -7970,7 +7974,7 @@ static struct fst
{"getpid", 0, 0, f_getpid},
{"getpos", 1, 1, f_getpos},
{"getqflist", 0, 0, f_getqflist},
{"getreg", 0, 2, f_getreg},
{"getreg", 0, 3, f_getreg},
{"getregtype", 0, 1, f_getregtype},
{"gettabvar", 2, 3, f_gettabvar},
{"gettabwinvar", 3, 4, f_gettabwinvar},
@@ -8129,7 +8133,7 @@ static struct fst
{"strridx", 2, 3, f_strridx},
{"strtrans", 1, 1, f_strtrans},
{"strwidth", 1, 1, f_strwidth},
{"submatch", 1, 1, f_submatch},
{"submatch", 1, 2, f_submatch},
{"substitute", 4, 4, f_substitute},
{"synID", 3, 3, f_synID},
{"synIDattr", 2, 3, f_synIDattr},
@@ -8137,6 +8141,7 @@ static struct fst
{"synconcealed", 2, 2, f_synconcealed},
{"synstack", 2, 2, f_synstack},
{"system", 1, 2, f_system},
{"systemlist", 1, 2, f_systemlist},
{"tabpagebuflist", 0, 1, f_tabpagebuflist},
{"tabpagenr", 0, 1, f_tabpagenr},
{"tabpagewinnr", 1, 2, f_tabpagewinnr},
@@ -8484,7 +8489,7 @@ call_func(funcname, len, rettv, argcount, argvars, firstline, lastline,
rettv->vval.v_number = 0;
error = ERROR_UNKNOWN;
if (!builtin_function(fname))
if (!builtin_function(fname, -1))
{
/*
* User defined function.
@@ -11799,6 +11804,7 @@ f_getreg(argvars, rettv)
char_u *strregname;
int regname;
int arg2 = FALSE;
int return_list = FALSE;
int error = FALSE;
if (argvars[0].v_type != VAR_UNKNOWN)
@@ -11806,17 +11812,34 @@ f_getreg(argvars, rettv)
strregname = get_tv_string_chk(&argvars[0]);
error = strregname == NULL;
if (argvars[1].v_type != VAR_UNKNOWN)
{
arg2 = get_tv_number_chk(&argvars[1], &error);
if (!error && argvars[2].v_type != VAR_UNKNOWN)
return_list = get_tv_number_chk(&argvars[2], &error);
}
}
else
strregname = vimvars[VV_REG].vv_str;
if (error)
return;
regname = (strregname == NULL ? '"' : *strregname);
if (regname == 0)
regname = '"';
rettv->v_type = VAR_STRING;
rettv->vval.v_string = error ? NULL :
get_reg_contents(regname, TRUE, arg2);
if (return_list)
{
rettv->v_type = VAR_LIST;
rettv->vval.v_list = (list_T *)get_reg_contents(regname,
(arg2 ? GREG_EXPR_SRC : 0) | GREG_LIST);
}
else
{
rettv->v_type = VAR_STRING;
rettv->vval.v_string = get_reg_contents(regname,
arg2 ? GREG_EXPR_SRC : 0);
}
}
/*
@@ -16771,8 +16794,6 @@ f_setreg(argvars, rettv)
regname = *strregname;
if (regname == 0 || regname == '@')
regname = '"';
else if (regname == '=')
return;
if (argvars[2].v_type != VAR_UNKNOWN)
{
@@ -16803,10 +16824,59 @@ f_setreg(argvars, rettv)
}
}
strval = get_tv_string_chk(&argvars[1]);
if (strval != NULL)
if (argvars[1].v_type == VAR_LIST)
{
char_u **lstval;
char_u **allocval;
char_u buf[NUMBUFLEN];
char_u **curval;
char_u **curallocval;
int len = argvars[1].vval.v_list->lv_len;
listitem_T *li;
/* First half: use for pointers to result lines; second half: use for
* pointers to allocated copies. */
lstval = (char_u **)alloc(sizeof(char_u *) * ((len + 1) * 2));
if (lstval == NULL)
return;
curval = lstval;
allocval = lstval + len + 2;
curallocval = allocval;
for (li = argvars[1].vval.v_list->lv_first; li != NULL;
li = li->li_next)
{
strval = get_tv_string_buf_chk(&li->li_tv, buf);
if (strval == NULL)
goto free_lstval;
if (strval == buf)
{
/* Need to make a copy, next get_tv_string_buf_chk() will
* overwrite the string. */
strval = vim_strsave(buf);
if (strval == NULL)
goto free_lstval;
*curallocval++ = strval;
}
*curval++ = strval;
}
*curval++ = NULL;
write_reg_contents_lst(regname, lstval, -1,
append, yank_type, block_len);
free_lstval:
while (curallocval > allocval)
vim_free(*--curallocval);
vim_free(lstval);
}
else
{
strval = get_tv_string_chk(&argvars[1]);
if (strval == NULL)
return;
write_reg_contents_ex(regname, strval, -1,
append, yank_type, block_len);
}
rettv->vval.v_number = 0;
}
@@ -17890,9 +17960,29 @@ f_submatch(argvars, rettv)
typval_T *argvars;
typval_T *rettv;
{
rettv->v_type = VAR_STRING;
rettv->vval.v_string =
reg_submatch((int)get_tv_number_chk(&argvars[0], NULL));
int error = FALSE;
int no;
int retList = 0;
no = (int)get_tv_number_chk(&argvars[0], &error);
if (error)
return;
error = FALSE;
if (argvars[1].v_type != VAR_UNKNOWN)
retList = get_tv_number_chk(&argvars[1], &error);
if (error)
return;
if (retList == 0)
{
rettv->v_type = VAR_STRING;
rettv->vval.v_string = reg_submatch(no);
}
else
{
rettv->v_type = VAR_LIST;
rettv->vval.v_list = reg_submatch_list(no);
}
}
/*
@@ -18160,13 +18250,11 @@ f_synstack(argvars, rettv)
#endif
}
/*
* "system()" function
*/
static void
f_system(argvars, rettv)
get_cmd_output_as_rettv(argvars, rettv, retlist)
typval_T *argvars;
typval_T *rettv;
int retlist;
{
char_u *res = NULL;
char_u *p;
@@ -18174,9 +18262,12 @@ f_system(argvars, rettv)
char_u buf[NUMBUFLEN];
int err = FALSE;
FILE *fd;
list_T *list = NULL;
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
if (check_restricted() || check_secure())
goto done;
goto errret;
if (argvars[1].v_type != VAR_UNKNOWN)
{
@@ -18187,74 +18278,160 @@ f_system(argvars, rettv)
if ((infile = vim_tempname('i')) == NULL)
{
EMSG(_(e_notmp));
goto done;
goto errret;
}
fd = mch_fopen((char *)infile, WRITEBIN);
if (fd == NULL)
{
EMSG2(_(e_notopen), infile);
goto done;
goto errret;
}
p = get_tv_string_buf_chk(&argvars[1], buf);
if (p == NULL)
if (argvars[1].v_type == VAR_LIST)
{
fclose(fd);
goto done; /* type error; errmsg already given */
if (write_list(fd, argvars[1].vval.v_list, TRUE) == FAIL)
err = TRUE;
}
else
{
p = get_tv_string_buf_chk(&argvars[1], buf);
if (p == NULL)
{
fclose(fd);
goto errret; /* type error; errmsg already given */
}
if (fwrite(p, STRLEN(p), 1, fd) != 1)
err = TRUE;
}
if (fwrite(p, STRLEN(p), 1, fd) != 1)
err = TRUE;
if (fclose(fd) != 0)
err = TRUE;
if (err)
{
EMSG(_("E677: Error writing temp file"));
goto done;
goto errret;
}
}
res = get_cmd_output(get_tv_string(&argvars[0]), infile,
SHELL_SILENT | SHELL_COOKED);
#ifdef USE_CR
/* translate <CR> into <NL> */
if (res != NULL)
if (retlist)
{
char_u *s;
int len;
listitem_T *li;
char_u *s = NULL;
char_u *start;
char_u *end;
char_u *p;
int i;
for (s = res; *s; ++s)
res = get_cmd_output(get_tv_string(&argvars[0]), infile,
SHELL_SILENT | SHELL_COOKED, &len);
if (res == NULL)
goto errret;
list = list_alloc();
if (list == NULL)
goto errret;
for (i = 0; i < len; ++i)
{
if (*s == CAR)
*s = NL;
start = res + i;
while (i < len && res[i] != NL)
++i;
end = res + i;
s = alloc((unsigned)(end - start + 1));
if (s == NULL)
goto errret;
for (p = s; start < end; ++p, ++start)
*p = *start == NUL ? NL : *start;
*p = NUL;
li = listitem_alloc();
if (li == NULL)
{
vim_free(s);
goto errret;
}
li->li_tv.v_type = VAR_STRING;
li->li_tv.vval.v_string = s;
list_append(list, li);
}
++list->lv_refcount;
rettv->v_type = VAR_LIST;
rettv->vval.v_list = list;
list = NULL;
}
else
{
res = get_cmd_output(get_tv_string(&argvars[0]), infile,
SHELL_SILENT | SHELL_COOKED, NULL);
#ifdef USE_CR
/* translate <CR> into <NL> */
if (res != NULL)
{
char_u *s;
for (s = res; *s; ++s)
{
if (*s == CAR)
*s = NL;
}
}
#else
# ifdef USE_CRNL
/* translate <CR><NL> into <NL> */
if (res != NULL)
{
char_u *s, *d;
d = res;
for (s = res; *s; ++s)
/* translate <CR><NL> into <NL> */
if (res != NULL)
{
if (s[0] == CAR && s[1] == NL)
++s;
*d++ = *s;
char_u *s, *d;
d = res;
for (s = res; *s; ++s)
{
if (s[0] == CAR && s[1] == NL)
++s;
*d++ = *s;
}
*d = NUL;
}
*d = NUL;
}
# endif
#endif
rettv->vval.v_string = res;
res = NULL;
}
done:
errret:
if (infile != NULL)
{
mch_remove(infile);
vim_free(infile);
}
rettv->v_type = VAR_STRING;
rettv->vval.v_string = res;
if (res != NULL)
vim_free(res);
if (list != NULL)
list_free(list, TRUE);
}
/*
* "system()" function
*/
static void
f_system(argvars, rettv)
typval_T *argvars;
typval_T *rettv;
{
get_cmd_output_as_rettv(argvars, rettv, FALSE);
}
/*
* "systemlist()" function
*/
static void
f_systemlist(argvars, rettv)
typval_T *argvars;
typval_T *rettv;
{
get_cmd_output_as_rettv(argvars, rettv, TRUE);
}
/*
@@ -19101,6 +19278,49 @@ f_winwidth(argvars, rettv)
#endif
}
/*
* Write list of strings to file
*/
static int
write_list(fd, list, binary)
FILE *fd;
list_T *list;
int binary;
{
listitem_T *li;
int c;
int ret = OK;
char_u *s;
for (li = list->lv_first; li != NULL; li = li->li_next)
{
for (s = get_tv_string(&li->li_tv); *s != NUL; ++s)
{
if (*s == '\n')
c = putc(NUL, fd);
else
c = putc(*s, fd);
if (c == EOF)
{
ret = FAIL;
break;
}
}
if (!binary || li->li_next != NULL)
if (putc('\n', fd) == EOF)
{
ret = FAIL;
break;
}
if (ret == FAIL)
{
EMSG(_(e_write));
break;
}
}
return ret;
}
/*
* "writefile()" function
*/
@@ -19112,10 +19332,7 @@ f_writefile(argvars, rettv)
int binary = FALSE;
char_u *fname;
FILE *fd;
listitem_T *li;
char_u *s;
int ret = 0;
int c;
if (check_restricted() || check_secure())
return;
@@ -19142,33 +19359,8 @@ f_writefile(argvars, rettv)
}
else
{
for (li = argvars[0].vval.v_list->lv_first; li != NULL;
li = li->li_next)
{
for (s = get_tv_string(&li->li_tv); *s != NUL; ++s)
{
if (*s == '\n')
c = putc(NUL, fd);
else
c = putc(*s, fd);
if (c == EOF)
{
ret = -1;
break;
}
}
if (!binary || li->li_next != NULL)
if (putc('\n', fd) == EOF)
{
ret = -1;
break;
}
if (ret < 0)
{
EMSG(_(e_write));
break;
}
}
if (write_list(fd, argvars[0].vval.v_list, binary) == FAIL)
ret = -1;
fclose(fd);
}
@@ -20278,6 +20470,9 @@ get_tv_string_buf(varp, buf)
return res != NULL ? res : (char_u *)"";
}
/*
* Careful: This uses a single, static buffer. YOU CAN ONLY USE IT ONCE!
*/
char_u *
get_tv_string_chk(varp)
typval_T *varp;
@@ -21389,6 +21584,7 @@ ex_function(eap)
* Get the function name. There are these situations:
* func normal function name
* "name" == func, "fudi.fd_dict" == NULL
* s:func script-local function name
* dict.func new dictionary entry
* "name" == NULL, "fudi.fd_dict" set,
* "fudi.fd_di" == NULL, "fudi.fd_newkey" == func
@@ -22119,11 +22315,24 @@ trans_function_name(pp, skip, flags, fdp)
lead += (int)STRLEN(sid_buf);
}
}
else if (!(flags & TFN_INT) && builtin_function(lv.ll_name))
else if (!(flags & TFN_INT) && builtin_function(lv.ll_name, len))
{
EMSG2(_("E128: Function name must start with a capital or contain a colon: %s"), lv.ll_name);
EMSG2(_("E128: Function name must start with a capital or \"s:\": %s"),
lv.ll_name);
goto theend;
}
if (!skip)
{
char_u *cp = vim_strchr(lv.ll_name, ':');
if (cp != NULL && cp < end)
{
EMSG2(_("E884: Function name cannot contain a colon: %s"),
lv.ll_name);
goto theend;
}
}
name = alloc((unsigned)(len + lead + 1));
if (name != NULL)
{
@@ -22136,7 +22345,7 @@ trans_function_name(pp, skip, flags, fdp)
STRCPY(name + 3, sid_buf);
}
mch_memmove(name + lead, lv.ll_name, (size_t)len);
name[len + lead] = NUL;
name[lead + len] = NUL;
}
*pp = end;
@@ -22257,7 +22466,7 @@ free_all_functions()
translated_function_exists(name)
char_u *name;
{
if (builtin_function(name))
if (builtin_function(name, -1))
return find_internal_func(name) >= 0;
return find_func(name) != NULL;
}
@@ -22305,14 +22514,20 @@ get_expanded_name(name, check)
/*
* Return TRUE if "name" looks like a builtin function name: starts with a
* lower case letter and doesn't contain a ':' or AUTOLOAD_CHAR.
* lower case letter and doesn't contain AUTOLOAD_CHAR.
* "len" is the length of "name", or -1 for NUL terminated.
*/
static int
builtin_function(name)
builtin_function(name, len)
char_u *name;
int len;
{
return ASCII_ISLOWER(name[0]) && vim_strchr(name, ':') == NULL
&& vim_strchr(name, AUTOLOAD_CHAR) == NULL;
char_u *p;
if (!ASCII_ISLOWER(name[0]))
return FALSE;
p = vim_strchr(name, AUTOLOAD_CHAR);
return p == NULL || (len > 0 && p > name + len);
}
#if defined(FEAT_PROFILE) || defined(PROTO)

View File

@@ -3343,6 +3343,12 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin)
#endif
buf = buflist_new(ffname, sfname, 0L,
BLN_CURBUF | ((flags & ECMD_SET_HELP) ? 0 : BLN_LISTED));
#ifdef FEAT_AUTOCMD
/* autocommands may change curwin and curbuf */
if (oldwin != NULL)
oldwin = curwin;
old_curbuf = curbuf;
#endif
}
if (buf == NULL)
goto theend;
@@ -4425,7 +4431,7 @@ do_sub(eap)
* TODO: find a generic solution to make line-joining operations more
* efficient, avoid allocating a string that grows in size.
*/
if (STRCMP(pat, "\\n") == 0 && STRLEN(pat) == 2
if (pat != NULL && STRCMP(pat, "\\n") == 0
&& *sub == NUL
&& (*cmd == NUL || (cmd[1] == NUL && (*cmd == 'g' || *cmd == 'l'
|| *cmd == 'p' || *cmd == '#'))))

View File

@@ -4341,7 +4341,7 @@ find_locales()
/* Find all available locales by running command "locale -a". If this
* doesn't work we won't have completion. */
char_u *locale_a = get_cmd_output((char_u *)"locale -a",
NULL, SHELL_SILENT);
NULL, SHELL_SILENT, NULL);
if (locale_a == NULL)
return NULL;
ga_init2(&locales_ga, sizeof(char_u *), 20);

View File

@@ -9548,13 +9548,19 @@ apply_autocmds_group(event, fname, fname_io, force, group, buf, eap)
/*
* When stopping to execute autocommands, restore the search patterns and
* the redo buffer.
* the redo buffer. Free buffers in the au_pending_free_buf list.
*/
if (!autocmd_busy)
{
restore_search_patterns();
restoreRedobuff();
did_filetype = FALSE;
while (au_pending_free_buf != NULL)
{
buf_T *b = au_pending_free_buf->b_next;
vim_free(au_pending_free_buf);
au_pending_free_buf = b;
}
}
/*

View File

@@ -386,6 +386,11 @@ EXTERN int keep_filetype INIT(= FALSE); /* value for did_filetype when
/* When deleting the current buffer, another one must be loaded. If we know
* which one is preferred, au_new_curbuf is set to it */
EXTERN buf_T *au_new_curbuf INIT(= NULL);
/* When deleting the buffer and autocmd_busy is TRUE, do not free the buffer
* but link it in the list starting with au_pending_free_buf, using b_next.
* Free the buffer when autocmd_busy is set to FALSE. */
EXTERN buf_T *au_pending_free_buf INIT(= NULL);
#endif
#ifdef FEAT_MOUSE

View File

@@ -732,7 +732,10 @@ blink_cb(gpointer data UNUSED)
gui_mch_start_blink(void)
{
if (blink_timer)
{
gtk_timeout_remove(blink_timer);
blink_timer = 0;
}
/* Only switch blinking on if none of the times is zero */
if (blink_waittime && blink_ontime && blink_offtime && gui.in_focus)
{

View File

@@ -10665,7 +10665,7 @@ expand_backtick(gap, pat, flags)
else
#endif
buffer = get_cmd_output(cmd, NULL,
(flags & EW_SILENT) ? SHELL_SILENT : 0);
(flags & EW_SILENT) ? SHELL_SILENT : 0, NULL);
vim_free(cmd);
if (buffer == NULL)
return 0;
@@ -10765,13 +10765,16 @@ addfile(gap, f, flags)
/*
* Get the stdout of an external command.
* If "ret_len" is NULL replace NUL characters with NL. When "ret_len" is not
* NULL store the length there.
* Returns an allocated string, or NULL for error.
*/
char_u *
get_cmd_output(cmd, infile, flags)
get_cmd_output(cmd, infile, flags, ret_len)
char_u *cmd;
char_u *infile; /* optional input file name */
int flags; /* can be SHELL_SILENT */
int *ret_len;
{
char_u *tempname;
char_u *command;
@@ -10841,7 +10844,7 @@ get_cmd_output(cmd, infile, flags)
vim_free(buffer);
buffer = NULL;
}
else
else if (ret_len == NULL)
{
/* Change NUL into SOH, otherwise the string is truncated. */
for (i = 0; i < len; ++i)
@@ -10850,6 +10853,8 @@ get_cmd_output(cmd, infile, flags)
buffer[len] = NUL; /* make sure the buffer is terminated */
}
else
*ret_len = len;
done:
vim_free(tempname);

303
src/ops.c
View File

@@ -113,7 +113,7 @@ static char_u *skip_comment __ARGS((char_u *line, int process, int include_space
#endif
static void block_prep __ARGS((oparg_T *oap, struct block_def *, linenr_T, int));
#if defined(FEAT_CLIPBOARD) || defined(FEAT_EVAL)
static void str_to_reg __ARGS((struct yankreg *y_ptr, int type, char_u *str, long len, long blocklen));
static void str_to_reg __ARGS((struct yankreg *y_ptr, int yank_type, char_u *str, long len, long blocklen, int str_list));
#endif
static int ends_in_white __ARGS((linenr_T lnum));
#ifdef FEAT_COMMENTS
@@ -6005,7 +6005,7 @@ clip_yank_selection(type, str, len, cbd)
clip_free_selection(cbd);
str_to_reg(y_ptr, type, str, len, 0L);
str_to_reg(y_ptr, type, str, len, 0L, FALSE);
}
/*
@@ -6113,7 +6113,7 @@ dnd_yank_drag_data(str, len)
curr = y_current;
y_current = &y_regs[TILDE_REGISTER];
free_yank_all();
str_to_reg(y_current, MCHAR, str, len, 0L);
str_to_reg(y_current, MCHAR, str, len, 0L, FALSE);
y_current = curr;
}
#endif
@@ -6166,16 +6166,49 @@ get_reg_type(regname, reglen)
return MAUTO;
}
static char_u *getreg_wrap_one_line __ARGS((char_u *s, int flags));
/*
* When "flags" has GREG_LIST return a list with text "s".
* Otherwise just return "s".
*/
static char_u *
getreg_wrap_one_line(s, flags)
char_u *s;
int flags;
{
if (flags & GREG_LIST)
{
list_T *list = list_alloc();
if (list != NULL)
{
if (list_append_string(list, NULL, -1) == FAIL)
{
list_free(list, TRUE);
return NULL;
}
list->lv_first->li_tv.vval.v_string = s;
}
return (char_u *)list;
}
return s;
}
/*
* Return the contents of a register as a single allocated string.
* Used for "@r" in expressions and for getreg().
* Returns NULL for error.
* Flags:
* GREG_NO_EXPR Do not allow expression register
* GREG_EXPR_SRC For the expression register: return expression itself,
* not the result of its evaluation.
* GREG_LIST Return a list of lines in place of a single string.
*/
char_u *
get_reg_contents(regname, allowexpr, expr_src)
get_reg_contents(regname, flags)
int regname;
int allowexpr; /* allow "=" register */
int expr_src; /* get expression for "=" register */
int flags;
{
long i;
char_u *retval;
@@ -6185,13 +6218,11 @@ get_reg_contents(regname, allowexpr, expr_src)
/* Don't allow using an expression register inside an expression */
if (regname == '=')
{
if (allowexpr)
{
if (expr_src)
return get_expr_line_src();
return get_expr_line();
}
return NULL;
if (flags & GREG_NO_EXPR)
return NULL;
if (flags & GREG_EXPR_SRC)
return getreg_wrap_one_line(get_expr_line_src(), flags);
return getreg_wrap_one_line(get_expr_line(), flags);
}
if (regname == '@') /* "@@" is used for unnamed register */
@@ -6209,15 +6240,33 @@ get_reg_contents(regname, allowexpr, expr_src)
{
if (retval == NULL)
return NULL;
if (!allocated)
retval = vim_strsave(retval);
return retval;
if (allocated)
return getreg_wrap_one_line(retval, flags);
return getreg_wrap_one_line(vim_strsave(retval), flags);
}
get_yank_register(regname, FALSE);
if (y_current->y_array == NULL)
return NULL;
if (flags & GREG_LIST)
{
list_T *list = list_alloc();
int error = FALSE;
if (list == NULL)
return NULL;
for (i = 0; i < y_current->y_size; ++i)
if (list_append_string(list, y_current->y_array[i], -1) == FAIL)
error = TRUE;
if (error)
{
list_free(list, TRUE);
return NULL;
}
return (char_u *)list;
}
/*
* Compute length of resulting string.
*/
@@ -6259,6 +6308,47 @@ get_reg_contents(regname, allowexpr, expr_src)
return retval;
}
static int
init_write_reg(name, old_y_previous, old_y_current, must_append, yank_type)
int name;
struct yankreg **old_y_previous;
struct yankreg **old_y_current;
int must_append;
int *yank_type UNUSED;
{
if (!valid_yank_reg(name, TRUE)) /* check for valid reg name */
{
emsg_invreg(name);
return FAIL;
}
/* Don't want to change the current (unnamed) register */
*old_y_previous = y_previous;
*old_y_current = y_current;
get_yank_register(name, TRUE);
if (!y_append && !must_append)
free_yank_all();
return OK;
}
static void
finish_write_reg(name, old_y_previous, old_y_current)
int name;
struct yankreg *old_y_previous;
struct yankreg *old_y_current;
{
# ifdef FEAT_CLIPBOARD
/* Send text of clipboard register to the clipboard. */
may_set_selection();
# endif
/* ':let @" = "val"' should change the meaning of the "" register */
if (name != '"')
y_previous = old_y_previous;
y_current = old_y_current;
}
/*
* Store string "str" in register "name".
* "maxlen" is the maximum number of bytes to use, -1 for all bytes.
@@ -6278,6 +6368,51 @@ write_reg_contents(name, str, maxlen, must_append)
write_reg_contents_ex(name, str, maxlen, must_append, MAUTO, 0L);
}
void
write_reg_contents_lst(name, strings, maxlen, must_append, yank_type, block_len)
int name;
char_u **strings;
int maxlen UNUSED;
int must_append;
int yank_type;
long block_len;
{
struct yankreg *old_y_previous, *old_y_current;
if (name == '/'
#ifdef FEAT_EVAL
|| name == '='
#endif
)
{
char_u *s;
if (strings[0] == NULL)
s = (char_u *)"";
else if (strings[1] != NULL)
{
EMSG(_("E883: search pattern and expression register may not "
"contain two or more lines"));
return;
}
else
s = strings[0];
write_reg_contents_ex(name, s, -1, must_append, yank_type, block_len);
return;
}
if (name == '_') /* black hole: nothing to do */
return;
if (init_write_reg(name, &old_y_previous, &old_y_current, must_append,
&yank_type) == FAIL)
return;
str_to_reg(y_current, yank_type, (char_u *) strings, -1, block_len, TRUE);
finish_write_reg(name, old_y_previous, old_y_current);
}
void
write_reg_contents_ex(name, str, maxlen, must_append, yank_type, block_len)
int name;
@@ -6315,40 +6450,22 @@ write_reg_contents_ex(name, str, maxlen, must_append, yank_type, block_len)
s = concat_str(get_expr_line_src(), p);
vim_free(p);
p = s;
}
set_expr_line(p);
return;
}
#endif
if (!valid_yank_reg(name, TRUE)) /* check for valid reg name */
{
emsg_invreg(name);
return;
}
if (name == '_') /* black hole: nothing to do */
return;
/* Don't want to change the current (unnamed) register */
old_y_previous = y_previous;
old_y_current = y_current;
if (init_write_reg(name, &old_y_previous, &old_y_current, must_append,
&yank_type) == FAIL)
return;
get_yank_register(name, TRUE);
if (!y_append && !must_append)
free_yank_all();
str_to_reg(y_current, yank_type, str, len, block_len);
str_to_reg(y_current, yank_type, str, len, block_len, FALSE);
# ifdef FEAT_CLIPBOARD
/* Send text of clipboard register to the clipboard. */
may_set_selection();
# endif
/* ':let @" = "val"' should change the meaning of the "" register */
if (name != '"')
y_previous = old_y_previous;
y_current = old_y_current;
finish_write_reg(name, old_y_previous, old_y_current);
}
#endif /* FEAT_EVAL */
@@ -6358,12 +6475,13 @@ write_reg_contents_ex(name, str, maxlen, must_append, yank_type, block_len)
* is appended.
*/
static void
str_to_reg(y_ptr, yank_type, str, len, blocklen)
str_to_reg(y_ptr, yank_type, str, len, blocklen, str_list)
struct yankreg *y_ptr; /* pointer to yank register */
int yank_type; /* MCHAR, MLINE, MBLOCK, MAUTO */
char_u *str; /* string to put in register */
long len; /* length of string */
long blocklen; /* width of Visual block */
int str_list; /* TRUE if str is char_u ** */
{
int type; /* MCHAR, MLINE or MBLOCK */
int lnum;
@@ -6374,6 +6492,7 @@ str_to_reg(y_ptr, yank_type, str, len, blocklen)
int extraline = 0; /* extra line at the end */
int append = FALSE; /* append to last line in register */
char_u *s;
char_u **ss;
char_u **pp;
long maxlen;
@@ -6381,7 +6500,8 @@ str_to_reg(y_ptr, yank_type, str, len, blocklen)
y_ptr->y_size = 0;
if (yank_type == MAUTO)
type = ((len > 0 && (str[len - 1] == NL || str[len - 1] == CAR))
type = ((str_list || (len > 0 && (str[len - 1] == NL
|| str[len - 1] == CAR)))
? MLINE : MCHAR);
else
type = yank_type;
@@ -6390,18 +6510,26 @@ str_to_reg(y_ptr, yank_type, str, len, blocklen)
* Count the number of lines within the string
*/
newlines = 0;
for (i = 0; i < len; i++)
if (str[i] == '\n')
if (str_list)
{
for (ss = (char_u **) str; *ss != NULL; ++ss)
++newlines;
if (type == MCHAR || len == 0 || str[len - 1] != '\n')
{
extraline = 1;
++newlines; /* count extra newline at the end */
}
if (y_ptr->y_size > 0 && y_ptr->y_type == MCHAR)
else
{
append = TRUE;
--newlines; /* uncount newline when appending first line */
for (i = 0; i < len; i++)
if (str[i] == '\n')
++newlines;
if (type == MCHAR || len == 0 || str[len - 1] != '\n')
{
extraline = 1;
++newlines; /* count extra newline at the end */
}
if (y_ptr->y_size > 0 && y_ptr->y_type == MCHAR)
{
append = TRUE;
--newlines; /* uncount newline when appending first line */
}
}
/*
@@ -6421,40 +6549,53 @@ str_to_reg(y_ptr, yank_type, str, len, blocklen)
/*
* Find the end of each line and save it into the array.
*/
for (start = 0; start < len + extraline; start += i + 1)
if (str_list)
{
for (i = start; i < len; ++i) /* find the end of the line */
if (str[i] == '\n')
for (ss = (char_u **) str; *ss != NULL; ++ss, ++lnum)
{
i = STRLEN(*ss);
pp[lnum] = vim_strnsave(*ss, i);
if (i > maxlen)
maxlen = i;
}
}
else
{
for (start = 0; start < len + extraline; start += i + 1)
{
for (i = start; i < len; ++i) /* find the end of the line */
if (str[i] == '\n')
break;
i -= start; /* i is now length of line */
if (i > maxlen)
maxlen = i;
if (append)
{
--lnum;
extra = (int)STRLEN(y_ptr->y_array[lnum]);
}
else
extra = 0;
s = alloc((unsigned)(i + extra + 1));
if (s == NULL)
break;
i -= start; /* i is now length of line */
if (i > maxlen)
maxlen = i;
if (append)
{
--lnum;
extra = (int)STRLEN(y_ptr->y_array[lnum]);
if (extra)
mch_memmove(s, y_ptr->y_array[lnum], (size_t)extra);
if (append)
vim_free(y_ptr->y_array[lnum]);
if (i)
mch_memmove(s + extra, str + start, (size_t)i);
extra += i;
s[extra] = NUL;
y_ptr->y_array[lnum++] = s;
while (--extra >= 0)
{
if (*s == NUL)
*s = '\n'; /* replace NUL with newline */
++s;
}
append = FALSE; /* only first line is appended */
}
else
extra = 0;
s = alloc((unsigned)(i + extra + 1));
if (s == NULL)
break;
if (extra)
mch_memmove(s, y_ptr->y_array[lnum], (size_t)extra);
if (append)
vim_free(y_ptr->y_array[lnum]);
if (i)
mch_memmove(s + extra, str + start, (size_t)i);
extra += i;
s[extra] = NUL;
y_ptr->y_array[lnum++] = s;
while (--extra >= 0)
{
if (*s == NUL)
*s = '\n'; /* replace NUL with newline */
++s;
}
append = FALSE; /* only first line is appended */
}
y_ptr->y_type = type;
y_ptr->y_size = lnum;

View File

@@ -2815,7 +2815,7 @@ mch_copy_sec(from_file, to_file)
char_u *from_file;
char_u *to_file;
{
static const char const *smack_copied_attributes[] =
static const char * const smack_copied_attributes[] =
{
XATTR_NAME_SMACK,
XATTR_NAME_SMACKEXEC,
@@ -2875,14 +2875,8 @@ mch_copy_sec(from_file, to_file)
case ENODATA:
/* no attribute of this name */
ret = removexattr((char*)to_file, name);
if (ret < 0 && errno != ENODATA)
{
MSG_PUTS(_("Could not remove security context "));
MSG_PUTS(name);
MSG_PUTS(_(" for "));
msg_outtrans(to_file);
msg_putchar('\n');
}
/* Silently ignore errors, apparently this happens when
* smack is not actually being used. */
break;
}
}

View File

@@ -100,7 +100,7 @@ int unix_expandpath __ARGS((garray_T *gap, char_u *path, int wildoff, int flags,
void remove_duplicates __ARGS((garray_T *gap));
int gen_expand_wildcards __ARGS((int num_pat, char_u **pat, int *num_file, char_u ***file, int flags));
void addfile __ARGS((garray_T *gap, char_u *f, int flags));
char_u *get_cmd_output __ARGS((char_u *cmd, char_u *infile, int flags));
char_u *get_cmd_output __ARGS((char_u *cmd, char_u *infile, int flags, int *ret_len));
void FreeWild __ARGS((int count, char_u **files));
int goto_im __ARGS((void));
/* vim: set ft=c : */

View File

@@ -53,9 +53,10 @@ void clip_yank_selection __ARGS((int type, char_u *str, long len, VimClipboard *
int clip_convert_selection __ARGS((char_u **str, long_u *len, VimClipboard *cbd));
void dnd_yank_drag_data __ARGS((char_u *str, long len));
char_u get_reg_type __ARGS((int regname, long *reglen));
char_u *get_reg_contents __ARGS((int regname, int allowexpr, int expr_src));
char_u *get_reg_contents __ARGS((int regname, int flags));
void write_reg_contents __ARGS((int name, char_u *str, int maxlen, int must_append));
void write_reg_contents_ex __ARGS((int name, char_u *str, int maxlen, int must_append, int yank_type, long block_len));
void write_reg_contents_lst __ARGS((int name, char_u **strings, int maxlen, int must_append, int yank_type, long block_len));
void clear_oparg __ARGS((oparg_T *oap));
void cursor_pos_info __ARGS((void));
/* vim: set ft=c : */

View File

@@ -10,6 +10,7 @@ char_u *regtilde __ARGS((char_u *source, int magic));
int vim_regsub __ARGS((regmatch_T *rmp, char_u *source, char_u *dest, int copy, int magic, int backslash));
int vim_regsub_multi __ARGS((regmmatch_T *rmp, linenr_T lnum, char_u *source, char_u *dest, int copy, int magic, int backslash));
char_u *reg_submatch __ARGS((int no));
list_T *reg_submatch_list __ARGS((int no));
regprog_T *vim_regcomp __ARGS((char_u *expr_arg, int re_flags));
void vim_regfree __ARGS((regprog_T *prog));
int vim_regexec __ARGS((regmatch_T *rmp, char_u *line, colnr_T col));

View File

@@ -4146,7 +4146,8 @@ regtry(prog, col)
{
/* Only accept single line matches. */
if (reg_startzpos[i].lnum >= 0
&& reg_endzpos[i].lnum == reg_startzpos[i].lnum)
&& reg_endzpos[i].lnum == reg_startzpos[i].lnum
&& reg_endzpos[i].col >= reg_startzpos[i].col)
re_extmatch_out->matches[i] =
vim_strnsave(reg_getline(reg_startzpos[i].lnum)
+ reg_startzpos[i].col,
@@ -7380,6 +7381,7 @@ vim_regsub(rmp, source, dest, copy, magic, backslash)
reg_mmatch = NULL;
reg_maxline = 0;
reg_buf = curbuf;
reg_line_lbr = TRUE;
return vim_regsub_both(source, dest, copy, magic, backslash);
}
#endif
@@ -7399,6 +7401,7 @@ vim_regsub_multi(rmp, lnum, source, dest, copy, magic, backslash)
reg_buf = curbuf; /* always works on the current buffer! */
reg_firstlnum = lnum;
reg_maxline = curbuf->b_ml.ml_line_count - lnum;
reg_line_lbr = FALSE;
return vim_regsub_both(source, dest, copy, magic, backslash);
}
@@ -7897,6 +7900,85 @@ reg_submatch(no)
return retval;
}
/*
* Used for the submatch() function with the optional non-zero argument: get
* the list of strings from the n'th submatch in allocated memory with NULs
* represented in NLs.
* Returns a list of allocated strings. Returns NULL when not in a ":s"
* command, for a non-existing submatch and for any error.
*/
list_T *
reg_submatch_list(no)
int no;
{
char_u *s;
linenr_T slnum;
linenr_T elnum;
colnr_T scol;
colnr_T ecol;
int i;
list_T *list;
int error = FALSE;
if (!can_f_submatch || no < 0)
return NULL;
if (submatch_match == NULL)
{
slnum = submatch_mmatch->startpos[no].lnum;
elnum = submatch_mmatch->endpos[no].lnum;
if (slnum < 0 || elnum < 0)
return NULL;
scol = submatch_mmatch->startpos[no].col;
ecol = submatch_mmatch->endpos[no].col;
list = list_alloc();
if (list == NULL)
return NULL;
s = reg_getline_submatch(slnum) + scol;
if (slnum == elnum)
{
if (list_append_string(list, s, ecol - scol) == FAIL)
error = TRUE;
}
else
{
if (list_append_string(list, s, -1) == FAIL)
error = TRUE;
for (i = 1; i < elnum - slnum; i++)
{
s = reg_getline_submatch(slnum + i);
if (list_append_string(list, s, -1) == FAIL)
error = TRUE;
}
s = reg_getline_submatch(elnum);
if (list_append_string(list, s, ecol) == FAIL)
error = TRUE;
}
}
else
{
s = submatch_match->startp[no];
if (s == NULL || submatch_match->endp[no] == NULL)
return NULL;
list = list_alloc();
if (list == NULL)
return NULL;
if (list_append_string(list, s,
(int)(submatch_match->endp[no] - s)) == FAIL)
error = TRUE;
}
if (error)
{
list_free(list, TRUE);
return NULL;
}
return list;
}
#endif
static regengine_T bt_regengine =

View File

@@ -6781,8 +6781,10 @@ nfa_regtry(prog, col)
{
struct multipos *mpos = &subs.synt.list.multi[i];
/* Only accept single line matches. */
if (mpos->start.lnum >= 0 && mpos->start.lnum == mpos->end.lnum)
/* Only accept single line matches that are valid. */
if (mpos->start.lnum >= 0
&& mpos->start.lnum == mpos->end.lnum
&& mpos->end.col >= mpos->start.col)
re_extmatch_out->matches[i] =
vim_strnsave(reg_getline(mpos->start.lnum)
+ mpos->start.col,

View File

@@ -741,8 +741,10 @@ do_tag(tag, type, count, forceit, verbose)
break;
msg_advance(15);
/* skip backslash used for escaping command char */
if (*p == '\\' && *(p + 1) == *tagp.command)
/* skip backslash used for escaping a command char or
* a backslash */
if (*p == '\\' && (*(p + 1) == *tagp.command
|| *(p + 1) == '\\'))
++p;
if (*p == TAB)

View File

@@ -36,6 +36,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
test94.out test95.out test96.out test97.out test98.out \
test99.out test100.out test101.out test102.out test103.out \
test104.out test105.out test106.out \
test_eval.out \
test_options.out
.SUFFIXES: .in .out
@@ -159,4 +160,5 @@ test103.out: test103.in
test104.out: test104.in
test105.out: test105.in
test106.out: test106.in
test_eval.out: test_eval.in
test_options.out: test_options.in

View File

@@ -35,6 +35,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
test94.out test95.out test96.out test98.out test99.out \
test100.out test101.out test102.out test103.out test104.out \
test105.out test106.out \
test_eval.out \
test_options.out
SCRIPTS32 = test50.out test70.out

View File

@@ -55,6 +55,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
test94.out test95.out test96.out test98.out test99.out \
test100.out test101.out test102.out test103.out test104.out \
test105.out test106.out \
test_eval.out \
test_options.out
SCRIPTS32 = test50.out test70.out

View File

@@ -37,6 +37,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
test94.out test95.out test96.out test98.out test99.out \
test100.out test101.out test102.out test103.out test104.out \
test105.out test106.out \
test_eval.out \
test_options.out
.SUFFIXES: .in .out

View File

@@ -96,6 +96,7 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \
test95.out test96.out test98.out test99.out \
test100.out test101.out test103.out test104.out \
test105.out test106.out \
test_eval.out \
test_options.out
# Known problems:

Binary file not shown.

Binary file not shown.

View File

@@ -117,6 +117,7 @@ STARTTEST
:let y = substitute('jJj', 'J', '\=substitute(submatch(0), ".", "\\n", "")', '') | $put =y
:let y = substitute('kKk', 'K', '\=substitute(submatch(0), ".", "\r", "")', '') | $put =y
:let y = substitute('lLl', 'L', '\=substitute(submatch(0), ".", "\n", "")', '') | $put =y
/^TEST_5
ENDTEST
TEST_5:
@@ -142,6 +143,7 @@ STARTTEST
:$put =substitute('C', 'C', 'c', '')
:$put =substitute('D', 'D', '%', '')
/^TEST_7
ENDTEST
TEST_7:

View File

@@ -90,6 +90,7 @@ l
a\a
b\b
c
c
d
d
e\
@@ -103,6 +104,8 @@ TEST_7:
l
l
TEST_5:
A123456789987654321
[['A123456789'], ['9'], ['8'], ['7'], ['6'], ['5'], ['4'], ['3'], ['2'], ['1']]

170
src/testdir/test_eval.in Normal file
View File

@@ -0,0 +1,170 @@
Test for various eval features. vim: set ft=vim :
Note: system clipboard support is not tested. I do not think anybody will thank
me for messing with clipboard.
STARTTEST
:so small.vim
:set encoding=latin1
:set noswapfile
:lang C
:fun AppendRegContents(reg)
call append('$', printf('%s: type %s; value: %s (%s), expr: %s (%s)', a:reg, getregtype(a:reg), getreg(a:reg), string(getreg(a:reg, 0, 1)), getreg(a:reg, 1), string(getreg(a:reg, 1, 1))))
endfun
:command -nargs=? AR :call AppendRegContents(<q-args>)
:fun SetReg(...)
call call('setreg', a:000)
call append('$', printf('{{{2 setreg(%s)', string(a:000)[1:-2]))
call AppendRegContents(a:1)
if a:1 isnot# '='
execute "silent normal! Go==\n==\e\"".a:1."P"
endif
endfun
:fun ErrExe(str)
call append('$', 'Executing '.a:str)
try
execute a:str
catch
$put =v:exception
endtry
endfun
:fun Test()
$put ='{{{1 let tests'
let @" = 'abc'
AR "
let @" = "abc\n"
AR "
let @" = "abc\<C-m>"
AR "
let @= = '"abc"'
AR =
$put ='{{{1 Basic setreg tests'
call SetReg('a', 'abcA', 'c')
call SetReg('b', 'abcB', 'v')
call SetReg('c', 'abcC', 'l')
call SetReg('d', 'abcD', 'V')
call SetReg('e', 'abcE', 'b')
call SetReg('f', 'abcF', "\<C-v>")
call SetReg('g', 'abcG', 'b10')
call SetReg('h', 'abcH', "\<C-v>10")
call SetReg('I', 'abcI')
$put ='{{{1 Appending single lines with setreg()'
call SetReg('A', 'abcAc', 'c')
call SetReg('A', 'abcAl', 'l')
call SetReg('A', 'abcAc2','c')
call SetReg('b', 'abcBc', 'ca')
call SetReg('b', 'abcBb', 'ba')
call SetReg('b', 'abcBc2','ca')
call SetReg('b', 'abcBb2','b50a')
call SetReg('C', 'abcCl', 'l')
call SetReg('C', 'abcCc', 'c')
call SetReg('D', 'abcDb', 'b')
call SetReg('E', 'abcEb', 'b')
call SetReg('E', 'abcEl', 'l')
call SetReg('F', 'abcFc', 'c')
$put ='{{{1 Appending NL with setreg()'
call setreg('a', 'abcA2', 'c')
call setreg('b', 'abcB2', 'v')
call setreg('c', 'abcC2', 'l')
call setreg('d', 'abcD2', 'V')
call setreg('e', 'abcE2', 'b')
call setreg('f', 'abcF2', "\<C-v>")
call setreg('g', 'abcG2', 'b10')
call setreg('h', 'abcH2', "\<C-v>10")
call setreg('I', 'abcI2')
call SetReg('A', "\n")
call SetReg('B', "\n", 'c')
call SetReg('C', "\n")
call SetReg('D', "\n", 'l')
call SetReg('E', "\n")
call SetReg('F', "\n", 'b')
$put ='{{{1 Setting lists with setreg()'
call SetReg('a', ['abcA3'], 'c')
call SetReg('b', ['abcB3'], 'l')
call SetReg('c', ['abcC3'], 'b')
call SetReg('d', ['abcD3'])
call SetReg('e', [1, 2, 'abc', 3])
call SetReg('f', [1, 2, 3])
$put ='{{{1 Appending lists with setreg()'
call SetReg('A', ['abcA3c'], 'c')
call SetReg('b', ['abcB3l'], 'la')
call SetReg('C', ['abcC3b'], 'lb')
call SetReg('D', ['abcD32'])
call SetReg('A', ['abcA32'])
call SetReg('B', ['abcB3c'], 'c')
call SetReg('C', ['abcC3l'], 'l')
call SetReg('D', ['abcD3b'], 'b')
$put ='{{{1 Appending lists with NL with setreg()'
call SetReg('A', ["\n", 'abcA3l2'], 'l')
call SetReg('B', ["\n", 'abcB3c2'], 'c')
call SetReg('C', ["\n", 'abcC3b2'], 'b')
call SetReg('D', ["\n", 'abcD3b50'],'b50')
$put ='{{{1 Setting lists with NLs with setreg()'
call SetReg('a', ['abcA4-0', "\n", "abcA4-2\n", "\nabcA4-3", "abcA4-4\nabcA4-4-2"])
call SetReg('b', ['abcB4c-0', "\n", "abcB4c-2\n", "\nabcB4c-3", "abcB4c-4\nabcB4c-4-2"], 'c')
call SetReg('c', ['abcC4l-0', "\n", "abcC4l-2\n", "\nabcC4l-3", "abcC4l-4\nabcC4l-4-2"], 'l')
call SetReg('d', ['abcD4b-0', "\n", "abcD4b-2\n", "\nabcD4b-3", "abcD4b-4\nabcD4b-4-2"], 'b')
call SetReg('e', ['abcE4b10-0', "\n", "abcE4b10-2\n", "\nabcE4b10-3", "abcE4b10-4\nabcE4b10-4-2"], 'b10')
$put ='{{{1 Search and expressions'
call SetReg('/', ['abc/'])
call SetReg('/', ["abc/\n"])
call SetReg('=', ['"abc/"'])
call SetReg('=', ["\"abc/\n\""])
$put ='{{{1 Errors'
call ErrExe('call setreg()')
call ErrExe('call setreg(1)')
call ErrExe('call setreg(1, 2, 3, 4)')
call ErrExe('call setreg([], 2)')
call ErrExe('call setreg(1, {})')
call ErrExe('call setreg(1, 2, [])')
call ErrExe('call setreg("/", ["1", "2"])')
call ErrExe('call setreg("=", ["1", "2"])')
call ErrExe('call setreg(1, ["", "", [], ""])')
endfun
:"
:call Test()
:"
:delfunction SetReg
:delfunction AppendRegContents
:delfunction ErrExe
:delfunction Test
:delcommand AR
:call garbagecollect(1)
:"
:" function name includes a colon
:try
:func! g:test()
:echo "test"
:endfunc
:catch
:$put =v:exception
:endtry
:"
:" function name folowed by #
:try
:func! test2() "#
:echo "test2"
:endfunc
:catch
:$put =v:exception
:endtry
:"
:/^start:/+1,$wq! test.out
:" vim: et ts=4 isk-=\: fmr=???,???
:call getchar()
ENDTEST
start:

BIN
src/testdir/test_eval.ok Normal file

Binary file not shown.

View File

@@ -734,6 +734,50 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
261,
/**/
260,
/**/
259,
/**/
258,
/**/
257,
/**/
256,
/**/
255,
/**/
254,
/**/
253,
/**/
252,
/**/
251,
/**/
250,
/**/
249,
/**/
248,
/**/
247,
/**/
246,
/**/
245,
/**/
244,
/**/
243,
/**/
242,
/**/
241,
/**/
240,
/**/
239,
/**/

View File

@@ -2259,6 +2259,11 @@ typedef int VimClipboard; /* This is required for the prototypes. */
#define SREQ_WIN 1 /* Request window-local option */
#define SREQ_BUF 2 /* Request buffer-local option */
/* Flags for get_reg_contents */
#define GREG_NO_EXPR 1 /* Do not allow expression register */
#define GREG_EXPR_SRC 2 /* Return expression itself for "=" register */
#define GREG_LIST 4 /* Return list */
/* Character used as separated in autoload function/variable names. */
#define AUTOLOAD_CHAR '#'