Merge remote-tracking branch 'vim/master'

This commit is contained in:
Kazuki Sakamoto
2016-07-09 21:25:37 -07:00
40 changed files with 784 additions and 312 deletions
+6 -2
View File
@@ -1,4 +1,4 @@
*channel.txt* For Vim version 7.4. Last change: 2016 Jun 02
*channel.txt* For Vim version 7.4. Last change: 2016 Jul 07
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -495,6 +495,9 @@ time a line is added to the buffer, the last-but-one line will be send to the
job stdin. This allows for editing the last line and sending it when pressing
Enter.
NUL bytes in the text will be passed to the job (internally Vim stores these
as NL bytes).
Reading job output in the close callback ~
*read-in-close-cb*
@@ -684,7 +687,8 @@ When the buffer written to is displayed in a window and the cursor is in the
first column of the last line, the cursor will be moved to the newly added
line and the window is scrolled up to show the cursor if needed.
Undo is synced for every added line.
Undo is synced for every added line. NUL bytes are accepted (internally Vim
stores these as NL bytes).
Writing to a file ~
+73 -13
View File
@@ -1,4 +1,4 @@
*eval.txt* For Vim version 7.4. Last change: 2016 Jul 06
*eval.txt* For Vim version 7.4. Last change: 2016 Jul 09
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1961,9 +1961,9 @@ diff_hlID({lnum}, {col}) Number diff highlighting at {lnum}/{col}
empty({expr}) Number |TRUE| if {expr} is empty
escape({string}, {chars}) String escape {chars} in {string} with '\'
eval({string}) any evaluate {string} into its value
evalcmd({command}) String execute {command} and get the output
eventhandler() Number |TRUE| if inside an event handler
executable({expr}) Number 1 if executable {expr} exists
execute({command}) String execute {command} and get the output
exepath({expr}) String full path of the command {expr}
exists({expr}) Number |TRUE| if {expr} exists
extend({expr1}, {expr2} [, {expr3}])
@@ -2008,6 +2008,7 @@ getcmdline() String return the current command-line
getcmdpos() Number return cursor position in command-line
getcmdtype() String return current command-line type
getcmdwintype() String return current command-line window type
getcompletion({pat}, {type}) List list of cmdline completion matches
getcurpos() List position of the cursor
getcwd([{winnr} [, {tabnr}]]) String get the current working directory
getfontname([{name}]) String name of font being used
@@ -3232,15 +3233,6 @@ eval({string}) Evaluate {string} and return the result. Especially useful to
them. Also works for |Funcref|s that refer to existing
functions.
evalcmd({command}) *evalcmd()*
Execute Ex {command} and return the output as a string. This
is equivalent to: >
redir => var
{command}
redir END
< To get a list of lines use: >
split(evalcmd(cmd), "\n")
eventhandler() *eventhandler()*
Returns 1 when inside an event handler. That is that Vim got
interrupted while waiting for the user to type a character,
@@ -3271,6 +3263,31 @@ executable({expr}) *executable()*
0 does not exist
-1 not implemented on this system
execute({command} [, {silent}]) *execute()*
Execute an Ex command or commands and return the output as a
string.
{command} can be a string or a List. In case of a List the
lines are executed one by one.
This is equivalent to: >
redir => var
{command}
redir END
<
The optional {silent} argument can have these values:
"" no `:silent` used
"silent" `:silent` used
"silent!" `:silent!` used
The default is 'silent'. Note that with "silent!", unlike
`:redir`, error messages are dropped.
*E930*
It is not possible to use `:redir` anywhere in {command}.
To get a list of lines use |split()| on the result: >
split(execute('args'), "\n")
< When used recursively the output of the recursive call is not
included in the output of the higher level call.
exepath({expr}) *exepath()*
If {expr} is an executable and is either an absolute path, a
relative path or found in $PATH, return the full path.
@@ -4028,6 +4045,49 @@ getcmdwintype() *getcmdwintype()*
values are the same as |getcmdtype()|. Returns an empty string
when not in the command-line window.
getcompletion({pat}, {type}) *getcompletion()*
Return a list of command-line completion matches. {type}
specifies what for. The following completion types are
supported:
augroup autocmd groups
buffer buffer names
behave :behave suboptions
color color schemes
command Ex command (and arguments)
compiler compilers
cscope |:cscope| suboptions
dir directory names
environment environment variable names
event autocommand events
expression Vim expression
file file and directory names
file_in_path file and directory names in |'path'|
filetype filetype names |'filetype'|
function function name
help help subjects
highlight highlight groups
history :history suboptions
locale locale names (as output of locale -a)
mapping mapping name
menu menus
option options
shellcmd Shell command
sign |:sign| suboptions
syntax syntax file names |'syntax'|
syntime |:syntime| suboptions
tag tags
tag_listfiles tags, file names
user user names
var user variables
If {pat} is an empty string, then all the matches are returned.
Otherwise only items matching {pat} are returned. See
|wildcards| for the use of special characters in {pat}.
If there are no matches, an empty list is returned. An
invalid value for {type} produces an error.
*getcurpos()*
getcurpos() Get the position of the cursor. This is like getpos('.'), but
includes an extra item in the list:
@@ -7046,9 +7106,9 @@ synID({lnum}, {col}, {trans}) *synID()*
that's where the cursor can be in Insert mode, synID() returns
zero.
When {trans} is non-zero, transparent items are reduced to the
When {trans} is |TRUE|, transparent items are reduced to the
item that they reveal. This is useful when wanting to know
the effective color. When {trans} is zero, the transparent
the effective color. When {trans} is |FALSE|, the transparent
item is returned. This is useful when wanting to know which
syntax item is effective (e.g. inside parens).
Warning: This function can be very slow. Best speed is
+2
View File
@@ -1139,6 +1139,7 @@ tag command action ~
|:caddfile| :caddf[ile] add error message to current quickfix list
|:call| :cal[l] call a function
|:catch| :cat[ch] part of a :try command
|:cbottom| :cbo[ttom] scroll to the bottom of the quickfix window
|:cbuffer| :cb[uffer] parse error messages and jump to first error
|:cc| :cc go to specific error
|:cclose| :ccl[ose] close quickfix window
@@ -1299,6 +1300,7 @@ tag command action ~
|:last| :la[st] go to the last file in the argument list
|:language| :lan[guage] set the language (locale)
|:later| :lat[er] go to newer change, redo
|:lbottom| :lbo[ttom] scroll to the bottom of the location window
|:lbuffer| :lb[uffer] parse locations and jump to first location
|:lcd| :lc[d] change directory locally
|:lchdir| :lch[dir] change directory locally
+2 -1
View File
@@ -1,4 +1,4 @@
*map.txt* For Vim version 7.4. Last change: 2016 Jun 10
*map.txt* For Vim version 7.4. Last change: 2016 Jul 06
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1274,6 +1274,7 @@ completion can be enabled:
-complete=mapping mapping name
-complete=menu menus
-complete=option options
-complete=packadd optional package |pack-add| names
-complete=shellcmd Shell command
-complete=sign |:sign| suboptions
-complete=syntax syntax file names |'syntax'|
+5 -5
View File
@@ -1,4 +1,4 @@
*options.txt* For Vim version 7.4. Last change: 2016 Jul 01
*options.txt* For Vim version 7.4. Last change: 2016 Jul 09
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -8334,10 +8334,10 @@ A jump table for the options with a short description can be found at |Q_op|.
has been used since the last search command.
*viminfo-n*
n Name of the viminfo file. The name must immediately follow
the 'n'. Must be the last one! If the "-i" argument was
given when starting Vim, that file name overrides the one
given here with 'viminfo'. Environment variables are expanded
when opening the file, not when setting the option.
the 'n'. Must be at the end of the option! If the "-i"
argument was given when starting Vim, that file name overrides
the one given here with 'viminfo'. Environment variables are
expanded when opening the file, not when setting the option.
*viminfo-r*
r Removable media. The argument is a string (up to the next
','). This parameter can be given several times. Each
+6 -1
View File
@@ -1,4 +1,4 @@
*quickfix.txt* For Vim version 7.4. Last change: 2016 Jul 02
*quickfix.txt* For Vim version 7.4. Last change: 2016 Jul 07
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -437,12 +437,17 @@ EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST:
:lw[indow] [height] Same as ":cwindow", except use the window showing the
location list for the current window.
*:cbo* *:cbottom*
:cbo[ttom] Put the cursor in the last line of the quickfix window
and scroll to make it visible. This is useful for
when errors are added by an asynchronous callback.
Only call it once in a while if there are many
updates to avoid a lot of redrawing.
*:lbo* *:lbottom*
:lbo[ttom] Same as ":cbottom", except use the window showing the
location list for the current window.
Normally the quickfix window is at the bottom of the screen. If there are
vertical splits, it's at the bottom of the rightmost column of windows. To
make it always occupy the full width: >
+2 -1
View File
@@ -1,4 +1,4 @@
*starting.txt* For Vim version 7.4. Last change: 2016 Jun 15
*starting.txt* For Vim version 7.4. Last change: 2016 Jul 03
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1427,6 +1427,7 @@ Now the viminfo will have:
BBB - value from session B
BOTH - value from session B, value from session A is lost
*viminfo-timestamp*
For some items a timestamp is used to keep the last changed version. Here it
doesn't matter in which sequence Vim sessions exit, the newest item(s) are
always kept. This is used for:
+10
View File
@@ -2060,6 +2060,8 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
:cat eval.txt /*:cat*
:catch eval.txt /*:catch*
:cb quickfix.txt /*:cb*
:cbo quickfix.txt /*:cbo*
:cbottom quickfix.txt /*:cbottom*
:cbuffer quickfix.txt /*:cbuffer*
:cc quickfix.txt /*:cc*
:ccl quickfix.txt /*:ccl*
@@ -2412,6 +2414,8 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
:lat undo.txt /*:lat*
:later undo.txt /*:later*
:lb quickfix.txt /*:lb*
:lbo quickfix.txt /*:lbo*
:lbottom quickfix.txt /*:lbottom*
:lbuffer quickfix.txt /*:lbuffer*
:lc editing.txt /*:lc*
:lcd editing.txt /*:lcd*
@@ -4506,6 +4510,7 @@ E927 eval.txt /*E927*
E928 eval.txt /*E928*
E929 starting.txt /*E929*
E93 windows.txt /*E93*
E930 eval.txt /*E930*
E94 windows.txt /*E94*
E95 message.txt /*E95*
E96 diff.txt /*E96*
@@ -4521,6 +4526,7 @@ Ex intro.txt /*Ex*
Ex-mode intro.txt /*Ex-mode*
Exuberant_ctags tagsrch.txt /*Exuberant_ctags*
F motion.txt /*F*
FALSE eval.txt /*FALSE*
FAQ intro.txt /*FAQ*
Farsi farsi.txt /*Farsi*
FileAppendCmd autocmd.txt /*FileAppendCmd*
@@ -4737,6 +4743,7 @@ TOhtml-encoding-detect syntax.txt /*TOhtml-encoding-detect*
TOhtml-performance syntax.txt /*TOhtml-performance*
TOhtml-uncopyable-text syntax.txt /*TOhtml-uncopyable-text*
TOhtml-wrap-text syntax.txt /*TOhtml-wrap-text*
TRUE eval.txt /*TRUE*
TSQL ft_sql.txt /*TSQL*
TTpro-telnet syntax.txt /*TTpro-telnet*
Tab intro.txt /*Tab*
@@ -5801,6 +5808,7 @@ exception-variable eval.txt /*exception-variable*
exclusive motion.txt /*exclusive*
exclusive-linewise motion.txt /*exclusive-linewise*
executable() eval.txt /*executable()*
execute() eval.txt /*execute()*
execute-menus gui.txt /*execute-menus*
exepath() eval.txt /*exepath()*
exim starting.txt /*exim*
@@ -6429,6 +6437,7 @@ getcmdline() eval.txt /*getcmdline()*
getcmdpos() eval.txt /*getcmdpos()*
getcmdtype() eval.txt /*getcmdtype()*
getcmdwintype() eval.txt /*getcmdwintype()*
getcompletion() eval.txt /*getcompletion()*
getcurpos() eval.txt /*getcurpos()*
getcwd() eval.txt /*getcwd()*
getfontname() eval.txt /*getfontname()*
@@ -9146,6 +9155,7 @@ viminfo-r options.txt /*viminfo-r*
viminfo-read starting.txt /*viminfo-read*
viminfo-read-write starting.txt /*viminfo-read-write*
viminfo-s options.txt /*viminfo-s*
viminfo-timestamp starting.txt /*viminfo-timestamp*
viminfo-write starting.txt /*viminfo-write*
vimrc starting.txt /*vimrc*
vimrc-filetype usr_05.txt /*vimrc-filetype*
+17 -29
View File
@@ -1,4 +1,4 @@
*todo.txt* For Vim version 7.4. Last change: 2016 Jul 02
*todo.txt* For Vim version 7.4. Last change: 2016 Jul 09
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -34,14 +34,10 @@ not be repeated below, unless there is extra information.
*known-bugs*
-------------------- Known bugs and current work -----------------------
Further implement 'barline' in viminfo:
- Use timestamp for more items: locations, marks.
Problem with setqflist([]): grep 4 times, ":colder 3", setqflist([]) will
clear the next list, not the current one. Ramel Eshed, Jun 8.
+channel:
- Should write_buf_line() change NL to NUL characters?
- GUI cursor blinking interrupted when the job output goes to a buffer that is
in a window. (Ramel Eshed, 2016 Jun 9)
- GUI cursor blinking interrupted when there is a status line. (Ramel Eshed,
@@ -61,17 +57,11 @@ Later
With xterm could use -S{pty}.
Quickfix improvements for background building and grepping:
Patch from Yegappan, 2016 Jun 17.
Need to reset values when starting a new list.
- If 'efm' is the same as last time re-use the fmt_first list.
- Do not clear "dir_stack", "directory" and "file_stack", "currfile" when
using ":addexpr".
Move multiline, multiignore, multiscan outside of the function.
- Add :cbottom, if quickfix window is visible scroll to make the last line
visible. Use scroll_cursor_bot(0, FALSE);
- Add a flag/property/option to quickfix commands and functions to keep a file
name as a string and not create a buffer for it? To avoid creating lots of
buffers. (Ramel Eshed)
- Add a command modifier ":usefname" to quickfix commands and functions to
keep a file name as a string and not create a buffer for it? To avoid
creating lots of buffers. (Ramel Eshed)
Store the relative file name and set a flag "qf_relative". Before changing
directory turn them into full paths.
Regexp problems:
- When using automatic engine selection there is a false match. Forcing
@@ -130,16 +120,18 @@ What if there is an invalid character?
Should json_encode()/json_decode() restrict recursiveness?
Or avoid recursiveness.
Patch to support 64 bit ints for Number. (Ken Takata, 2016 Jan 21)
Update 2016 Apr 24.
Update 2016 Jun 14, includes some tests.
Patch to support expression argument to sort() instead of a function name.
Yasuhiro Matsumoto, 2013 May 31.
Or should we add a more general mechanism, like a lambda() function?
Add a lambda() function.
Patch by Yasuhiro Matsumoto, 2014 Sep 16, update 2016 Apr 17.
Correction for test, Ken Takata, 2016 May 27.
Merged patch: Ken Takata, 2016 Jun 15.
Need to separate-out closure and lambda somehow.
Define lambda directly, not as a string: {v -> v * 8}
Lambda implementation by Ken Takata, 2016 Jul 7.
Python: Extended funcrefs: use func_T* structure in place of char_u* function
names.
(ZyX, 2013 Jul 15, update Sep 22, 24, 28; Update 2013 Dec 15, 2014 Jan 6)
Also fixes Bug: E685 error for func_unref(). (ZyX, 2010 Aug 5)
Once .exe with updated installer is available: Add remark to download page
about /S and /D options (Ken Takata, 2016 Apr 13)
@@ -161,7 +153,8 @@ For current Windows build .pdb file is missing. (Gabriele Fava, 2016 May 11)
5)
'completeopt' noinsert breaks redo register (Shougo, 2016 Jun 18, #874)
Patch to fix this: #875
Patch to fix this: #905.
There also is #875 to fix another problem?
Problem with whitespace in errorformat. (Gerd Wachsmuth, 2016 May 15, #807)
@@ -769,11 +762,6 @@ Patch by Thomas Tuegel, also for GTK, 2013 Nov 24
:help gives example for z?, but it does not work. m? and t? do work.
Python: Extended funcrefs: use func_T* structure in place of char_u* function
names.
(ZyX, 2013 Jul 15, update Sep 22, 24, 28; Update 2013 Dec 15, 2014 Jan 6)
Also fixes Bug: E685 error for func_unref(). (ZyX, 2010 Aug 5)
Patch to add funcref to Lua. (Luis Carvalho, 2013 Sep 4)
With tests: Sep 5.
+4 -2
View File
@@ -1,4 +1,4 @@
*usr_41.txt* For Vim version 7.4. Last change: 2016 Jun 13
*usr_41.txt* For Vim version 7.4. Last change: 2016 Jul 09
VIM USER MANUAL - by Bram Moolenaar
@@ -611,6 +611,7 @@ String manipulation: *string-functions*
byteidxcomp() like byteidx() but count composing characters
repeat() repeat a string multiple times
eval() evaluate a string expression
execute() execute an Ex command and get the output
List manipulation: *list-functions*
get() get an item without error for wrong index
@@ -978,6 +979,8 @@ Various: *various-functions*
shiftwidth() effective value of 'shiftwidth'
wordcount() get byte/word/char count of buffer
taglist() get list of matching tags
tagfiles() get a list of tags files
@@ -986,7 +989,6 @@ Various: *various-functions*
perleval() evaluate Perl expression (|+perl|)
py3eval() evaluate Python expression (|+python3|)
pyeval() evaluate Python expression (|+python|)
wordcount() get byte/word/char count of buffer
==============================================================================
*41.7* Defining a function
+7 -2
View File
@@ -1,4 +1,4 @@
*various.txt* For Vim version 7.4. Last change: 2016 May 24
*various.txt* For Vim version 7.4. Last change: 2016 Jul 09
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -473,9 +473,12 @@ N *+X11* Unix only: can restore window title |X11|
shown on the screen. When [!] is included, an
existing file is overwritten. When [!] is omitted,
and {file} exists, this command fails.
Only one ":redir" can be active at a time. Calls to
":redir" will close any active redirection before
starting redirection to the new target.
starting redirection to the new target. For recursive
use check out |execute()|.
To stop the messages and commands from being echoed to
the screen, put the commands in a function and call it
with ":silent call Function()".
@@ -515,6 +518,8 @@ N *+X11* Unix only: can restore window title |X11|
redirection starts, if the variable is removed or
locked or the variable type is changed, then further
command output messages will cause errors. {not in Vi}
To get the output of one command the |execute()|
function can be used.
:redi[r] =>> {var} Append messages to an existing variable. Only string
variables can be used. {not in Vi}
+36 -45
View File
@@ -1,4 +1,4 @@
*version8.txt* For Vim version 8.0. Last change: 2016 Jun 04
*version8.txt* For Vim version 8.0. Last change: 2016 Jul 03
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -16,12 +16,12 @@ See |vi_diff.txt| for an overview of differences between Vi and Vim 7.0.
See |version4.txt|, |version5.txt|, |version6.txt| and |version7.txt| for
differences between other versions.
INCOMPATIBLE CHANGES |incompatible-8|
NEW FEATURES |new-8|
Vim script enhancements |new-vim-script-8|
INCOMPATIBLE CHANGES |incompatible-8|
IMPROVEMENTS |improvements-8|
COMPILE TIME CHANGES |compile-changes-8|
@@ -29,21 +29,6 @@ COMPILE TIME CHANGES |compile-changes-8|
PATCHES |patches-8|
==============================================================================
INCOMPATIBLE CHANGES *incompatible-8*
These changes are incompatible with previous releases. Check this list if you
run into a problem when upgrading from Vim 7.4 to 8.0.
The support for MS-DOS has been removed. It hasn't been working for a while
and removing it cleans up the code quite a bit.
The support for Windows 16 bit (Windows 95 and older) has been removed.
Minor incompatibilities:
For filetype detection: ...
==============================================================================
NEW FEATURES *new-8*
@@ -52,14 +37,18 @@ First a list of the bigger new features. A comprehensive list is below.
Asynchronous I/O support, channels ~
Vim can now exchange messages with another process in the background. The
messages are received and handled while Vim is waiting for a character. See
|channel-demo| for an example, communicating with a Python server.
Vim can now exchange messages with other processes in the background. This
makes it possible to have servers do work and send back the results to Vim.
See |channel-demo| for an example, this shows communicating with a Python
server.
Closely related to channels is JSON support. JSON is widely supported and can
easily be used for inter-process communication, allowing for writing a server
in any language. The functions to use are |json_encode()| and |json_decode()|.
This makes it possible to build very complex plugins, written in any language
and running in a separate process.
Jobs ~
@@ -74,8 +63,8 @@ Timers ~
Also asynchronous are timers. They can fire once or repeatedly and invoke a
function to do any work. For example: >
let tempTimer = timer_start(4000, 'CheckTemp')
This will make a call four seconds (4000 milli seconds) later, like: >
call CheckTemp()
This will call the CheckTemp() function four seconds (4000 milli seconds)
later.
Partials ~
@@ -85,8 +74,7 @@ to a function, and additionally binds arguments and/or a dictionary. This is
especially useful for callbacks on channels and timers. E.g., for the timer
example above, to pass an argument to the function: >
let tempTimer = timer_start(4000, function('CheckTemp', ['out']))
This will a make call four seconds later, like: >
call CheckTemp('out')
This will call CheckTemp('out') four seconds later.
Packages ~
@@ -103,26 +91,7 @@ New style tests ~
This is for Vim developers. So far writing tests for Vim has not been easy.
Vim 8 adds assert functions and a framework to run tests. This makes it a lot
simpler to write tests and keep them updated. Also new are several functions
that are added specifically for testing.
These functions have been added:
|assert_equal()|
|assert_notequal()|
|assert_exception()|
|assert_fails()|
|assert_false()|
|assert_match()|
|assert_notmatch()|
|assert_true()|
|test_alloc_fail()|
|test_disable_char_avail()|
|test_garbagecollect_now()|
|test_null_channel()|
|test_null_dict()|
|test_null_job()|
|test_null_list()|
|test_null_partial()|
|test_null_string()|
that are added specifically for testing. See |test-functions|.
Window IDs ~
@@ -132,6 +101,13 @@ window would open, close or move that number changes. Each window now has a
unique ID, so that they are easy to find. See |win_getid()| and |win_id2win()|.
Viminfo uses timestamps ~
Previously the information stored in viminfo was whatever the last Vim wrote
there. Now timestamps are used to always keep the most recent items.
See |viminfo-timestamp|.
Wrapping lines with indent ~
The 'breakindent' option has been added to be able to wrap lines without
@@ -215,6 +191,21 @@ New message translations: ~
Others: ~
==============================================================================
INCOMPATIBLE CHANGES *incompatible-8*
These changes are incompatible with previous releases. Check this list if you
run into a problem when upgrading from Vim 7.4 to 8.0.
The support for MS-DOS has been removed. It hasn't been working for a while
and removing it cleans up the code quite a bit.
The support for Windows 16 bit (Windows 95 and older) has been removed.
Minor incompatibilities:
For filetype detection: ...
==============================================================================
IMPROVEMENTS *improvements-8*
+2 -2
View File
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: C
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last Change: 2016 Apr 10
" Last Change: 2016 Jul 07
" Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax")
@@ -295,7 +295,7 @@ if !exists("c_no_ansi") || exists("c_ansi_constants") || exists("c_gnu")
syn keyword cConstant SCHAR_MIN SINT_MIN SLONG_MIN SSHRT_MIN
syn keyword cConstant SCHAR_MAX SINT_MAX SLONG_MAX SSHRT_MAX
if !exists("c_no_c99")
syn keyword cConstant __func__
syn keyword cConstant __func__ __VA_ARGS__
syn keyword cConstant LLONG_MIN LLONG_MAX ULLONG_MAX
syn keyword cConstant INT8_MIN INT16_MIN INT32_MIN INT64_MIN
syn keyword cConstant INT8_MAX INT16_MAX INT32_MAX INT64_MAX
+2 -1
View File
@@ -2,7 +2,7 @@
" Language: C++
" Current Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp)
" Previous Maintainer: Ken Shan <ccshan@post.harvard.edu>
" Last Change: 2015 Nov 10
" Last Change: 2016 Jul 07
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
@@ -80,6 +80,7 @@ if version >= 508 || !exists("did_cpp_syntax_inits")
HiLink cppConstant Constant
HiLink cppRawStringDelimiter Delimiter
HiLink cppRawString String
HiLink cppNumber Number
delcommand HiLink
endif
+74 -44
View File
@@ -2,30 +2,22 @@
" Language: OpenBSD packet filter configuration (pf.conf)
" Original Author: Camiel Dobbelaar <cd@sentia.nl>
" Maintainer: Lauri Tirkkonen <lotheac@iki.fi>
" Last Change: 2013 Apr 02
" Last Change: 2016 Jul 06
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
if exists("b:current_syntax")
finish
endif
setlocal foldmethod=syntax
syn iskeyword @,48-57,_,-,+
syn sync fromstart
syn cluster pfNotLS contains=pfTodo,pfVarAssign
syn keyword pfCmd altq anchor antispoof binat nat pass
syn keyword pfCmd queue rdr scrub table set
syn keyword pfService auth bgp domain finger ftp http https ident
syn keyword pfService imap irc isakmp kerberos mail nameserver nfs
syn keyword pfService nntp ntp pop3 portmap pptp rpcbind rsync smtp
syn keyword pfService snmp snmptrap socks ssh sunrpc syslog telnet
syn keyword pfService tftp www
syn keyword pfCmd anchor antispoof block include match pass queue
syn keyword pfCmd queue set table
syn match pfCmd /^\s*load\sanchor\>/
syn keyword pfTodo TODO XXX contained
syn keyword pfWildAddr all any
syn match pfCmd /block\s/
syn match pfComment /#.*$/ contains=pfTodo
syn match pfCont /\\$/
syn match pfErrClose /}/
@@ -34,43 +26,81 @@ syn match pfIPv6 /[a-fA-F0-9:]*::[a-fA-F0-9:.]*/
syn match pfIPv6 /[a-fA-F0-9:]\+:[a-fA-F0-9:]\+:[a-fA-F0-9:.]\+/
syn match pfNetmask /\/\d\+/
syn match pfNum /[a-zA-Z0-9_:.]\@<!\d\+[a-zA-Z0-9_:.]\@!/
syn match pfTable /<\s*[a-zA-Z][a-zA-Z0-9_]*\s*>/
syn match pfTable /<\s*[a-zA-Z0-9_:][a-zA-Z0-9_:.-]*\s*>/
syn match pfVar /$[a-zA-Z][a-zA-Z0-9_]*/
syn match pfVarAssign /^\s*[a-zA-Z][a-zA-Z0-9_]*\s*=/me=e-1
syn region pfFold1 start=/^#\{1}>/ end=/^#\{1,3}>/me=s-1 transparent fold
syn region pfFold2 start=/^#\{2}>/ end=/^#\{2,3}>/me=s-1 transparent fold
syn region pfFold3 start=/^#\{3}>/ end=/^#\{3}>/me=s-1 transparent fold
syn region pfList start=/{/ end=/}/ transparent contains=ALLBUT,pfErrClose,@pfNotLS
syn region pfString start=/"/ end=/"/ transparent contains=ALLBUT,pfString,@pfNotLS
syn region pfString start=/'/ end=/'/ transparent contains=ALLBUT,pfString,@pfNotLS
syn region pfString start=/"/ skip=/\\"/ end=/"/ contains=pfIPv4,pfIPv6,pfNetmask,pfTable,pfVar
syn region pfString start=/'/ skip=/\\'/ end=/'/ contains=pfIPv4,pfIPv6,pfNetmask,pfTable,pfVar
" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_c_syn_inits")
if version < 508
let did_c_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif
syn keyword pfService 802-11-iapp Microsoft-SQL-Monitor
syn keyword pfService Microsoft-SQL-Server NeXTStep NextStep
syn keyword pfService afpovertcp afs3-bos afs3-callback afs3-errors
syn keyword pfService afs3-fileserver afs3-kaserver afs3-prserver
syn keyword pfService afs3-rmtsys afs3-update afs3-vlserver
syn keyword pfService afs3-volser amt-redir-tcp amt-redir-tls
syn keyword pfService amt-soap-http amt-soap-https asf-rmcp at-echo
syn keyword pfService at-nbp at-rtmp at-zis auth authentication
syn keyword pfService bfd-control bfd-echo bftp bgp bgpd biff bootpc
syn keyword pfService bootps canna cddb cddbp chargen chat cmd
syn keyword pfService cmip-agent cmip-man comsat conference
syn keyword pfService conserver courier csnet-ns cso-ns cvspserver
syn keyword pfService daap datametrics daytime dhcpd-sync
syn keyword pfService dhcpv6-client dhcpv6-server discard domain
syn keyword pfService echo efs eklogin ekshell ekshell2 epmap eppc
syn keyword pfService exec finger ftp ftp-data git gopher hostname
syn keyword pfService hostnames hprop http https hunt hylafax iapp
syn keyword pfService icb ident imap imap2 imap3 imaps ingreslock
syn keyword pfService ipp iprop ipsec-msft ipsec-nat-t ipx irc
syn keyword pfService isakmp iscsi isisd iso-tsap kauth kdc kerberos
syn keyword pfService kerberos-adm kerberos-iv kerberos-sec
syn keyword pfService kerberos_master kf kip klogin kpasswd kpop
syn keyword pfService krb524 krb_prop krbupdate krcmd kreg kshell kx
syn keyword pfService l2tp ldap ldaps ldp link login mail mdns
syn keyword pfService mdnsresponder microsoft-ds ms-sql-m ms-sql-s
syn keyword pfService msa msp mtp mysql name nameserver netbios-dgm
syn keyword pfService netbios-ns netbios-ssn netnews netplan netrjs
syn keyword pfService netstat netwall newdate nextstep nfs nfsd
syn keyword pfService nicname nnsp nntp ntalk ntp null openwebnet
syn keyword pfService ospf6d ospfapi ospfd photuris pop2 pop3 pop3pw
syn keyword pfService pop3s poppassd portmap postgresql postoffice
syn keyword pfService pptp presence printer prospero prospero-np
syn keyword pfService puppet pwdgen qotd quote radacct radius
syn keyword pfService radius-acct rdp readnews remotefs resource rfb
syn keyword pfService rfe rfs rfs_server ripd ripng rje rkinit rlp
syn keyword pfService routed router rpc rpcbind rsync rtelnet rtsp
syn keyword pfService sa-msg-port sane-port sftp shell sieve silc
syn keyword pfService sink sip smtp smtps smux snmp snmp-trap
syn keyword pfService snmptrap snpp socks source spamd spamd-cfg
syn keyword pfService spamd-sync spooler spop3 ssdp ssh submission
syn keyword pfService sunrpc supdup supfiledbg supfilesrv support
syn keyword pfService svn svrloc swat syslog syslog-tls systat
syn keyword pfService tacacs tacas+ talk tap tcpmux telnet tempo
syn keyword pfService tftp time timed timeserver timserver tsap
syn keyword pfService ttylink ttytst ub-dns-control ulistserv untp
syn keyword pfService usenet users uucp uucp-path uucpd vnc vxlan
syn keyword pfService wais webster who whod whois www x400 x400-snd
syn keyword pfService xcept xdmcp xmpp-bosh xmpp-client xmpp-server
syn keyword pfService z3950 zabbix-agent zabbix-trapper zebra
syn keyword pfService zebrasrv
HiLink pfCmd Statement
HiLink pfComment Comment
HiLink pfCont Statement
HiLink pfErrClose Error
HiLink pfIPv4 Type
HiLink pfIPv6 Type
HiLink pfNetmask Constant
HiLink pfNum Constant
HiLink pfService Constant
HiLink pfTable Identifier
HiLink pfTodo Todo
HiLink pfVar Identifier
HiLink pfVarAssign Identifier
HiLink pfWildAddr Type
delcommand HiLink
endif
hi def link pfCmd Statement
hi def link pfComment Comment
hi def link pfCont Statement
hi def link pfErrClose Error
hi def link pfIPv4 Type
hi def link pfIPv6 Type
hi def link pfNetmask Constant
hi def link pfNum Constant
hi def link pfService Constant
hi def link pfString String
hi def link pfTable Identifier
hi def link pfTodo Todo
hi def link pfVar Identifier
hi def link pfVarAssign Identifier
hi def link pfWildAddr Type
let b:current_syntax = "pf"
+2 -1
View File
@@ -2033,6 +2033,7 @@ test1 \
test_arglist \
test_assert \
test_assign \
test_autochdir \
test_autocmd \
test_backspace_opt \
test_cdo \
@@ -2040,8 +2041,8 @@ test_arglist \
test_cmdline \
test_cursor_func \
test_delete \
test_evalcmd \
test_ex_undo \
test_execute_func \
test_expand \
test_expand_dllpath \
test_expr \
+15 -14
View File
@@ -459,14 +459,6 @@ aucmd_abort:
#endif
buf_freeall(buf, (del_buf ? BFA_DEL : 0) + (wipe_buf ? BFA_WIPE : 0));
if (
#ifdef FEAT_WINDOWS
win_valid(win) &&
#else
win != NULL &&
#endif
win->w_buffer == buf)
win->w_buffer = NULL; /* make sure we don't use the buffer now */
#ifdef FEAT_AUTOCMD
/* Autocommands may have deleted the buffer. */
@@ -477,11 +469,6 @@ aucmd_abort:
return;
# endif
/* Autocommands may have opened or closed windows for this buffer.
* Decrement the count for the close we do here. */
if (buf->b_nwindows > 0)
--buf->b_nwindows;
/*
* It's possible that autocommands change curbuf to the one being deleted.
* This might cause the previous curbuf to be deleted unexpectedly. But
@@ -491,6 +478,20 @@ aucmd_abort:
*/
if (buf == curbuf && !is_curbuf)
return;
if (
#ifdef FEAT_WINDOWS
win_valid(win) &&
#else
win != NULL &&
#endif
win->w_buffer == buf)
win->w_buffer = NULL; /* make sure we don't use the buffer now */
/* Autocommands may have opened or closed windows for this buffer.
* Decrement the count for the close we do here. */
if (buf->b_nwindows > 0)
--buf->b_nwindows;
#endif
#ifdef FEAT_ODB_EDITOR
@@ -1638,7 +1639,7 @@ enter_buffer(buf_T *buf)
void
do_autochdir(void)
{
if (starting == 0
if ((starting == 0 || test_autochdir)
&& curbuf->b_ffname != NULL
&& vim_chdirfile(curbuf->b_ffname) == OK)
shorten_fnames(TRUE);
+2
View File
@@ -2840,6 +2840,7 @@ set_completion(colnr_T startcol, list_T *list)
}
else
ins_complete(Ctrl_N, FALSE);
compl_enter_selects = compl_no_insert;
/* Lazily show the popup menu, unless we got interrupted. */
if (!compl_interrupted)
@@ -4694,6 +4695,7 @@ ins_compl_insert(void)
EMPTY_IF_NULL(compl_shown_match->cp_text[CPT_INFO]));
}
set_vim_var_dict(VV_COMPLETED_ITEM, dict);
compl_curr_match = compl_shown_match;
}
/*
+204 -61
View File
@@ -555,9 +555,9 @@ static void f_diff_hlID(typval_T *argvars, typval_T *rettv);
static void f_empty(typval_T *argvars, typval_T *rettv);
static void f_escape(typval_T *argvars, typval_T *rettv);
static void f_eval(typval_T *argvars, typval_T *rettv);
static void f_evalcmd(typval_T *argvars, typval_T *rettv);
static void f_eventhandler(typval_T *argvars, typval_T *rettv);
static void f_executable(typval_T *argvars, typval_T *rettv);
static void f_execute(typval_T *argvars, typval_T *rettv);
static void f_exepath(typval_T *argvars, typval_T *rettv);
static void f_exists(typval_T *argvars, typval_T *rettv);
#ifdef FEAT_FLOAT
@@ -593,6 +593,9 @@ static void f_getchar(typval_T *argvars, typval_T *rettv);
static void f_getcharmod(typval_T *argvars, typval_T *rettv);
static void f_getcharsearch(typval_T *argvars, typval_T *rettv);
static void f_getcmdline(typval_T *argvars, typval_T *rettv);
#if defined(FEAT_CMDL_COMPL)
static void f_getcompletion(typval_T *argvars, typval_T *rettv);
#endif
static void f_getcmdpos(typval_T *argvars, typval_T *rettv);
static void f_getcmdtype(typval_T *argvars, typval_T *rettv);
static void f_getcmdwintype(typval_T *argvars, typval_T *rettv);
@@ -809,6 +812,7 @@ static void f_taglist(typval_T *argvars, typval_T *rettv);
static void f_tagfiles(typval_T *argvars, typval_T *rettv);
static void f_tempname(typval_T *argvars, typval_T *rettv);
static void f_test_alloc_fail(typval_T *argvars, typval_T *rettv);
static void f_test_autochdir(typval_T *argvars, typval_T *rettv);
static void f_test_disable_char_avail(typval_T *argvars, typval_T *rettv);
static void f_test_garbagecollect_now(typval_T *argvars, typval_T *rettv);
#ifdef FEAT_JOB_CHANNEL
@@ -8564,9 +8568,9 @@ static struct fst
{"empty", 1, 1, f_empty},
{"escape", 2, 2, f_escape},
{"eval", 1, 1, f_eval},
{"evalcmd", 1, 1, f_evalcmd},
{"eventhandler", 0, 0, f_eventhandler},
{"executable", 1, 1, f_executable},
{"execute", 1, 2, f_execute},
{"exepath", 1, 1, f_exepath},
{"exists", 1, 1, f_exists},
#ifdef FEAT_FLOAT
@@ -8606,6 +8610,9 @@ static struct fst
{"getcmdpos", 0, 0, f_getcmdpos},
{"getcmdtype", 0, 0, f_getcmdtype},
{"getcmdwintype", 0, 0, f_getcmdwintype},
#if defined(FEAT_CMDL_COMPL)
{"getcompletion", 2, 2, f_getcompletion},
#endif
{"getcurpos", 0, 0, f_getcurpos},
{"getcwd", 0, 2, f_getcwd},
{"getfontname", 0, 1, f_getfontname},
@@ -8826,6 +8833,7 @@ static struct fst
#endif
{"tempname", 0, 0, f_tempname},
{"test_alloc_fail", 3, 3, f_test_alloc_fail},
{"test_autochdir", 0, 0, f_test_autochdir},
{"test_disable_char_avail", 1, 1, f_test_disable_char_avail},
{"test_garbagecollect_now", 0, 0, f_test_garbagecollect_now},
#ifdef FEAT_JOB_CHANNEL
@@ -11345,61 +11353,6 @@ f_eval(typval_T *argvars, typval_T *rettv)
EMSG(_(e_trailing));
}
static garray_T redir_evalcmd_ga;
/*
* Append "value[value_len]" to the evalcmd() output.
*/
void
evalcmd_redir_str(char_u *value, int value_len)
{
int len;
if (value_len == -1)
len = (int)STRLEN(value); /* Append the entire string */
else
len = value_len; /* Append only "value_len" characters */
if (ga_grow(&redir_evalcmd_ga, len) == OK)
{
mch_memmove((char *)redir_evalcmd_ga.ga_data
+ redir_evalcmd_ga.ga_len, value, len);
redir_evalcmd_ga.ga_len += len;
}
}
/*
* "evalcmd()" function
*/
static void
f_evalcmd(typval_T *argvars, typval_T *rettv)
{
char_u *s;
int save_msg_silent = msg_silent;
int save_redir_evalcmd = redir_evalcmd;
garray_T save_ga;
rettv->vval.v_string = NULL;
rettv->v_type = VAR_STRING;
s = get_tv_string_chk(&argvars[0]);
if (s != NULL)
{
if (redir_evalcmd)
save_ga = redir_evalcmd_ga;
ga_init2(&redir_evalcmd_ga, (int)sizeof(char), 500);
redir_evalcmd = TRUE;
++msg_silent;
do_cmdline_cmd(s);
rettv->vval.v_string = redir_evalcmd_ga.ga_data;
msg_silent = save_msg_silent;
redir_evalcmd = save_redir_evalcmd;
if (redir_evalcmd)
redir_evalcmd_ga = save_ga;
}
}
/*
* "eventhandler()" function
*/
@@ -11422,6 +11375,132 @@ f_executable(typval_T *argvars, typval_T *rettv)
|| (gettail(name) != name && mch_can_exe(name, NULL, FALSE));
}
static garray_T redir_execute_ga;
/*
* Append "value[value_len]" to the execute() output.
*/
void
execute_redir_str(char_u *value, int value_len)
{
int len;
if (value_len == -1)
len = (int)STRLEN(value); /* Append the entire string */
else
len = value_len; /* Append only "value_len" characters */
if (ga_grow(&redir_execute_ga, len) == OK)
{
mch_memmove((char *)redir_execute_ga.ga_data
+ redir_execute_ga.ga_len, value, len);
redir_execute_ga.ga_len += len;
}
}
/*
* Get next line from a list.
* Called by do_cmdline() to get the next line.
* Returns allocated string, or NULL for end of function.
*/
static char_u *
get_list_line(
int c UNUSED,
void *cookie,
int indent UNUSED)
{
listitem_T **p = (listitem_T **)cookie;
listitem_T *item = *p;
char_u buf[NUMBUFLEN];
char_u *s;
if (item == NULL)
return NULL;
s = get_tv_string_buf_chk(&item->li_tv, buf);
*p = item->li_next;
return s == NULL ? NULL : vim_strsave(s);
}
/*
* "execute()" function
*/
static void
f_execute(typval_T *argvars, typval_T *rettv)
{
char_u *cmd = NULL;
list_T *list = NULL;
int save_msg_silent = msg_silent;
int save_emsg_silent = emsg_silent;
int save_emsg_noredir = emsg_noredir;
int save_redir_execute = redir_execute;
garray_T save_ga;
rettv->vval.v_string = NULL;
rettv->v_type = VAR_STRING;
if (argvars[0].v_type == VAR_LIST)
{
list = argvars[0].vval.v_list;
if (list == NULL || list->lv_first == NULL)
/* empty list, no commands, empty output */
return;
++list->lv_refcount;
}
else
{
cmd = get_tv_string_chk(&argvars[0]);
if (cmd == NULL)
return;
}
if (argvars[1].v_type != VAR_UNKNOWN)
{
char_u buf[NUMBUFLEN];
char_u *s = get_tv_string_buf_chk(&argvars[1], buf);
if (s == NULL)
return;
if (STRNCMP(s, "silent", 6) == 0)
++msg_silent;
if (STRCMP(s, "silent!") == 0)
{
emsg_silent = TRUE;
emsg_noredir = TRUE;
}
}
else
++msg_silent;
if (redir_execute)
save_ga = redir_execute_ga;
ga_init2(&redir_execute_ga, (int)sizeof(char), 500);
redir_execute = TRUE;
if (cmd != NULL)
do_cmdline_cmd(cmd);
else
{
listitem_T *item = list->lv_first;
do_cmdline(NULL, get_list_line, (void *)&item,
DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT|DOCMD_KEYTYPED);
--list->lv_refcount;
}
rettv->vval.v_string = redir_execute_ga.ga_data;
msg_silent = save_msg_silent;
emsg_silent = save_emsg_silent;
emsg_noredir = save_emsg_noredir;
redir_execute = save_redir_execute;
if (redir_execute)
redir_execute_ga = save_ga;
/* "silent reg" or "silent echo x" leaves msg_col somewhere in the
* line. Put it back in the first column. */
msg_col = 0;
}
/*
* "exepath()" function
*/
@@ -12044,6 +12123,7 @@ filter_map_one(typval_T *tv, typval_T *expr, int map, int *remp)
{
typval_T rettv;
typval_T argv[3];
char_u buf[NUMBUFLEN];
char_u *s;
int retval = FAIL;
int dummy;
@@ -12051,9 +12131,9 @@ filter_map_one(typval_T *tv, typval_T *expr, int map, int *remp)
copy_tv(tv, &vimvars[VV_VAL].vv_tv);
argv[0] = vimvars[VV_KEY].vv_tv;
argv[1] = vimvars[VV_VAL].vv_tv;
s = expr->vval.v_string;
if (expr->v_type == VAR_FUNC)
{
s = expr->vval.v_string;
if (call_func(s, (int)STRLEN(s),
&rettv, 2, argv, 0L, 0L, &dummy, TRUE, NULL, NULL) == FAIL)
goto theend;
@@ -12070,6 +12150,9 @@ filter_map_one(typval_T *tv, typval_T *expr, int map, int *remp)
}
else
{
s = get_tv_string_buf_chk(expr, buf);
if (s == NULL)
goto theend;
s = skipwhite(s);
if (eval1(&s, &rettv, TRUE) == FAIL)
goto theend;
@@ -13015,6 +13098,55 @@ f_getcmdwintype(typval_T *argvars UNUSED, typval_T *rettv)
#endif
}
#if defined(FEAT_CMDL_COMPL)
/*
* "getcompletion()" function
*/
static void
f_getcompletion(typval_T *argvars, typval_T *rettv)
{
char_u *pat;
expand_T xpc;
int options = WILD_KEEP_ALL | WILD_SILENT | WILD_USE_NL
| WILD_LIST_NOTFOUND | WILD_NO_BEEP;
if (p_wic)
options |= WILD_ICASE;
ExpandInit(&xpc);
xpc.xp_pattern = get_tv_string(&argvars[0]);
xpc.xp_pattern_len = STRLEN(xpc.xp_pattern);
xpc.xp_context = cmdcomplete_str_to_type(get_tv_string(&argvars[1]));
if (xpc.xp_context == EXPAND_NOTHING)
{
if (argvars[1].v_type == VAR_STRING)
EMSG2(_(e_invarg2), argvars[1].vval.v_string);
else
EMSG(_(e_invarg));
return;
}
if (xpc.xp_context == EXPAND_MENUS)
{
set_context_in_menu_cmd(&xpc, (char_u *)"menu", xpc.xp_pattern, FALSE);
xpc.xp_pattern_len = STRLEN(xpc.xp_pattern);
}
pat = addstar(xpc.xp_pattern, xpc.xp_pattern_len, xpc.xp_context);
if ((rettv_list_alloc(rettv) != FAIL) && (pat != NULL))
{
int i;
ExpandOne(&xpc, pat, NULL, options, WILD_ALL_KEEP);
for (i = 0; i < xpc.xp_numfiles; i++)
list_append_string(rettv->vval.v_list, xpc.xp_files[i], -1);
}
vim_free(pat);
ExpandCleanup(&xpc);
}
#endif
/*
* "getcwd()" function
*/
@@ -13032,7 +13164,7 @@ f_getcwd(typval_T *argvars, typval_T *rettv)
{
if (wp->w_localdir != NULL)
rettv->vval.v_string = vim_strsave(wp->w_localdir);
else if(globaldir != NULL)
else if (globaldir != NULL)
rettv->vval.v_string = vim_strsave(globaldir);
else
{
@@ -20973,6 +21105,17 @@ f_test_alloc_fail(typval_T *argvars, typval_T *rettv UNUSED)
}
}
/*
* "test_autochdir()"
*/
static void
f_test_autochdir(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
{
#if defined(FEAT_AUTOCHDIR)
test_autochdir = TRUE;
#endif
}
/*
* "test_disable_char_avail({expr})" function
*/
@@ -21121,8 +21264,8 @@ f_timer_stop(typval_T *argvars, typval_T *rettv UNUSED)
if (argvars[0].v_type != VAR_NUMBER)
{
EMSG(_(e_number_exp));
return;
EMSG(_(e_number_exp));
return;
}
timer = find_timer((int)get_tv_number(&argvars[0]));
if (timer != NULL)
+9 -1
View File
@@ -3059,6 +3059,7 @@ do_write(exarg_T *eap)
char_u *browse_file = NULL;
#endif
buf_T *alt_buf = NULL;
int name_was_missing;
if (not_writing()) /* check 'write' option */
return FAIL;
@@ -3226,6 +3227,8 @@ do_write(exarg_T *eap)
#endif
}
name_was_missing = curbuf->b_ffname == NULL;
retval = buf_write(curbuf, ffname, fname, eap->line1, eap->line2,
eap, eap->append, eap->forceit, TRUE, FALSE);
@@ -3239,7 +3242,12 @@ do_write(exarg_T *eap)
redraw_tabline = TRUE;
#endif
}
/* Change directories when the 'acd' option is set. */
}
/* Change directories when the 'acd' option is set and the file name
* got changed or set. */
if (eap->cmdidx == CMD_saveas || name_was_missing)
{
DO_AUTOCHDIR
}
}
+3
View File
@@ -724,6 +724,9 @@ EX(CMD_laddfile, "laddfile", ex_cfile,
EX(CMD_later, "later", ex_later,
TRLBAR|EXTRA|NOSPC|CMDWIN,
ADDR_LINES),
EX(CMD_lbottom, "lbottom", ex_cbottom,
TRLBAR,
ADDR_LINES),
EX(CMD_lbuffer, "lbuffer", ex_cbuffer,
BANG|RANGE|NOTADR|WORD1|TRLBAR,
ADDR_LINES),
+20
View File
@@ -7066,6 +7066,18 @@ parse_compl_arg(
# endif
return OK;
}
int
cmdcomplete_str_to_type(char_u *complete_str)
{
int i;
for (i = 0; command_complete[i].expand != 0; ++i)
if (STRCMP(complete_str, command_complete[i].name) == 0)
return command_complete[i].expand;
return EXPAND_NOTHING;
}
#endif
static void
@@ -9474,6 +9486,14 @@ ex_redir(exarg_T *eap)
char_u *fname;
char_u *arg = eap->arg;
#ifdef FEAT_EVAL
if (redir_execute)
{
EMSG(_("E930: Cannot use :redir inside execute()"));
return;
}
#endif
if (STRICMP(eap->arg, "END") == 0)
close_redir();
else
+5 -1
View File
@@ -635,6 +635,9 @@ EXTERN int exiting INIT(= FALSE);
EXTERN int really_exiting INIT(= FALSE);
/* TRUE when we are sure to exit, e.g., after
* a deadly signal */
#if defined(FEAT_AUTOCHDIR)
EXTERN int test_autochdir INIT(= FALSE);
#endif
#if defined(EXITFREE)
EXTERN int entered_free_all_mem INIT(= FALSE);
/* TRUE when in or after free_all_mem() */
@@ -973,6 +976,7 @@ EXTERN cmdmod_T cmdmod; /* Ex command modifiers */
EXTERN int msg_silent INIT(= 0); /* don't print messages */
EXTERN int emsg_silent INIT(= 0); /* don't print error messages */
EXTERN int emsg_noredir INIT(= 0); /* don't redirect error messages */
EXTERN int cmd_silent INIT(= FALSE); /* don't echo the command line */
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) \
@@ -1108,7 +1112,7 @@ EXTERN FILE *redir_fd INIT(= NULL); /* message redirection file */
#ifdef FEAT_EVAL
EXTERN int redir_reg INIT(= 0); /* message redirection register */
EXTERN int redir_vname INIT(= 0); /* message redirection variable */
EXTERN int redir_evalcmd INIT(= 0); /* evalcmd() redirection */
EXTERN int redir_execute INIT(= 0); /* execute() redirection */
#endif
#ifdef FEAT_LANGMAP
+23 -20
View File
@@ -566,22 +566,25 @@ emsg(char_u *s)
*/
if (emsg_silent != 0)
{
msg_start();
p = get_emsg_source();
if (p != NULL)
if (emsg_noredir == 0)
{
STRCAT(p, "\n");
redir_write(p, -1);
vim_free(p);
msg_start();
p = get_emsg_source();
if (p != NULL)
{
STRCAT(p, "\n");
redir_write(p, -1);
vim_free(p);
}
p = get_emsg_lnum();
if (p != NULL)
{
STRCAT(p, "\n");
redir_write(p, -1);
vim_free(p);
}
redir_write(s, -1);
}
p = get_emsg_lnum();
if (p != NULL)
{
STRCAT(p, "\n");
redir_write(p, -1);
vim_free(p);
}
redir_write(s, -1);
return TRUE;
}
@@ -3067,8 +3070,8 @@ redir_write(char_u *str, int maxlen)
while (cur_col < msg_col)
{
#ifdef FEAT_EVAL
if (redir_evalcmd)
evalcmd_redir_str((char_u *)" ", -1);
if (redir_execute)
execute_redir_str((char_u *)" ", -1);
else if (redir_reg)
write_reg_contents(redir_reg, (char_u *)" ", -1, TRUE);
else if (redir_vname)
@@ -3084,8 +3087,8 @@ redir_write(char_u *str, int maxlen)
}
#ifdef FEAT_EVAL
if (redir_evalcmd)
evalcmd_redir_str(s, maxlen);
if (redir_execute)
execute_redir_str(s, maxlen);
else if (redir_reg)
write_reg_contents(redir_reg, s, maxlen, TRUE);
else if (redir_vname)
@@ -3096,7 +3099,7 @@ redir_write(char_u *str, int maxlen)
while (*s != NUL && (maxlen < 0 || (int)(s - str) < maxlen))
{
#ifdef FEAT_EVAL
if (!redir_reg && !redir_vname && !redir_evalcmd)
if (!redir_reg && !redir_vname && !redir_execute)
#endif
if (redir_fd != NULL)
putc(*s, redir_fd);
@@ -3121,7 +3124,7 @@ redirecting(void)
{
return redir_fd != NULL || *p_vfile != NUL
#ifdef FEAT_EVAL
|| redir_reg || redir_vname || redir_evalcmd
|| redir_reg || redir_vname || redir_execute
#endif
;
}
+1 -1
View File
@@ -88,7 +88,7 @@ char_u *get_expr_name(expand_T *xp, int idx);
int call_func(char_u *funcname, int len, typval_T *rettv, int argcount_in, typval_T *argvars_in, linenr_T firstline, linenr_T lastline, int *doesrange, int evaluate, partial_T *partial, dict_T *selfdict_in);
buf_T *buflist_find_by_name(char_u *name, int curtab_only);
int func_call(char_u *name, typval_T *args, partial_T *partial, dict_T *selfdict, typval_T *rettv);
void evalcmd_redir_str(char_u *value, int value_len);
void execute_redir_str(char_u *value, int value_len);
void dict_extend(dict_T *d1, dict_T *d2, char_u *action);
void mzscheme_call_vim(char_u *name, typval_T *args, typval_T *rettv);
float_T vim_round(float_T f);
+1
View File
@@ -25,6 +25,7 @@ char_u *get_user_cmd_nargs(expand_T *xp, int idx);
char_u *get_user_cmd_complete(expand_T *xp, int idx);
int parse_addr_type_arg(char_u *value, int vallen, long *argt, int *addr_type_arg);
int parse_compl_arg(char_u *value, int vallen, int *complp, long *argt, char_u **compl_arg);
int cmdcomplete_str_to_type(char_u *complete_str);
void not_exiting(void);
void tabpage_close(int forceit);
void tabpage_close_other(tabpage_T *tp, int forceit);
+14 -2
View File
@@ -2831,13 +2831,25 @@ qf_win_goto(win_T *win, linenr_T lnum)
}
/*
* :cbottom command.
* :cbottom/:lbottom commands.
*/
void
ex_cbottom(exarg_T *eap UNUSED)
{
win_T *win = qf_find_win(&ql_info);
qf_info_T *qi = &ql_info;
win_T *win;
if (eap->cmdidx == CMD_lbottom)
{
qi = GET_LOC_LIST(curwin);
if (qi == NULL)
{
EMSG(_(e_loclist));
return;
}
}
win = qf_find_win(qi);
if (win != NULL && win->w_cursor.lnum != win->w_buffer->b_ml.ml_line_count)
qf_win_goto(win, win->w_buffer->b_ml.ml_line_count);
}
+17 -3
View File
@@ -422,7 +422,7 @@ redraw_after_callback(void)
; /* do nothing */
else if (State & CMDLINE)
redrawcmdline();
else if ((State & NORMAL) || (State & INSERT))
else if (State & (NORMAL | INSERT))
{
update_screen(0);
setcursor();
@@ -486,8 +486,6 @@ update_curbuf(int type)
}
/*
* update_screen()
*
* Based on the current value of curwin->w_topline, transfer a screenfull
* of stuff from Filemem to ScreenLines[], and update curwin->w_botline.
*/
@@ -499,6 +497,10 @@ update_screen(int type)
#if defined(FEAT_SEARCH_EXTRA) || defined(FEAT_CLIPBOARD)
int did_one;
#endif
#ifdef FEAT_GUI
int gui_cursor_col;
int gui_cursor_row;
#endif
/* Don't do anything if the screen structures are (not yet) valid. */
if (!screen_valid(TRUE))
@@ -696,7 +698,11 @@ update_screen(int type)
* scrolling may make it difficult to redraw the text under
* it. */
if (gui.in_use)
{
gui_cursor_col = gui.cursor_col;
gui_cursor_row = gui.cursor_row;
gui_undraw_cursor();
}
#endif
}
#endif
@@ -752,7 +758,15 @@ update_screen(int type)
{
out_flush(); /* required before updating the cursor */
if (did_one)
{
/* Put the GUI position where the cursor was, gui_update_cursor()
* uses that. */
gui.col = gui_cursor_col;
gui.row = gui_cursor_row;
gui_update_cursor(FALSE, FALSE);
screen_cur_col = gui.col;
screen_cur_row = gui.row;
}
gui_update_scrollbars(FALSE);
}
#endif
+1
View File
@@ -164,6 +164,7 @@ SCRIPTS_GUI = test16.out
# Keep test_alot*.res as the last one, sort the others.
NEW_TESTS = test_arglist.res \
test_assert.res \
test_autochdir \
test_backspace_opt.res \
test_cdo.res \
test_channel.res \
+3
View File
@@ -149,6 +149,9 @@ for s:test in sort(s:tests)
endif
endfor
" Don't write viminfo on exit.
set viminfo=
if s:fail == 0
" Success, create the .res file so that make knows it's done.
exe 'split ' . fnamemodify(g:testname, ':r') . '.res'
+1 -1
View File
@@ -5,7 +5,7 @@ source test_assign.vim
source test_autocmd.vim
source test_cursor_func.vim
source test_delete.vim
source test_evalcmd.vim
source test_execute_func.vim
source test_ex_undo.vim
source test_expand.vim
source test_expr.vim
+17
View File
@@ -0,0 +1,17 @@
" Test 'autochdir' behavior
if !exists("+autochdir")
finish
endif
func Test_set_filename()
call test_autochdir()
set acd
new
w samples/Xtest
call assert_equal("Xtest", expand('%'))
call assert_equal("samples", substitute(getcwd(), '.*/\(\k*\)', '\1', ''))
bwipe!
set noacd
call delete('samples/Xtest')
endfunc
+18
View File
@@ -60,3 +60,21 @@ function Test_bufunload()
augroup! test_bufunload_group
endfunc
" SEGV occurs in older versions. (At least 7.4.2005 or older)
function Test_autocmd_bufunload_with_tabnext()
tabedit
tabfirst
augroup test_autocmd_bufunload_with_tabnext_group
autocmd!
autocmd BufUnload <buffer> tabnext
augroup END
quit
call assert_equal(2, tabpagenr('$'))
augroup! test_autocmd_bufunload_with_tabnext_group
tablast
quit
endfunc
+23
View File
@@ -24,3 +24,26 @@ func Test_complete_wildmenu()
call delete('Xtestfile2')
set nowildmenu
endfunc
func Test_getcompletion()
if !has('cmdline_compl')
return
endif
let groupcount = len(getcompletion('', 'event'))
call assert_true(groupcount > 0)
let matchcount = len(getcompletion('File', 'event'))
call assert_true(matchcount > 0)
call assert_true(groupcount > matchcount)
if has('menu')
source $VIMRUNTIME/menu.vim
let matchcount = len(getcompletion('', 'menu'))
call assert_true(matchcount > 0)
call assert_equal(['File.'], getcompletion('File', 'menu'))
call assert_true(matchcount > 0)
let matchcount = len(getcompletion('File.', 'menu'))
call assert_true(matchcount > 0)
endif
call assert_fails('call getcompletion("", "burp")', 'E475:')
endfunc
-33
View File
@@ -1,33 +0,0 @@
" test evalcmd()
func NestedEval()
let nested = evalcmd('echo "nested\nlines"')
echo 'got: "' . nested . '"'
endfunc
func NestedRedir()
redir => var
echo 'broken'
redir END
endfunc
func Test_evalcmd()
call assert_equal("\nnocompatible", evalcmd('set compatible?'))
call assert_equal("\nsomething\nnice", evalcmd('echo "something\nnice"'))
call assert_equal("noendofline", evalcmd('echon "noendofline"'))
call assert_equal("", evalcmd(123))
call assert_equal("\ngot: \"\nnested\nlines\"", evalcmd('call NestedEval()'))
redir => redired
echo 'this'
let evaled = evalcmd('echo "that"')
echo 'theend'
redir END
call assert_equal("\nthis\ntheend", redired)
call assert_equal("\nthat", evaled)
call assert_fails('call evalcmd("doesnotexist")', 'E492:')
call assert_fails('call evalcmd(3.4)', 'E806:')
call assert_fails('call evalcmd("call NestedRedir()")', 'E930:')
endfunc
+51
View File
@@ -0,0 +1,51 @@
" test execute()
func NestedEval()
let nested = execute('echo "nested\nlines"')
echo 'got: "' . nested . '"'
endfunc
func NestedRedir()
redir => var
echo 'broken'
redir END
endfunc
func Test_execute_string()
call assert_equal("\nnocompatible", execute('set compatible?'))
call assert_equal("\nsomething\nnice", execute('echo "something\nnice"'))
call assert_equal("noendofline", execute('echon "noendofline"'))
call assert_equal("", execute(123))
call assert_equal("\ngot: \"\nnested\nlines\"", execute('call NestedEval()'))
redir => redired
echo 'this'
let evaled = execute('echo "that"')
echo 'theend'
redir END
call assert_equal("\nthis\ntheend", redired)
call assert_equal("\nthat", evaled)
call assert_fails('call execute("doesnotexist")', 'E492:')
call assert_fails('call execute(3.4)', 'E806:')
call assert_fails('call execute("call NestedRedir()")', 'E930:')
call assert_equal("\nsomething", execute('echo "something"', ''))
call assert_equal("\nsomething", execute('echo "something"', 'silent'))
call assert_equal("\nsomething", execute('echo "something"', 'silent!'))
call assert_equal("", execute('burp', 'silent!'))
call assert_fails('call execute("echo \"x\"", 3.4)', 'E806:')
call assert_equal("", execute(test_null_string()))
endfunc
func Test_execute_list()
call assert_equal("\nsomething\nnice", execute(['echo "something"', 'echo "nice"']))
let l = ['for n in range(0, 3)',
\ 'echo n',
\ 'endfor']
call assert_equal("\n0\n1\n2\n3", execute(l))
call assert_equal("", execute([]))
call assert_equal("", execute(test_null_list()))
endfunc
+4
View File
@@ -5,10 +5,12 @@ func Test_filter_map_list_expr_string()
" filter()
call assert_equal([2, 3, 4], filter([1, 2, 3, 4], 'v:val > 1'))
call assert_equal([3, 4], filter([1, 2, 3, 4], 'v:key > 1'))
call assert_equal([], filter([1, 2, 3, 4], 0))
" map()
call assert_equal([2, 4, 6, 8], map([1, 2, 3, 4], 'v:val * 2'))
call assert_equal([0, 2, 4, 6], map([1, 2, 3, 4], 'v:key * 2'))
call assert_equal([9, 9, 9, 9], map([1, 2, 3, 4], 9))
endfunc
" dict with expression string
@@ -18,10 +20,12 @@ func Test_filter_map_dict_expr_string()
" filter()
call assert_equal({"bar": 2, "baz": 3}, filter(copy(dict), 'v:val > 1'))
call assert_equal({"foo": 1, "baz": 3}, filter(copy(dict), 'v:key > "bar"'))
call assert_equal({}, filter(copy(dict), 0))
" map()
call assert_equal({"foo": 2, "bar": 4, "baz": 6}, map(copy(dict), 'v:val * 2'))
call assert_equal({"foo": "f", "bar": "b", "baz": "b"}, map(copy(dict), 'v:key[0]'))
call assert_equal({"foo": 9, "bar": 9, "baz": 9}, map(copy(dict), 9))
endfunc
" list with funcref
+53 -20
View File
@@ -1,6 +1,5 @@
" Test for completion menu
inoremap <F5> <C-R>=ListMonths()<CR>
let g:months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
let g:setting = ''
@@ -13,23 +12,57 @@ func ListMonths()
endfunc
func! Test_popup_completion_insertmode()
new
call feedkeys("a\<f5>\<down>\<enter>\<esc>", 'tx')
call assert_equal('February', getline(1))
%d
let g:setting = 'noinsertmode'
call feedkeys("a\<f5>\<down>\<enter>\<esc>", 'tx')
call assert_equal('February', getline(1))
call assert_false(pumvisible())
%d
let g:setting = ''
call feedkeys("a\<f5>". repeat("\<c-n>",12)."\<enter>\<esc>", 'tx')
call assert_equal('', getline(1))
%d
call feedkeys("a\<f5>\<c-p>\<enter>\<esc>", 'tx')
call assert_equal('', getline(1))
%d
call feedkeys("a\<f5>\<c-p>\<c-p>\<enter>\<esc>", 'tx')
call assert_equal('December', getline(1))
bwipe!
new
inoremap <F5> <C-R>=ListMonths()<CR>
call feedkeys("a\<f5>\<down>\<enter>\<esc>", 'tx')
call assert_equal('February', getline(1))
%d
let g:setting = 'noinsertmode'
call feedkeys("a\<f5>\<down>\<enter>\<esc>", 'tx')
call assert_equal('February', getline(1))
call assert_false(pumvisible())
%d
let g:setting = ''
call feedkeys("a\<f5>". repeat("\<c-n>",12)."\<enter>\<esc>", 'tx')
call assert_equal('', getline(1))
%d
call feedkeys("a\<f5>\<c-p>\<enter>\<esc>", 'tx')
call assert_equal('', getline(1))
%d
call feedkeys("a\<f5>\<c-p>\<c-p>\<enter>\<esc>", 'tx')
call assert_equal('December', getline(1))
bwipe!
iunmap <F5>
endfunc
function! ComplTest() abort
call complete(1, ['source', 'soundfold'])
return ''
endfunction
func Test_noinsert_complete()
new
set completeopt+=noinsert
inoremap <F5> <C-R>=ComplTest()<CR>
call feedkeys("i\<F5>soun\<CR>\<CR>\<ESC>.", 'tx')
call assert_equal('soundfold', getline(1))
call assert_equal('soundfold', getline(2))
bwipe!
new
inoremap <F5> <C-R>=Test()<CR>
call feedkeys("i\<F5>\<CR>\<ESC>", 'tx')
call assert_equal('source', getline(1))
bwipe!
set completeopt-=noinsert
iunmap <F5>
endfunc
function! Test() abort
call complete(1, ['source', 'soundfold'])
return ''
endfunction
+17 -6
View File
@@ -15,6 +15,7 @@ function! s:setup_commands(cchar)
command! -nargs=* Xnewer <mods>cnewer <args>
command! -nargs=* Xopen <mods>copen <args>
command! -nargs=* Xwindow <mods>cwindow <args>
command! -nargs=* Xbottom <mods>cbottom <args>
command! -nargs=* Xclose <mods>cclose <args>
command! -nargs=* -bang Xfile <mods>cfile<bang> <args>
command! -nargs=* Xgetfile <mods>cgetfile <args>
@@ -44,6 +45,7 @@ function! s:setup_commands(cchar)
command! -nargs=* Xnewer <mods>lnewer <args>
command! -nargs=* Xopen <mods>lopen <args>
command! -nargs=* Xwindow <mods>lwindow <args>
command! -nargs=* Xbottom <mods>lbottom <args>
command! -nargs=* Xclose <mods>lclose <args>
command! -nargs=* -bang Xfile <mods>lfile<bang> <args>
command! -nargs=* Xgetfile <mods>lgetfile <args>
@@ -200,6 +202,7 @@ function XwindowTests(cchar)
Xwindow
call assert_true(winnr('$') == 2 && winnr() == 2 &&
\ getline('.') ==# 'Xtestfile1|1 col 3| Line1')
redraw!
" Close the window
Xclose
@@ -1415,15 +1418,23 @@ echo string(loc_two)
call delete('Xtwo', 'rf')
endfunc
function Test_cbottom()
call setqflist([{'filename': 'foo', 'lnum': 42}])
copen
function XbottomTests(cchar)
call s:setup_commands(a:cchar)
call g:Xsetlist([{'filename': 'foo', 'lnum': 42}])
Xopen
let wid = win_getid()
call assert_equal(1, line('.'))
wincmd w
call setqflist([{'filename': 'var', 'lnum': 24}], 'a')
cbottom
call g:Xsetlist([{'filename': 'var', 'lnum': 24}], 'a')
Xbottom
call win_gotoid(wid)
call assert_equal(2, line('.'))
cclose
Xclose
endfunc
" Tests for the :cbottom and :lbottom commands
function Test_cbottom()
call XbottomTests('c')
call XbottomTests('l')
endfunction
+32
View File
@@ -773,6 +773,38 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2015,
/**/
2014,
/**/
2013,
/**/
2012,
/**/
2011,
/**/
2010,
/**/
2009,
/**/
2008,
/**/
2007,
/**/
2006,
/**/
2005,
/**/
2004,
/**/
2003,
/**/
2002,
/**/
2001,
/**/
2000,
/**/
1999,
/**/