mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-02 11:19:22 +02:00
Compare commits
104 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 486020ed01 | |||
| 5fd4203f63 | |||
| adb83bef3c | |||
| 8dcf259d90 | |||
| 7f8989dd8a | |||
| 6bef5306e4 | |||
| 2d8f56acb3 | |||
| c835293d54 | |||
| 38b772adde | |||
| 5a2800fd14 | |||
| 385111bd86 | |||
| f6f32c38bf | |||
| b4ebf9ae3b | |||
| 583c1f14a4 | |||
| 5a6ec52392 | |||
| 1adda3403d | |||
| 8950a563b3 | |||
| ac42afd10b | |||
| 8e2c942ce4 | |||
| 77cdfd1038 | |||
| 4fc563b397 | |||
| ea8d89d8a2 | |||
| f6b54657b2 | |||
| 509ce2a558 | |||
| de27989157 | |||
| 9e496854a9 | |||
| 846cdb2275 | |||
| 9de0563408 | |||
| 74c5bbf134 | |||
| 7bffaa9f9b | |||
| 40e8cb292c | |||
| 75578a388d | |||
| 132598e5d8 | |||
| 29fd03878c | |||
| af1a0e371e | |||
| 562ca71428 | |||
| d5d3d307dd | |||
| 31b6e2845a | |||
| beb003b303 | |||
| 045a284a83 | |||
| 0622732b32 | |||
| 6ff02c9651 | |||
| 8322e1f06e | |||
| d9d473ea12 | |||
| 13d6fb17a2 | |||
| f65333c9b5 | |||
| 367aabdbf7 | |||
| 8049253b96 | |||
| 9fe885e49a | |||
| e98d121052 | |||
| 41e0f2f48f | |||
| 94d0191dbc | |||
| af6e36ff16 | |||
| 7daf11ffdd | |||
| 5f148ec0b5 | |||
| 304563c0b3 | |||
| 151f656e17 | |||
| 47cff3a444 | |||
| 4e329fcaf7 | |||
| b69fccf377 | |||
| d0b6502a7a | |||
| 3f39f64866 | |||
| 839fd11d7e | |||
| 99ef06296f | |||
| 38fd4bb284 | |||
| 9ef00be261 | |||
| be82c25486 | |||
| 7e220077a6 | |||
| 2588b5a43f | |||
| 0ecbe33718 | |||
| a96909cfaf | |||
| 802d559431 | |||
| 119d4693e0 | |||
| 5983ad0b03 | |||
| 35ca0e7a1c | |||
| 019b9c644e | |||
| 20b4f463f4 | |||
| 914e85a0a6 | |||
| 2369c15407 | |||
| 0c171716c0 | |||
| 179f1b9a7d | |||
| 328da0dcb7 | |||
| 6300317b15 | |||
| f365482736 | |||
| 3930415057 | |||
| 014069a7ac | |||
| c25558bff4 | |||
| d6547fc647 | |||
| da94fdf258 | |||
| 9f7820f83b | |||
| 91715873d1 | |||
| 863c1a9079 | |||
| 1bdd42627d | |||
| febef53cea | |||
| b5760a1ce5 | |||
| f1d2501ebe | |||
| 00ded43a5a | |||
| c1a50246e3 | |||
| 5fac467474 | |||
| d1413d9098 | |||
| 4ca812b153 | |||
| bf73b91c66 | |||
| 289a90551d | |||
| 42bc6dde46 |
@@ -1,4 +1,4 @@
|
||||
*change.txt* For Vim version 7.4. Last change: 2016 Feb 10
|
||||
*change.txt* For Vim version 7.4. Last change: 2016 Mar 08
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -109,7 +109,9 @@ is an error when 'cpoptions' includes the 'E' flag.
|
||||
*J*
|
||||
J Join [count] lines, with a minimum of two lines.
|
||||
Remove the indent and insert up to two spaces (see
|
||||
below).
|
||||
below). Fails when on the last line of the buffer.
|
||||
If [count] is too big it is reduce to the number of
|
||||
lines available.
|
||||
|
||||
*v_J*
|
||||
{Visual}J Join the highlighted lines, with a minimum of two
|
||||
|
||||
+92
-48
@@ -1,4 +1,4 @@
|
||||
*channel.txt* For Vim version 7.4. Last change: 2016 Feb 27
|
||||
*channel.txt* For Vim version 7.4. Last change: 2016 Mar 12
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -44,8 +44,8 @@ There are four main types of jobs:
|
||||
4. Running a filter, synchronously.
|
||||
Uses pipes.
|
||||
|
||||
For when using sockets See |job-start|, |job-may-start| and |channel-open|.
|
||||
For 2 and 3, one or more jobs using pipes, see |job-start|.
|
||||
For when using sockets See |job-start|, |job-start-nochannel| and
|
||||
|channel-open|. For 2 and 3, one or more jobs using pipes, see |job-start|.
|
||||
For 4 use the ":{range}!cmd" command, see |filter|.
|
||||
|
||||
Over the socket and pipes these protocols are available:
|
||||
@@ -103,6 +103,11 @@ when opening the channel: >
|
||||
let channel = ch_open('localhost:8765', {'callback': "MyHandler"})
|
||||
call ch_sendexpr(channel, 'hello!')
|
||||
|
||||
When trying out channels it's useful to see what is going on. You can tell
|
||||
Vim to write lines in log file: >
|
||||
call ch_logfile('channellog', 'w')
|
||||
See |ch_logfile()|.
|
||||
|
||||
==============================================================================
|
||||
3. Opening a channel *channel-open*
|
||||
|
||||
@@ -130,7 +135,8 @@ Use |ch_status()| to see if the channel could be opened.
|
||||
overwritten. Therefore set "mode" first and the part specific
|
||||
mode later.
|
||||
|
||||
Note: when writing to a file or buffer NL mode is always used.
|
||||
Note: when writing to a file or buffer and when reading from a
|
||||
buffer NL mode is used by default.
|
||||
|
||||
*channel-callback*
|
||||
"callback" A function that is called when a message is received that is
|
||||
@@ -156,7 +162,7 @@ Use |ch_status()| to see if the channel could be opened.
|
||||
the channel uses pipes. When "err-cb" wasn't set the channel
|
||||
callback is used.
|
||||
|
||||
TODO: *close-cb*
|
||||
*close-cb*
|
||||
"close-cb" A function that is called when the channel gets closed, other
|
||||
than by calling ch_close(). It should be defined like this: >
|
||||
func MyCloseHandler(channel)
|
||||
@@ -191,6 +197,10 @@ For example, the handler can be added or changed: >
|
||||
call ch_setoptions(channel, {'callback': callback})
|
||||
When "callback" is empty (zero or an empty string) the handler is removed.
|
||||
|
||||
After a callback has been invoked Vim will update the screen and put the
|
||||
cursor back where it belongs. Thus the callback should not need to do
|
||||
`:redraw`.
|
||||
|
||||
The timeout can be changed: >
|
||||
call ch_setoptions(channel, {'timeout': msec})
|
||||
<
|
||||
@@ -259,9 +269,9 @@ message, it must use the number zero:
|
||||
Then channel handler will then get {response} converted to Vim types. If the
|
||||
channel does not have a handler the message is dropped.
|
||||
|
||||
On read error or ch_close(), when using a socket, the string "DETACH" is sent,
|
||||
if still possible. The channel will then be inactive. For a JSON and JS mode
|
||||
channel quotes are used around DETACH, otherwise there are no quotes.
|
||||
On read error or ch_close(), when using a socket with RAW or NL mode, the
|
||||
string "DETACH\n" is sent, if still possible. The channel will then be
|
||||
inactive.
|
||||
|
||||
It is also possible to use ch_sendraw() and ch_evalraw() on a JSON or JS
|
||||
channel. The caller is then completely responsible for correct encoding and
|
||||
@@ -400,7 +410,6 @@ are:
|
||||
"open" The channel can be used.
|
||||
"closed" The channel was closed.
|
||||
|
||||
TODO:
|
||||
To obtain the job associated with a channel: ch_getjob(channel)
|
||||
|
||||
To read one message from a channel: >
|
||||
@@ -457,45 +466,51 @@ For example, to start a job and write its output in buffer "dummy": >
|
||||
\ {'out-io': 'buffer', 'out-name': 'dummy'})
|
||||
sbuf dummy
|
||||
|
||||
TODO:
|
||||
To run a job and read its output once it is done: >
|
||||
let job = job_start({command}, {'exit-cb': 'MyHandler'})
|
||||
func MyHandler(job, status)
|
||||
let channel = job_getchannel()
|
||||
let output = ch_readall(channel)
|
||||
" parse output
|
||||
endfunc
|
||||
|
||||
Job input from a buffer ~
|
||||
|
||||
To run a job that reads from a buffer: >
|
||||
let job = job_start({command},
|
||||
\ {'in-io': 'buffer', 'in-name': 'mybuffer'})
|
||||
<
|
||||
*E915* *E918*
|
||||
The buffer is found by name, similar to |bufnr()|. The buffer must exist and
|
||||
be loaded when job_start() is called.
|
||||
|
||||
By default this reads the whole buffer. This can be changed with the "in-top"
|
||||
and "in-bot" options.
|
||||
|
||||
A special mode is when "in-top" is set to zero and "in-bot" is not set: Every
|
||||
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.
|
||||
|
||||
==============================================================================
|
||||
9. Starting a job without a channel *job-start-nochannel*
|
||||
|
||||
To start another process without creating a channel: >
|
||||
let job = job_start(command, {"in-io": "null", "out-io": "null"})
|
||||
let job = job_start(command,
|
||||
\ {"in-io": "null", "out-io": "null", "err-io": "null"})
|
||||
|
||||
This starts {command} in the background, Vim does not wait for it to finish.
|
||||
|
||||
TODO:
|
||||
When Vim sees that neither stdin, stdout or stderr are connected, no channel
|
||||
will be created. Often you will want to include redirection in the command to
|
||||
avoid it getting stuck.
|
||||
|
||||
There are several options you can use, see |job-options|.
|
||||
|
||||
TODO: *job-may-start*
|
||||
To start a job only when connecting to an address does not work use
|
||||
job_maystart('command', {address}, {options}), For Example: >
|
||||
let job = job_maystart(command, address, {"waittime": 1000})
|
||||
let channel = job_gethandle(job)
|
||||
|
||||
This comes down to: >
|
||||
*job-start-if-needed*
|
||||
To start a job only when connecting to an address does not work, do something
|
||||
like this: >
|
||||
let channel = ch_open(address, {"waittime": 0})
|
||||
if ch_status(channel) == "fail"
|
||||
let job = job_start(command)
|
||||
let channel = ch_open(address, {"waittime": 1000})
|
||||
call job_sethandle(channel)
|
||||
endif
|
||||
Note that the specified waittime applies to when the job has been started.
|
||||
This gives the job some time to make the port available.
|
||||
|
||||
Note that the waittime for ch_open() gives the job one second to make the port
|
||||
available.
|
||||
|
||||
==============================================================================
|
||||
10. Job options *job-options*
|
||||
@@ -530,37 +545,58 @@ See |job_setoptions()| and |ch_setoptions()|.
|
||||
"stoponexit": "" Do not stop the job when Vim exits.
|
||||
The default is "term".
|
||||
|
||||
TODO: *job-term*
|
||||
*job-term*
|
||||
"term": "open" Start a terminal and connect the job
|
||||
stdin/stdout/stderr to it.
|
||||
NOTE: Not implemented yet!
|
||||
|
||||
*job-in-io*
|
||||
"in-io": "null" disconnect stdin TODO
|
||||
"channel": {channel} Use an existing channel instead of creating a new one.
|
||||
The parts of the channel that get used for the new job
|
||||
will be disconnected from what they were used before.
|
||||
If the channel was still use by another job this may
|
||||
cause I/O errors.
|
||||
Existing callbacks and other settings remain.
|
||||
|
||||
*job-in-io* *in-top* *in-bot* *in-name* *in-buf*
|
||||
"in-io": "null" disconnect stdin (read from /dev/null)
|
||||
"in-io": "pipe" stdin is connected to the channel (default)
|
||||
"in-io": "file" stdin reads from a file TODO
|
||||
"in-io": "buffer" stdin reads from a buffer TODO
|
||||
"in-name": "/path/file" the name of he file or buffer to read from
|
||||
"in-buf": number the number of the buffer to read from TODO
|
||||
"in-io": "file" stdin reads from a file
|
||||
"in-io": "buffer" stdin reads from a buffer
|
||||
"in-top": number when using "buffer": first line to send (default: 1)
|
||||
"in-bot": number when using "buffer": last line to send (default: last)
|
||||
"in-name": "/path/file" the name of the file or buffer to read from
|
||||
"in-buf": number the number of the buffer to read from
|
||||
|
||||
*job-out-io*
|
||||
"out-io": "null" disconnect stdout TODO
|
||||
*job-out-io* *out-name* *out-buf*
|
||||
"out-io": "null" disconnect stdout (goes to /dev/null)
|
||||
"out-io": "pipe" stdout is connected to the channel (default)
|
||||
"out-io": "file" stdout writes to a file TODO
|
||||
"out-io": "file" stdout writes to a file
|
||||
"out-io": "buffer" stdout appends to a buffer
|
||||
"out-name": "/path/file" the name of the file or buffer to write to
|
||||
"out-buf": number the number of the buffer to write to TODO
|
||||
"out-buf": number the number of the buffer to write to
|
||||
|
||||
*job-err-io*
|
||||
"err-io": "out" same as stdout TODO
|
||||
"err-io": "null" disconnect stderr TODO
|
||||
*job-err-io* *err-name* *err-buf*
|
||||
"err-io": "out" stderr messages to go to stdout
|
||||
"err-io": "null" disconnect stderr (goes to /dev/null)
|
||||
"err-io": "pipe" stderr is connected to the channel (default)
|
||||
"err-io": "file" stderr writes to a file TODO
|
||||
"err-io": "buffer" stderr appends to a buffer TODO
|
||||
"err-io": "file" stderr writes to a file
|
||||
"err-io": "buffer" stderr appends to a buffer
|
||||
"err-name": "/path/file" the name of the file or buffer to write to
|
||||
"err-buf": number the number of the buffer to write to TODO
|
||||
"err-buf": number the number of the buffer to write to
|
||||
|
||||
When the IO mode is "buffer" and there is a callback, the text is appended to
|
||||
the buffer before invoking the callback.
|
||||
|
||||
Writing to a buffer ~
|
||||
|
||||
When the out-io or err-io mode is "buffer" and there is a callback, the text
|
||||
is appended to the buffer before invoking the callback.
|
||||
|
||||
When a buffer is used both for input and output, the output lines are put
|
||||
above the last line, since the last line is what is written to the channel
|
||||
input. Otherwise lines are appended below the last line.
|
||||
|
||||
When using JS or JSON mode with "buffer", only messages with zero or negative
|
||||
ID will be added to the buffer, after decoding + encoding. Messages with a
|
||||
positive number will be handled by a callback, commands are handled as usual.
|
||||
|
||||
The name of the buffer is compared the full name of existing buffers. If
|
||||
there is a match that buffer is used. Otherwise a new buffer is created.
|
||||
@@ -576,6 +612,14 @@ line and the window is scrolled up to show the cursor if needed.
|
||||
|
||||
Undo is synced for every added line.
|
||||
|
||||
|
||||
Writing to a file ~
|
||||
|
||||
The file is created with permissions 600 (read-write for the user, not
|
||||
accessible for others). Use |setfperm()| to change this.
|
||||
|
||||
If the file already exists it is truncated.
|
||||
|
||||
==============================================================================
|
||||
11. Controlling a job *job-control*
|
||||
|
||||
|
||||
+98
-51
@@ -1,4 +1,4 @@
|
||||
*eval.txt* For Vim version 7.4. Last change: 2016 Feb 27
|
||||
*eval.txt* For Vim version 7.4. Last change: 2016 Mar 12
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -113,16 +113,8 @@ to Float, printf() for Float to String and float2nr() for Float to Number.
|
||||
*E891* *E892* *E893* *E894* *E907* *E911* *E914*
|
||||
When expecting a Float a Number can also be used, but nothing else.
|
||||
|
||||
*E706* *sticky-type-checking*
|
||||
You will get an error if you try to change the type of a variable. You need
|
||||
to |:unlet| it first to avoid this error. String and Number are considered
|
||||
equivalent though, as well are Float and Number. Consider this sequence of
|
||||
commands: >
|
||||
:let l = "string"
|
||||
:let l = 44 " changes type from String to Number
|
||||
:let l = [1, 2, 3] " error! l is still a Number
|
||||
:let l = 4.4 " changes type from Number to Float
|
||||
:let l = "string" " error!
|
||||
*no-type-checking*
|
||||
You will not get an error if you try to change the type of a variable.
|
||||
|
||||
|
||||
1.2 Function references ~
|
||||
@@ -1817,24 +1809,24 @@ byteidxcomp( {expr}, {nr}) Number byte index of {nr}'th char in {expr}
|
||||
call( {func}, {arglist} [, {dict}])
|
||||
any call {func} with arguments {arglist}
|
||||
ceil( {expr}) Float round {expr} up
|
||||
ch_close( {channel}) none close {channel}
|
||||
ch_evalexpr( {channel}, {expr} [, {options}])
|
||||
any evaluate {expr} on JSON {channel}
|
||||
ch_evalraw( {channel}, {string} [, {options}])
|
||||
any evaluate {string} on raw {channel}
|
||||
ch_getbufnr( {channel}, {what}) Number get buffer number for {channel}/{what}
|
||||
ch_close( {handle}) none close {handle}
|
||||
ch_evalexpr( {handle}, {expr} [, {options}])
|
||||
any evaluate {expr} on JSON {handle}
|
||||
ch_evalraw( {handle}, {string} [, {options}])
|
||||
any evaluate {string} on raw {handle}
|
||||
ch_getbufnr( {handle}, {what}) Number get buffer number for {handle}/{what}
|
||||
ch_getjob( {channel}) Job get the Job of {channel}
|
||||
ch_log( {msg} [, {channel}]) none write {msg} in the channel log file
|
||||
ch_log( {msg} [, {handle}]) none write {msg} in the channel log file
|
||||
ch_logfile( {fname} [, {mode}]) none start logging channel activity
|
||||
ch_open( {address} [, {options}]) Channel open a channel to {address}
|
||||
ch_read( {channel} [, {options}]) String read from {channel}
|
||||
ch_readraw( {channel} [, {options}]) String read raw from {channel}
|
||||
ch_sendexpr( {channel}, {expr} [, {options}])
|
||||
any send {expr} over JSON {channel}
|
||||
ch_sendraw( {channel}, {string} [, {options}])
|
||||
any send {string} over raw {channel}
|
||||
ch_setoptions( {channel}, {options}) none set options for {channel}
|
||||
ch_status( {channel}) String status of {channel}
|
||||
ch_read( {handle} [, {options}]) String read from {handle}
|
||||
ch_readraw( {handle} [, {options}]) String read raw from {handle}
|
||||
ch_sendexpr( {handle}, {expr} [, {options}])
|
||||
any send {expr} over JSON {handle}
|
||||
ch_sendraw( {handle}, {string} [, {options}])
|
||||
any send {string} over raw {handle}
|
||||
ch_setoptions( {handle}, {options}) none set options for {handle}
|
||||
ch_status( {handle}) String status of {handle}
|
||||
changenr() Number current change number
|
||||
char2nr( {expr}[, {utf8}]) Number ASCII/UTF8 value of first char in {expr}
|
||||
cindent( {lnum}) Number C indent for line {lnum}
|
||||
@@ -1969,6 +1961,7 @@ islocked( {expr}) Number TRUE if {expr} is locked
|
||||
isnan( {expr}) Number TRUE if {expr} is NaN
|
||||
items( {dict}) List key-value pairs in {dict}
|
||||
job_getchannel( {job}) Channel get the channel handle for {job}
|
||||
job_info( {job}) Dict get information about {job}
|
||||
job_setoptions( {job}, {options}) none set options for {job}
|
||||
job_start( {command} [, {options}]) Job start a job
|
||||
job_status( {job}) String get the status of {job}
|
||||
@@ -2067,6 +2060,7 @@ serverlist() String get a list of available servers
|
||||
setbufvar( {expr}, {varname}, {val}) set {varname} in buffer {expr} to {val}
|
||||
setcharsearch( {dict}) Dict set character search from {dict}
|
||||
setcmdpos( {pos}) Number set cursor position in command-line
|
||||
setfperm( {fname}, {mode}) Number set {fname} file permissions to {mode}
|
||||
setline( {lnum}, {line}) Number set line {lnum} to {line}
|
||||
setloclist( {nr}, {list}[, {action}])
|
||||
Number modify location list using {list}
|
||||
@@ -2693,17 +2687,27 @@ confirm({msg} [, {choices} [, {default} [, {type}]]])
|
||||
don't fit, a vertical layout is used anyway. For some systems
|
||||
the horizontal layout is always used.
|
||||
|
||||
ch_close({channel}) *ch_close()*
|
||||
Close {channel}. See |channel-close|.
|
||||
ch_close({handle}) *ch_close()*
|
||||
Close {handle}. See |channel-close|.
|
||||
{handle} can be Channel or a Job that has a Channel.
|
||||
|
||||
Note that a channel is closed in three stages:
|
||||
- The I/O ends, log message: "Closing channel". There can
|
||||
still be queued messages to read or callbacks to invoke.
|
||||
- The readahead is cleared, log message: "Clearing channel".
|
||||
Some variables may still reference the channel.
|
||||
- The channel is freed, log message: "Freeing channel".
|
||||
|
||||
{only available when compiled with the |+channel| feature}
|
||||
|
||||
ch_evalexpr({channel}, {expr} [, {options}]) *ch_evalexpr()*
|
||||
Send {expr} over {channel}. The {expr} is encoded
|
||||
ch_evalexpr({handle}, {expr} [, {options}]) *ch_evalexpr()*
|
||||
Send {expr} over {handle}. The {expr} is encoded
|
||||
according to the type of channel. The function cannot be used
|
||||
with a raw channel. See |channel-use|.
|
||||
{handle} can be Channel or a Job that has a Channel.
|
||||
*E917*
|
||||
{options} must be a Dictionary. It must not have a "callback"
|
||||
entry.
|
||||
entry. It can have a "timeout" entry.
|
||||
|
||||
ch_evalexpr() waits for a response and returns the decoded
|
||||
expression. When there is an error or timeout it returns an
|
||||
@@ -2711,8 +2715,10 @@ ch_evalexpr({channel}, {expr} [, {options}]) *ch_evalexpr()*
|
||||
|
||||
{only available when compiled with the |+channel| feature}
|
||||
|
||||
ch_evalraw({channel}, {string} [, {options}]) *ch_evalraw()*
|
||||
Send {string} over {channel}.
|
||||
ch_evalraw({handle}, {string} [, {options}]) *ch_evalraw()*
|
||||
Send {string} over {handle}.
|
||||
{handle} can be Channel or a Job that has a Channel.
|
||||
|
||||
Works like |ch_evalexpr()|, but does not encode the request or
|
||||
decode the response. The caller is responsible for the
|
||||
correct contents. Also does not add a newline for a channel
|
||||
@@ -2722,8 +2728,9 @@ ch_evalraw({channel}, {string} [, {options}]) *ch_evalraw()*
|
||||
|
||||
{only available when compiled with the |+channel| feature}
|
||||
|
||||
ch_getbufnr({channel}, {what}) *ch_getbufnr()*
|
||||
Get the buffer number that {channel} is using for {what}.
|
||||
ch_getbufnr({handle}, {what}) *ch_getbufnr()*
|
||||
Get the buffer number that {handle} is using for {what}.
|
||||
{handle} can be Channel or a Job that has a Channel.
|
||||
{what} can be "err" for stderr, "out" for stdout or empty for
|
||||
socket output.
|
||||
Returns -1 when there is no buffer.
|
||||
@@ -2737,11 +2744,13 @@ ch_getjob({channel}) *ch_getjob()*
|
||||
{only available when compiled with the |+channel| and
|
||||
|+job| features}
|
||||
|
||||
ch_log({msg} [, {channel}]) *ch_log()*
|
||||
ch_log({msg} [, {handle}]) *ch_log()*
|
||||
Write {msg} in the channel log file, if it was opened with
|
||||
|ch_logfile()|.
|
||||
When {channel} is passed the channel number is used for the
|
||||
message. {channel} must be an open channel.
|
||||
When {handle} is passed the channel number is used for the
|
||||
message.
|
||||
{handle} can be Channel or a Job that has a Channel. The
|
||||
Channel must open.
|
||||
|
||||
ch_logfile({fname} [, {mode}]) *ch_logfile()*
|
||||
Start logging channel activity to {fname}.
|
||||
@@ -2753,6 +2762,7 @@ ch_logfile({fname} [, {mode}]) *ch_logfile()*
|
||||
The file is flushed after every message, on Unix you can use
|
||||
"tail -f" to see what is going on in real time.
|
||||
|
||||
|
||||
ch_open({address} [, {options}]) *ch_open()*
|
||||
Open a channel to {address}. See |channel|.
|
||||
Returns a Channel. Use |ch_status()| to check for
|
||||
@@ -2776,8 +2786,9 @@ ch_open({address} [, {options}]) *ch_open()*
|
||||
Default: 2000.
|
||||
{only available when compiled with the |+channel| feature}
|
||||
|
||||
ch_read({channel} [, {options}]) *ch_read()*
|
||||
Read from {channel} and return the received message.
|
||||
ch_read({handle} [, {options}]) *ch_read()*
|
||||
Read from {handle} and return the received message.
|
||||
{handle} can be Channel or a Job that has a Channel.
|
||||
|
||||
This uses the channel timeout. When there is nothing to read
|
||||
within that time an empty string is returned. To specify a
|
||||
@@ -2797,14 +2808,15 @@ ch_read({channel} [, {options}]) *ch_read()*
|
||||
For a JS or JSON channel this returns one decoded message.
|
||||
This includes any sequence number.
|
||||
|
||||
ch_readraw({channel} [, {options}]) *ch_readraw()*
|
||||
ch_readraw({handle} [, {options}]) *ch_readraw()*
|
||||
Like ch_read() but for a JS and JSON channel does not decode
|
||||
the message.
|
||||
|
||||
ch_sendexpr({channel}, {expr} [, {options}]) *ch_sendexpr()*
|
||||
Send {expr} over {channel}. The {expr} is encoded
|
||||
ch_sendexpr({handle}, {expr} [, {options}]) *ch_sendexpr()*
|
||||
Send {expr} over {handle}. The {expr} is encoded
|
||||
according to the type of channel. The function cannot be used
|
||||
with a raw channel. See |channel-use|. *E912*
|
||||
{handle} can be Channel or a Job that has a Channel.
|
||||
|
||||
{options} must be a Dictionary. The "callback" item is a
|
||||
Funcref or the name of a function it is invoked when the
|
||||
@@ -2814,8 +2826,8 @@ ch_sendexpr({channel}, {expr} [, {options}]) *ch_sendexpr()*
|
||||
|
||||
{only available when compiled with the |+channel| feature}
|
||||
|
||||
ch_sendraw({channel}, {string} [, {options}]) *ch_sendraw()*
|
||||
Send {string} over {channel}.
|
||||
ch_sendraw({handle}, {string} [, {options}]) *ch_sendraw()*
|
||||
Send {string} over {handle}.
|
||||
Works like |ch_sendexpr()|, but does not encode the request or
|
||||
decode the response. The caller is responsible for the
|
||||
correct contents. Also does not add a newline for a channel
|
||||
@@ -2825,12 +2837,13 @@ ch_sendraw({channel}, {string} [, {options}]) *ch_sendraw()*
|
||||
|
||||
{only available when compiled with the |+channel| feature}
|
||||
|
||||
ch_setoptions({channel}, {options}) *ch_setoptions()*
|
||||
Set options on {channel}:
|
||||
ch_setoptions({handle}, {options}) *ch_setoptions()*
|
||||
Set options on {handle}:
|
||||
"callback" the channel callback
|
||||
"timeout" default read timeout in msec
|
||||
"mode" mode for the whole channel
|
||||
See |ch_open()| for more explanation.
|
||||
{handle} can be Channel or a Job that has a Channel.
|
||||
|
||||
Note that changing the mode may cause queued messages to be
|
||||
lost.
|
||||
@@ -2838,11 +2851,12 @@ ch_setoptions({channel}, {options}) *ch_setoptions()*
|
||||
These options cannot be changed:
|
||||
"waittime" only applies to "ch_open()|
|
||||
|
||||
ch_status({channel}) *ch_status()*
|
||||
Return the status of {channel}:
|
||||
ch_status({handle}) *ch_status()*
|
||||
Return the status of {handle}:
|
||||
"fail" failed to open the channel
|
||||
"open" channel can be used
|
||||
"closed" channel can not be used
|
||||
{handle} can be Channel or a Job that has a Channel.
|
||||
|
||||
*copy()*
|
||||
copy({expr}) Make a copy of {expr}. For Numbers and Strings this isn't
|
||||
@@ -3810,6 +3824,8 @@ getfperm({fname}) *getfperm()*
|
||||
< This will hopefully (from a security point of view) display
|
||||
the string "rw-r--r--" or even "rw-------".
|
||||
|
||||
For setting permissins use |setfperm()|.
|
||||
|
||||
getftime({fname}) *getftime()*
|
||||
The result is a Number, which is the last modification time of
|
||||
the given file {fname}. The value is measured as seconds
|
||||
@@ -4445,12 +4461,23 @@ items({dict}) *items()*
|
||||
|
||||
job_getchannel({job}) *job_getchannel()*
|
||||
Get the channel handle that {job} is using.
|
||||
To check if the job has no channel: >
|
||||
if string(job_getchannel()) == 'channel fail'
|
||||
<
|
||||
{only available when compiled with the |+job| feature}
|
||||
|
||||
job_info({job}) *job_info()*
|
||||
Returns a Dictionary with information about {job}:
|
||||
"status" what |job_status()| returns
|
||||
"channel" what |job_getchannel()| returns
|
||||
"exitval" only valid when "status" is "dead"
|
||||
"exit-cb" function to be called on exit
|
||||
"stoponexit" |job-stoponexit|
|
||||
|
||||
job_setoptions({job}, {options}) *job_setoptions()*
|
||||
Change options for {job}. Supported are:
|
||||
"stoponexit" |job-stoponexit|
|
||||
"exit-cb" |job-exit-cb|
|
||||
"stoponexit" |job-stoponexit|
|
||||
"exit-cb" |job-exit-cb|
|
||||
|
||||
job_start({command} [, {options}]) *job_start()*
|
||||
Start a job and return a Job object. Unlike |system()| and
|
||||
@@ -4501,6 +4528,8 @@ job_status({job}) *job_status()* *E916*
|
||||
If an exit callback was set with the "exit-cb" option and the
|
||||
job is now detected to be "dead" the callback will be invoked.
|
||||
|
||||
For more information see |job_info()|.
|
||||
|
||||
{only available when compiled with the |+job| feature}
|
||||
|
||||
job_stop({job} [, {how}]) *job_stop()*
|
||||
@@ -5981,6 +6010,24 @@ setcmdpos({pos}) *setcmdpos()*
|
||||
Returns 0 when successful, 1 when not editing the command
|
||||
line.
|
||||
|
||||
setfperm({fname}, {mode}) *setfperm()* *chmod*
|
||||
Set the file permissions for {fname} to {mode}.
|
||||
{mode} must be a string with 9 characters. It is of the form
|
||||
"rwxrwxrwx", where each group of "rwx" flags represent, in
|
||||
turn, the permissions of the owner of the file, the group the
|
||||
file belongs to, and other users. A '-' character means the
|
||||
permission is off, any other character means on. Multi-byte
|
||||
characters are not supported.
|
||||
|
||||
For example "rw-r-----" means read-write for the user,
|
||||
readable by the group, not accessible by others. "xx-x-----"
|
||||
would do the same thing.
|
||||
|
||||
Returns non-zero for success, zero for failure.
|
||||
|
||||
To read permissions see |getfperm()|.
|
||||
|
||||
|
||||
setline({lnum}, {text}) *setline()*
|
||||
Set line {lnum} of the current buffer to {text}. To insert
|
||||
lines use |append()|.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*index.txt* For Vim version 7.4. Last change: 2016 Feb 27
|
||||
*index.txt* For Vim version 7.4. Last change: 2016 Mar 04
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -1324,7 +1324,6 @@ tag command action ~
|
||||
|:lnfile| :lnf[ile] go to first location in next file
|
||||
|:lnoremap| :ln[oremap] like ":noremap!" but includes Lang-Arg mode
|
||||
|:loadkeymap| :loadk[eymap] load the following keymaps until EOF
|
||||
|:loadplugin| :loadp[lugin] load a plugin from 'packpath'
|
||||
|:loadview| :lo[adview] load view for current window from a file
|
||||
|:lockmarks| :loc[kmarks] following command keeps marks where they are
|
||||
|:lockvar| :lockv[ar] lock variables
|
||||
@@ -1397,6 +1396,7 @@ tag command action ~
|
||||
|:ounmap| :ou[nmap] like ":unmap" but for Operator-pending mode
|
||||
|:ounmenu| :ounme[nu] remove menu for Operator-pending mode
|
||||
|:ownsyntax| :ow[nsyntax] set new local syntax highlight for this window
|
||||
|:packadd| :pa[ckadd] add a plugin from 'packpath'
|
||||
|:pclose| :pc[lose] close preview window
|
||||
|:pedit| :ped[it] edit file in the preview window
|
||||
|:perl| :pe[rl] execute Perl command
|
||||
|
||||
+10
-8
@@ -1,4 +1,4 @@
|
||||
*options.txt* For Vim version 7.4. Last change: 2016 Feb 24
|
||||
*options.txt* For Vim version 7.4. Last change: 2016 Mar 08
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -7909,14 +7909,16 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
{not in Vi}
|
||||
{only in the GTK+ 2 and MacVim GUIs}
|
||||
Controls the size of toolbar icons. The possible values are:
|
||||
tiny Use tiny toolbar icons.
|
||||
small Use small toolbar icons (default).
|
||||
medium Use medium-sized toolbar icons.
|
||||
large Use large toolbar icons.
|
||||
tiny Use tiny icons.
|
||||
small Use small icons (default).
|
||||
medium Use medium-sized icons.
|
||||
large Use large icons.
|
||||
huge Use even larger icons.
|
||||
giant Use very big icons.
|
||||
The exact dimensions in pixels of the various icon sizes depend on
|
||||
the current theme. Common dimensions are large=32x32, medium=24x24,
|
||||
small=20x20 and tiny=16x16. In MacVim, both tiny and small equal
|
||||
24x24, whereas medium and large equal 32x32.
|
||||
the current theme. Common dimensions are giant=48x48, huge=32x32,
|
||||
large=24x24, medium=24x24, small=20x20 and tiny=16x16. In MacVim, both
|
||||
tiny and small equal 24x24, whereas medium and large equal 32x32.
|
||||
|
||||
If 'toolbariconsize' is empty, the global default size as determined
|
||||
by user preferences or the current theme is used.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*os_win32.txt* For Vim version 7.4. Last change: 2014 Sep 25
|
||||
*os_win32.txt* For Vim version 7.4. Last change: 2016 Mar 05
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by George Reilly
|
||||
@@ -96,6 +96,31 @@ The directory of the Vim executable is appended to $PATH. This is mostly to
|
||||
make "!xxd" work, as it is in the Tools menu. And it also means that when
|
||||
executable() returns 1 the executable can actually be executed.
|
||||
|
||||
Quotes in file names *win32-quotes*
|
||||
|
||||
Quotes inside a file name (or any other command line argument) can be escaped
|
||||
with a backslash. E.g. >
|
||||
vim -c "echo 'foo\"bar'"
|
||||
|
||||
Alternatively use three quotes to get one: >
|
||||
vim -c "echo 'foo"""bar'"
|
||||
|
||||
The quotation rules are:
|
||||
|
||||
1. A `"` starts quotation.
|
||||
2. Another `"` or `""` ends quotation. If the quotation ends with `""`, a `"`
|
||||
is produced at the end of the quoted string.
|
||||
|
||||
Examples, with [] around an argument:
|
||||
"foo" -> [foo]
|
||||
"foo"" -> [foo"]
|
||||
"foo"bar -> [foobar]
|
||||
"foo" bar -> [foo], [bar]
|
||||
"foo""bar -> [foo"bar]
|
||||
"foo"" bar -> [foo"], [bar]
|
||||
"foo"""bar" -> [foo"bar]
|
||||
|
||||
|
||||
==============================================================================
|
||||
3. Restore screen contents *win32-restore*
|
||||
|
||||
|
||||
+107
-43
@@ -1,4 +1,4 @@
|
||||
*repeat.txt* For Vim version 7.4. Last change: 2016 Feb 26
|
||||
*repeat.txt* For Vim version 7.4. Last change: 2016 Mar 09
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -182,10 +182,12 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
|
||||
{not in Vi}
|
||||
|
||||
*:ru* *:runtime*
|
||||
:ru[ntime][!] {file} ..
|
||||
:ru[ntime][!] [where] {file} ..
|
||||
Read Ex commands from {file} in each directory given
|
||||
by 'runtimepath'. There is no error for non-existing
|
||||
files. Example: >
|
||||
by 'runtimepath' and/or 'packpath'. There is no error
|
||||
for non-existing files.
|
||||
|
||||
Example: >
|
||||
:runtime syntax/c.vim
|
||||
|
||||
< There can be multiple {file} arguments, separated by
|
||||
@@ -199,6 +201,15 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
|
||||
When it is not included only the first found file is
|
||||
sourced.
|
||||
|
||||
When [where] is omitted only 'runtimepath' is used.
|
||||
Other values:
|
||||
START search under "start" in 'packpath'
|
||||
OPT search under "opt" in 'packpath'
|
||||
PACK search under "start" and "opt" in
|
||||
'packpath'
|
||||
ALL first use 'runtimepath', then search
|
||||
under "start" and "opt" in 'packpath'
|
||||
|
||||
When {file} contains wildcards it is expanded to all
|
||||
matching files. Example: >
|
||||
:runtime! plugin/*.vim
|
||||
@@ -213,23 +224,41 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
|
||||
about each searched file.
|
||||
{not in Vi}
|
||||
|
||||
*:loadp* *:loadplugin*
|
||||
:loadp[lugin] {name} Search for an optional plugin directory and source the
|
||||
plugin files found. It is similar to: >
|
||||
:runtime pack/*/opt/{name}/plugin/*.vim
|
||||
< However, `:loadplugin` uses 'packpath' instead of
|
||||
'runtimepath'. And the directory found is added to
|
||||
'runtimepath'.
|
||||
|
||||
If you have a directory under 'packpath' that doesn't
|
||||
actually have a plugin file, just create an empty one.
|
||||
This will still add the directory to 'runtimepath'.
|
||||
*:pa* *:packadd* *E919*
|
||||
:pa[ckadd][!] {name} Search for an optional plugin directory in 'packpath'
|
||||
and source any plugin files found. The directory must
|
||||
match:
|
||||
pack/*/opt/{name} ~
|
||||
The directory is added to 'runtimepath' if it wasn't
|
||||
there yet.
|
||||
|
||||
Note that {name} is the directory name, not the name
|
||||
of the .vim file. If the "{name}/plugin" directory
|
||||
contains more than one file they are all sourced.
|
||||
|
||||
Also see |load-plugin|.
|
||||
If the filetype detection was not enabled yet (this
|
||||
is usually done with a "syntax enable" or "filetype
|
||||
on" command in your .vimrc file), this will also look
|
||||
for "{name}/ftdetect/*.vim" files.
|
||||
|
||||
When the optional ! is added no plugin files or
|
||||
ftdetect scripts are loaded, only the matching
|
||||
directories are added to 'runtimepath'. This is
|
||||
useful in your .vimrc. The plugins will then be
|
||||
loaded during initialization, see |load-plugins|.
|
||||
|
||||
Also see |pack-add|.
|
||||
|
||||
:packloadall[!] Load all packages in the "start" directories under
|
||||
'packpath'. The directories found are added to
|
||||
'runtimepath'.
|
||||
This normally done during startup, after loading your
|
||||
.vimrc file. With this command it can be done
|
||||
earlier.
|
||||
Packages will be loaded only once. After this command
|
||||
it won't happen again. When the optional ! is added
|
||||
this command will load packages even when done before.
|
||||
See |packages|.
|
||||
|
||||
:scripte[ncoding] [encoding] *:scripte* *:scriptencoding* *E167*
|
||||
Specify the character encoding used in the script.
|
||||
@@ -412,49 +441,84 @@ Rationale:
|
||||
A Vim package is a directory that contains one or more plugins. The
|
||||
advantages over normal plugins:
|
||||
- A package can be downloaded as an archive and unpacked in its own directory.
|
||||
That makes it easy to updated and/or remove.
|
||||
- A package can be a git, mercurial, etc. respository. That makes it really
|
||||
Thus the files are not mixed with files of other plugins. That makes it
|
||||
easy to update and remove.
|
||||
- A package can be a git, mercurial, etc. repository. That makes it really
|
||||
easy to update.
|
||||
- A package can contain multiple plugins that depend on each other.
|
||||
- A package can contain plugins that are automatically loaded on startup and
|
||||
ones that are only loaded when needed with `:loadplugin`.
|
||||
ones that are only loaded when needed with `:packadd`.
|
||||
|
||||
|
||||
Using a package and loading automatically ~
|
||||
|
||||
Let's assume your Vim files are in the "~/.vim" directory and you want to add a
|
||||
package from a zip archive "/tmp/mypack.zip":
|
||||
% mkdir -p ~/.vim/pack/my
|
||||
% cd ~/.vim/pack/my
|
||||
% unzip /tmp/mypack.zip
|
||||
package from a zip archive "/tmp/foopack.zip":
|
||||
% mkdir -p ~/.vim/pack/foo
|
||||
% cd ~/.vim/pack/foo
|
||||
% unzip /tmp/foopack.zip
|
||||
|
||||
The directory name "my" is arbitrary, you can pick anything you like.
|
||||
The directory name "foo" is arbitrary, you can pick anything you like.
|
||||
|
||||
You would now have these files under ~/.vim:
|
||||
pack/my/README.txt
|
||||
pack/my/ever/always/plugin/always.vim
|
||||
pack/my/ever/always/syntax/always.vim
|
||||
pack/my/opt/mydebug/plugin/debugger.vim
|
||||
pack/foo/README.txt
|
||||
pack/foo/start/foobar/plugin/foo.vim
|
||||
pack/foo/start/foobar/syntax/some.vim
|
||||
pack/foo/opt/foodebug/plugin/debugger.vim
|
||||
|
||||
When Vim starts up it scans all directories in 'packpath' for plugins under the
|
||||
"ever" directory and loads them. When found that directory is added to
|
||||
'runtimepath'.
|
||||
When Vim starts up, after processing your .vimrc, it scans all directories in
|
||||
'packpath' for plugins under the "pack/*/start" directory and loads them. The
|
||||
directory is added to 'runtimepath'.
|
||||
|
||||
In the example Vim will find "my/ever/always/plugin/always.vim" and adds
|
||||
"~/.vim/pack/my/ever/always" to 'runtimepath'.
|
||||
In the example Vim will find "pack/foo/start/foobar/plugin/foo.vim" and adds
|
||||
"~/.vim/pack/foo/start/foobar" to 'runtimepath'.
|
||||
|
||||
If the "always" plugin kicks in and sets the 'filetype' to "always", Vim will
|
||||
find the syntax/always.vim file, because its directory is in 'runtimepath'.
|
||||
If the "foobar" plugin kicks in and sets the 'filetype' to "some", Vim will
|
||||
find the syntax/some.vim file, because its directory is in 'runtimepath'.
|
||||
|
||||
*load-plugin*
|
||||
To load an optional plugin from a pack use the `:loadplugin` command: >
|
||||
:loadplugin mydebug
|
||||
This could be done inside always.vim, if some conditions are met.
|
||||
Or you could add this command to your |.vimrc|.
|
||||
Vim will also load ftdetect files, if there are any.
|
||||
|
||||
Note that the files under "pack/foo/opt" or not loaded automatically, only the
|
||||
ones under "pack/foo/start". See |pack-add| below for how the "opt" directory
|
||||
is used.
|
||||
|
||||
Loading packages automatically will not happen if loading plugins is disabled,
|
||||
see |load-plugins|.
|
||||
|
||||
To load packages earlier, so that 'runtimepath' gets updated: >
|
||||
:packloadall
|
||||
This also works when loading plugins is disabled. The automatic loading will
|
||||
only happen once.
|
||||
|
||||
|
||||
Using a single plugin and loading it automatically ~
|
||||
|
||||
If you don't have a package but a single plugin, you need to create the extra
|
||||
directory level:
|
||||
% mkdir -p ~/.vim/pack/foo/start/foobar
|
||||
% cd ~/.vim/pack/foo/start/foobar
|
||||
% unzip /tmp/someplugin.zip
|
||||
|
||||
You would now have these files:
|
||||
pack/foo/start/foobar/plugin/foo.vim
|
||||
pack/foo/start/foobar/syntax/some.vim
|
||||
|
||||
From here it works like above.
|
||||
|
||||
|
||||
Optional plugins ~
|
||||
*pack-add*
|
||||
To load an optional plugin from a pack use the `:packadd` command: >
|
||||
:packadd foodebug
|
||||
This searches for "pack/*/opt/foodebug" in 'packpath' and will find
|
||||
~/.vim/pack/foo/opt/foodebug/plugin/debugger.vim and source it.
|
||||
|
||||
This could be done inside always.vim, if some conditions are met. Or you
|
||||
could add this command to your |.vimrc|.
|
||||
|
||||
It is perfectly normal for a package to only have files in the "opt"
|
||||
directory. You then need to load each plugin when you want to use it.
|
||||
|
||||
Loading packages will not happen if loading plugins is disabled, see
|
||||
|load-plugins|.
|
||||
|
||||
==============================================================================
|
||||
6. Debugging scripts *debug-scripts*
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*starting.txt* For Vim version 7.4. Last change: 2016 Feb 27
|
||||
*starting.txt* For Vim version 7.4. Last change: 2016 Mar 05
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -45,6 +45,7 @@ filename One or more file names. The first one will be the current
|
||||
vim -- -filename
|
||||
< All arguments after the "--" will be interpreted as file names,
|
||||
no other options or "+command" argument can follow.
|
||||
For behavior of quotes on MS-Windows, see |win32-quotes|.
|
||||
|
||||
*--*
|
||||
- This argument can mean two things, depending on whether Ex
|
||||
@@ -833,6 +834,8 @@ accordingly. Vim proceeds in this order:
|
||||
- The user exrc file(s). Same as for the user vimrc file, but with
|
||||
"vimrc" replaced by "exrc". But only one of ".exrc" and "_exrc" is
|
||||
used, depending on the system. And without the (*)!
|
||||
- You would usually have "syntax on" and/or "filetype on" commands,
|
||||
which trigger initializing filetype detection, see |syntax-loading|.
|
||||
|
||||
d. If the 'exrc' option is on (which is not the default), the current
|
||||
directory is searched for three files. The first that exists is used,
|
||||
|
||||
+18
-4
@@ -2465,8 +2465,6 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
|
||||
:lo starting.txt /*:lo*
|
||||
:loadk mbyte.txt /*:loadk*
|
||||
:loadkeymap mbyte.txt /*:loadkeymap*
|
||||
:loadp repeat.txt /*:loadp*
|
||||
:loadplugin repeat.txt /*:loadplugin*
|
||||
:loadview starting.txt /*:loadview*
|
||||
:loc motion.txt /*:loc*
|
||||
:lockmarks motion.txt /*:lockmarks*
|
||||
@@ -2643,6 +2641,8 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
|
||||
:ounmenu gui.txt /*:ounmenu*
|
||||
:ownsyntax syntax.txt /*:ownsyntax*
|
||||
:p various.txt /*:p*
|
||||
:pa repeat.txt /*:pa*
|
||||
:packadd repeat.txt /*:packadd*
|
||||
:pc windows.txt /*:pc*
|
||||
:pclose windows.txt /*:pclose*
|
||||
:pe if_perl.txt /*:pe*
|
||||
@@ -4487,8 +4487,11 @@ E911 eval.txt /*E911*
|
||||
E912 eval.txt /*E912*
|
||||
E913 eval.txt /*E913*
|
||||
E914 eval.txt /*E914*
|
||||
E915 channel.txt /*E915*
|
||||
E916 eval.txt /*E916*
|
||||
E917 eval.txt /*E917*
|
||||
E918 channel.txt /*E918*
|
||||
E919 repeat.txt /*E919*
|
||||
E92 message.txt /*E92*
|
||||
E93 windows.txt /*E93*
|
||||
E94 windows.txt /*E94*
|
||||
@@ -5275,6 +5278,7 @@ charity uganda.txt /*charity*
|
||||
charset mbyte.txt /*charset*
|
||||
charset-conversion mbyte.txt /*charset-conversion*
|
||||
chill.vim syntax.txt /*chill.vim*
|
||||
chmod eval.txt /*chmod*
|
||||
cindent() eval.txt /*cindent()*
|
||||
cinkeys-format indent.txt /*cinkeys-format*
|
||||
cino-# indent.txt /*cino-#*
|
||||
@@ -5694,7 +5698,9 @@ end intro.txt /*end*
|
||||
end-of-file pattern.txt /*end-of-file*
|
||||
enlightened-terminal syntax.txt /*enlightened-terminal*
|
||||
erlang.vim syntax.txt /*erlang.vim*
|
||||
err-buf channel.txt /*err-buf*
|
||||
err-cb channel.txt /*err-cb*
|
||||
err-name channel.txt /*err-name*
|
||||
err-timeout channel.txt /*err-timeout*
|
||||
errmsg-variable eval.txt /*errmsg-variable*
|
||||
error-file-format quickfix.txt /*error-file-format*
|
||||
@@ -6818,6 +6824,10 @@ improved-viminfo version5.txt /*improved-viminfo*
|
||||
improvements-5 version5.txt /*improvements-5*
|
||||
improvements-6 version6.txt /*improvements-6*
|
||||
improvements-7 version7.txt /*improvements-7*
|
||||
in-bot channel.txt /*in-bot*
|
||||
in-buf channel.txt /*in-buf*
|
||||
in-name channel.txt /*in-name*
|
||||
in-top channel.txt /*in-top*
|
||||
inactive-buffer windows.txt /*inactive-buffer*
|
||||
include-search tagsrch.txt /*include-search*
|
||||
inclusive motion.txt /*inclusive*
|
||||
@@ -6901,11 +6911,11 @@ job-err-cb channel.txt /*job-err-cb*
|
||||
job-err-io channel.txt /*job-err-io*
|
||||
job-exit-cb channel.txt /*job-exit-cb*
|
||||
job-in-io channel.txt /*job-in-io*
|
||||
job-may-start channel.txt /*job-may-start*
|
||||
job-options channel.txt /*job-options*
|
||||
job-out-cb channel.txt /*job-out-cb*
|
||||
job-out-io channel.txt /*job-out-io*
|
||||
job-start channel.txt /*job-start*
|
||||
job-start-if-needed channel.txt /*job-start-if-needed*
|
||||
job-start-nochannel channel.txt /*job-start-nochannel*
|
||||
job-stoponexit channel.txt /*job-stoponexit*
|
||||
job-term channel.txt /*job-term*
|
||||
@@ -7001,7 +7011,6 @@ list-repeat windows.txt /*list-repeat*
|
||||
lite.vim syntax.txt /*lite.vim*
|
||||
literal-string eval.txt /*literal-string*
|
||||
lnum-variable eval.txt /*lnum-variable*
|
||||
load-plugin repeat.txt /*load-plugin*
|
||||
load-plugins starting.txt /*load-plugins*
|
||||
load-vim-script repeat.txt /*load-vim-script*
|
||||
local-additions help.txt /*local-additions*
|
||||
@@ -7664,9 +7673,12 @@ os_unix.txt os_unix.txt /*os_unix.txt*
|
||||
os_vms.txt os_vms.txt /*os_vms.txt*
|
||||
os_win32.txt os_win32.txt /*os_win32.txt*
|
||||
other-features vi_diff.txt /*other-features*
|
||||
out-buf channel.txt /*out-buf*
|
||||
out-cb channel.txt /*out-cb*
|
||||
out-name channel.txt /*out-name*
|
||||
out-timeout channel.txt /*out-timeout*
|
||||
p change.txt /*p*
|
||||
pack-add repeat.txt /*pack-add*
|
||||
packages repeat.txt /*packages*
|
||||
page-down intro.txt /*page-down*
|
||||
page-up intro.txt /*page-up*
|
||||
@@ -8070,6 +8082,7 @@ set-spc-auto spell.txt /*set-spc-auto*
|
||||
setbufvar() eval.txt /*setbufvar()*
|
||||
setcharsearch() eval.txt /*setcharsearch()*
|
||||
setcmdpos() eval.txt /*setcmdpos()*
|
||||
setfperm() eval.txt /*setfperm()*
|
||||
setline() eval.txt /*setline()*
|
||||
setloclist() eval.txt /*setloclist()*
|
||||
setmatches() eval.txt /*setmatches()*
|
||||
@@ -9103,6 +9116,7 @@ win32-mouse os_win32.txt /*win32-mouse*
|
||||
win32-open-with-menu gui_w32.txt /*win32-open-with-menu*
|
||||
win32-popup-menu gui_w32.txt /*win32-popup-menu*
|
||||
win32-problems os_win32.txt /*win32-problems*
|
||||
win32-quotes os_win32.txt /*win32-quotes*
|
||||
win32-restore os_win32.txt /*win32-restore*
|
||||
win32-startup os_win32.txt /*win32-startup*
|
||||
win32-term os_win32.txt /*win32-term*
|
||||
|
||||
+50
-99
@@ -1,4 +1,4 @@
|
||||
*todo.txt* For Vim version 7.4. Last change: 2016 Feb 27
|
||||
*todo.txt* For Vim version 7.4. Last change: 2016 Mar 11
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -35,47 +35,47 @@ not be repeated below, unless there is extra information.
|
||||
-------------------- Known bugs and current work -----------------------
|
||||
|
||||
+channel:
|
||||
- A callback on ch_sendraw() should be put at the end of the list of callback
|
||||
handlers. When a message arrives invoke the first one and remove it.
|
||||
- implement TODO items in ":help channel":
|
||||
- job_start() options:
|
||||
term
|
||||
in-io
|
||||
in-file
|
||||
out-io
|
||||
out-file
|
||||
out-buffer
|
||||
err-io
|
||||
err-file
|
||||
err-buffer
|
||||
existing channel to use
|
||||
- job_maystart()
|
||||
- add job_info(): process ID, run/dead, etc.
|
||||
- add ch_info(): in/out/err mode, timeout, callbacks, etc.
|
||||
- CHANNEL_PIPES -> FEAT_JOB
|
||||
- FEAT_JOB / FEAT_CHANNEL -> FEAT_JOBCHANNEL ?
|
||||
- move code from eval.c to channel.c
|
||||
- add job_info(): process ID, run/dead, etc.
|
||||
- add ch_info(): in/out/err mode, timeout, callbacks, etc.
|
||||
- Move more details from eval.txt to channel.txt. Add tags in eval.txt.
|
||||
- When receiving malformed json starting with a quote it doesn't get
|
||||
discarded.
|
||||
discarded. Any invalid JSON or JSON that isn't a list will block further
|
||||
parsing?
|
||||
- When decoding json, don't read all the typeahead at once, use the reader
|
||||
properly.
|
||||
- When a message in the queue but there is no callback, drop it after a while?
|
||||
Add timestamp to queued messages and callbacks with ID, remove after a
|
||||
minute.
|
||||
- cleanup on exit? in mch_getout() and getout().
|
||||
- Add more log calls, basically at every branch, before every callback, etc.
|
||||
- add remark about undo sync, is there a way to force it?
|
||||
minute. Option to set the droptime.
|
||||
- Add more ch_log calls, basically at every branch, before every callback, etc.
|
||||
- Add remark about undo sync, is there a way to force it?
|
||||
- When starting a job, have an option to open the server socket, so we know
|
||||
the port, and pass it to the command with --socket-fd {nr}. (Olaf Dabrunz,
|
||||
Feb 9) How to do this on MS-Windows?
|
||||
- Add more unit-testing in json_test.c
|
||||
- Add a test where ["eval","getline(123)"] gets a line with special
|
||||
characters (NUL, 0x80, etc.). Check that it isn't garbled.
|
||||
- make sure errors lead to a useful error msg. ["ex","foobar"]
|
||||
- Make sure errors lead to a useful error msg. ["ex","foobar"]
|
||||
- For connection to server, a "keep open" flag would be useful. Retry
|
||||
connecting in the main loop with zero timeout.
|
||||
Later
|
||||
- job_start(): run job in a newly opened terminal.
|
||||
With xterm could use -S{pty}.
|
||||
|
||||
For Win32 isinf() should be inline. (ZyX)
|
||||
emoji patch from Yasuhiro Matsumoto. Asked Thomas Dickey.
|
||||
|
||||
Add ":packadd"? Like :loadplugin but only adds the dir to 'runtimepath'.
|
||||
Remove sticky type checking.
|
||||
|
||||
emoji patch from Yasuhiro Matsumoto.
|
||||
Packages:
|
||||
- Add command to update help tags in 'runtimepath'. Pathogen has something
|
||||
like that.
|
||||
- colorscheme command in .vimrc doesn't work.
|
||||
- Also search in 'packpath', both "start" and "opt", don't add dir to 'rtp'
|
||||
- command like :runtime that also search 'packpath'. :packruntime
|
||||
use "ever" or "opt"? both?
|
||||
- command to load packages now?
|
||||
|
||||
More plugin support:
|
||||
- Have a way to install a callback from the main loop. Called every second or
|
||||
@@ -107,15 +107,20 @@ When running "make install" don't overwrite the doc/tags file, generate it
|
||||
elsewhere, so that the distributed file doesn't change.
|
||||
|
||||
Fix to support --nofork for Windows batch files. (Kevin Cantú, 2016 Feb 23,
|
||||
#658)
|
||||
#658, #659) Also add "setlocal" at top of batch file?
|
||||
|
||||
Patch to add GTK 3 support. (Kazunobu Kuriyama, 2016 Feb 13)
|
||||
Patch to add matchstrpos(). (Ozaki Kiichi, 2016 Feb 28)
|
||||
|
||||
Why does this: echo "a" . 1.1
|
||||
result in: a11
|
||||
Should recognize float (so long as it's not ".1.1").
|
||||
|
||||
Allow for an empty dictionary key.
|
||||
Allow for an empty dictionary key?
|
||||
|
||||
Patch to improve I/O for Perl. (Damien, 2016 Jan 9, update Jan 22 2nd one)
|
||||
|
||||
Patch to fix ml_get error. (Alexander Freiherr von Buddenbrock, 2016 Mar 4,
|
||||
#676)
|
||||
|
||||
Regexp problems:
|
||||
- The regexp engines are not reentrant, causing havoc when interrupted by a
|
||||
@@ -170,15 +175,16 @@ Patch to put undo options together in undo window.
|
||||
|
||||
Patch to have better check for {action} argument of setqflist().
|
||||
Nikolai Pavlov, Feb 25, #661. Can be even more strict.
|
||||
|
||||
Patch for clearing history. (Yegappan Lakshmanan, 2016 Jan 31, second message
|
||||
has tests)
|
||||
Also see patch from Hirohito Higash, Feb 25.
|
||||
|
||||
Patch to update the GTK icon cache when installing. (Kazunobu Kuriyama, 2016
|
||||
Feb 3)
|
||||
|
||||
Patch for test86 and test87. (Roland Puntaier, #622)
|
||||
|
||||
We can use '. to go to the last change in the current buffer, but how about
|
||||
the last change in any buffer? Can we use ', (, is next to .)?
|
||||
|
||||
Patch for Python: #622. (Roland Puntaier, 2016 Feb 2)
|
||||
What does it change?
|
||||
|
||||
@@ -190,6 +196,14 @@ Two patches now? New update Feb 24.
|
||||
Patch to support 64 bit ints for Number. (Ken Takata, 2016 Jan 21)
|
||||
Also in update of Feb 24?
|
||||
|
||||
After 7.5 is released:
|
||||
- Drop support for older MS-Windows systems, before XP.
|
||||
Patch from Ken Takata, 2016 Mar 8.
|
||||
|
||||
Patch to add setbufline(). (email from Yasuhiro Matsumoto, patch by Ozaki
|
||||
Kiichi, 2016 Feb 28)
|
||||
Update Mar 8: https://gist.github.com/mattn/23c1f50999084992ca98
|
||||
|
||||
Need to try out instructions in INSSTALLpc.txt about how to install all
|
||||
interfaces and how to build Vim with them.
|
||||
Appveyor build with self-installing executable, includes getting most
|
||||
@@ -213,8 +227,6 @@ What if there is an invalid character?
|
||||
Should jsonencode()/jsondecode() restrict recursiveness?
|
||||
Or avoid recursiveness.
|
||||
|
||||
Patch to fix bug in statusline highlighting. (Christian Brabandt, 2016 Feb 2)
|
||||
|
||||
Use vim.vim syntax highlighting for help file examples, but without ":" in
|
||||
'iskeyword' for syntax.
|
||||
|
||||
@@ -294,7 +306,7 @@ set_color_count().
|
||||
|
||||
Python: ":py raw_input('prompt')" doesn't work. (Manu Hack)
|
||||
|
||||
Comparing nested structures with "==" uses a different comperator than when
|
||||
Comparing nested structures with "==" uses a different comparator than when
|
||||
comparing individual items.
|
||||
Also, "'' == 0" evaluates to true, which isn't nice.
|
||||
Add "===" to have a strict comparison (type and value match).
|
||||
@@ -332,6 +344,7 @@ Use v:none. var == v:none
|
||||
|
||||
Patch to add arguments to argc() and argv(). (Yegappan Lakshmanan, 2016 Jan
|
||||
24) Also need a way to get the global arg list? Update later on Jan 24
|
||||
Update Mar 5.
|
||||
|
||||
To support Thai (and other languages) word boundaries, include the ICU
|
||||
library: http://userguide.icu-project.org/boundaryanalysis
|
||||
@@ -382,8 +395,6 @@ Patch to add GUI colors to the terminal, when it supports it. (ZyX, 2013 Jan
|
||||
Patch for problem with restoring screen on Windows. (Nobuhiro Takasaki, 2015
|
||||
Sep 10)
|
||||
|
||||
Patch to improve I/O for Perl. (Damien, 2015 Jan 9, update Jan 22 2nd one)
|
||||
|
||||
Patch to set antialiasing style on Windows. (Ondrej Balaz, 2013 Mar 14)
|
||||
Needs a different check for CLEARTYPE_QUALITY.
|
||||
Problem mentioned by Christian Brabandt, 2016 Jan 4.
|
||||
@@ -1750,9 +1761,6 @@ Fail to edit file after failed register access. Error flag remains set?
|
||||
Patch for redo register. (Ben Schmidt, 2007 Oct 19)
|
||||
Await response to question to make the register writable.
|
||||
|
||||
src/testdir/Make_dos.mak: not all tests are included, e.g., test49, without a
|
||||
remark why.
|
||||
|
||||
Problem with 'ts' set to 9 and 'showbreak' to ">>>". (Matthew Winn, 2007 Oct
|
||||
1)
|
||||
|
||||
@@ -2720,64 +2728,7 @@ GUI:
|
||||
currently. This is very obvious on a 66Mhz 486.
|
||||
|
||||
|
||||
MSDOS/DJGPP:
|
||||
9 Pressing CTRL-C often crashes the console Vim runs in. (Ken Liao)
|
||||
When 'bioskey' isn't set it doesn't happen. Could be a problem with the
|
||||
BIOS emulation of the console. Version 5.6 already had this problem.
|
||||
8 DJGPP: "cd c:" can take us to a directory that no longer exists.
|
||||
change_drive() doesn't check this. How to check for this error?
|
||||
9 The 16 bit version runs out of memory very quickly. Should find unused
|
||||
code and reduce static data. Resetting 'writebackup' helps to be able to
|
||||
write a file.
|
||||
9 Crash when running on Windows 98 in a console window and pressing CTRL-C.
|
||||
Happens now and then. When debugging Vim in gdb this also happens. Since
|
||||
the console crashes, might be a bug in the DOS console. Resetting
|
||||
'bioskey' avoids it, but then CTRL-C doesn't work.
|
||||
9 DOS: Make CTRL-Fx and ALT-Fx work.
|
||||
CTRL-F1 = CE-5E, CTRL-F2 = CE-5F, .., CTRL-F10 = CE-67
|
||||
ALT-F1 = CE-68, ALT-F2 = CE-69, .., ALT-F10 = CE-71
|
||||
Shifted cursor keys produce same codes as unshifted keys. Use bioskey(2)
|
||||
to get modifier mask for <S-C-M-Fx>.
|
||||
Use K_SPECIAL/KS_MODIFIER codes to insert modifier mask in input stream?
|
||||
Make this work like in Win32 console.
|
||||
Mapping things like <M-A> doesn't work, because it generates an extended
|
||||
key code. Use a translation table?
|
||||
9 Can't read an opened swap file when the "share" command has not been used.
|
||||
At least ignore the swap files that Vim has opened itself.
|
||||
8 Use DJGPP 2.03.
|
||||
8 The Dos32 version (DJGPP) can't use long file names on Windows NT.
|
||||
Check if new package can be used (v2misc/ntlfn08[bs].zip).
|
||||
8 setlocale() is bogus.
|
||||
8 Vim busy waits for new characters or mouse clicks. Should put in some
|
||||
sort of sleep, to avoid eating 50% of the CPU time. Test on an unpatched
|
||||
Windows 95 system!
|
||||
8 DJGPP: when shell is bash, make fails. (Donahoe)
|
||||
7 Hitting CTRL-P twice quickly (e.g., in keyword completion) on a 8088
|
||||
machine, starts printer echo! (John Mullin).
|
||||
7 MSDOS 16 bit version can't work with COMSPEC that has an argument, e.g.:
|
||||
COMSPEC=C:\WINDOWS\COMMAND.COM /E:4096 (Bradley)
|
||||
Caused by BCC system() function (Borland "make" has the same problem).
|
||||
8 Mouse: handle left&right button pressed as middle button pressed. Add
|
||||
modifier keys shift, ctrl and alt.
|
||||
7 When too many files are open (depends on FILES), strange things happen.
|
||||
The Dos16 version runs out of memory, in the Dos32 version "!ls" causes a
|
||||
crash. Another symptom: .swp files are not deleted, existing files are
|
||||
"[New file]".
|
||||
7 DJGPP version doesn't work with graphics display mode. Switch to a mode
|
||||
that is supported?
|
||||
8 DJGPP: ":mode" doesn't work for many modes. Disable them.
|
||||
8 DJGPP: When starting in Ex mode, shouldn't clear the screen. (Walter
|
||||
Briscoe)
|
||||
|
||||
|
||||
MSDOS, OS/2 and Win32:
|
||||
8 OS/2: Add backtick expansion. Undefine NO_EXPANDPATH and use
|
||||
gen_expand_wildcards().
|
||||
8 OS/2: Add clipboard support? See example clipbrd.exe from Alexander
|
||||
Wagner.
|
||||
8 OS/2: Add Extended Attributes support and define HAVE_ACL.
|
||||
8 OS/2: When editing a file name "foo.txt" that is actually called FOO.txt,
|
||||
writing uses "foo.txt". Should obtain the real file name.
|
||||
Win32 console:
|
||||
8 Should $USERPROFILE be preferred above $HOMEDRIVE/$HOMEPATH? No, but it's
|
||||
a good fallback, thus use:
|
||||
$HOME
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: R
|
||||
" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
|
||||
" Last Change: Sun Feb 23, 2014 04:07PM
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Tue Apr 07, 2015 04:38PM
|
||||
|
||||
" Only do this when not yet done for this buffer
|
||||
if exists("b:did_ftplugin")
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: R help file
|
||||
" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
|
||||
" Last Change: Wed Jul 09, 2014 06:23PM
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Tue Apr 07, 2015 04:37PM
|
||||
|
||||
" Only do this when not yet done for this buffer
|
||||
if exists("b:did_ftplugin")
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: R help file
|
||||
" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
|
||||
" Last Change: Wed Jul 09, 2014 06:23PM
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Tue Apr 07, 2015 04:37PM
|
||||
" Original work by Alex Zvoleff (adjusted for rmd by Michel Kuhlmann)
|
||||
|
||||
" Only do this when not yet done for this buffer
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: Rnoweb
|
||||
" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
|
||||
" Last Change: Wed Jul 09, 2014 06:23PM
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Tue Apr 07, 2015 04:37PM
|
||||
|
||||
" Only do this when not yet done for this buffer
|
||||
if exists("b:did_ftplugin")
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: reStructuredText documentation format with R code
|
||||
" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
|
||||
" Last Change: Wed Jul 09, 2014 06:23PM
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Tue Apr 07, 2015 04:38PM
|
||||
" Original work by Alex Zvoleff
|
||||
|
||||
" Only do this when not yet done for this buffer
|
||||
|
||||
+15
-9
@@ -1,7 +1,8 @@
|
||||
" Vim indent file
|
||||
" Language: R
|
||||
" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
|
||||
" Last Change: Thu Mar 26, 2015 05:36PM
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Thu Feb 18, 2016 06:32AM
|
||||
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
@@ -32,7 +33,7 @@ if ! exists("g:r_indent_ess_compatible")
|
||||
let g:r_indent_ess_compatible = 0
|
||||
endif
|
||||
if ! exists("g:r_indent_op_pattern")
|
||||
let g:r_indent_op_pattern = '\(+\|-\|\*\|/\|=\|\~\|%\)$'
|
||||
let g:r_indent_op_pattern = '\(&\||\|+\|-\|\*\|/\|=\|\~\|%\|->\)\s*$'
|
||||
endif
|
||||
|
||||
function s:RDelete_quotes(line)
|
||||
@@ -265,7 +266,7 @@ function GetRIndent()
|
||||
return 0
|
||||
endif
|
||||
|
||||
if cline =~ '^\s*{'
|
||||
if cline =~ '^\s*{' && s:Get_paren_balance(cline, '{', '}') > 0
|
||||
if g:r_indent_ess_compatible && line =~ ')$'
|
||||
let nlnum = lnum
|
||||
let nline = line
|
||||
@@ -283,7 +284,7 @@ function GetRIndent()
|
||||
endif
|
||||
|
||||
" line is an incomplete command:
|
||||
if line =~ '\<\(if\|while\|for\|function\)\s*()$' || line =~ '\<else$' || line =~ '<-$'
|
||||
if line =~ '\<\(if\|while\|for\|function\)\s*()$' || line =~ '\<else$' || line =~ '<-$' || line =~ '->$'
|
||||
return indent(lnum) + &sw
|
||||
endif
|
||||
|
||||
@@ -344,7 +345,7 @@ function GetRIndent()
|
||||
endif
|
||||
|
||||
let post_block = 0
|
||||
if line =~ '}$'
|
||||
if line =~ '}$' && s:Get_paren_balance(line, '{', '}') < 0
|
||||
let lnum = s:Get_matching_brace(lnum, '{', '}', 0)
|
||||
let line = SanitizeRLine(getline(lnum))
|
||||
if lnum > 0 && line =~ '^\s*{'
|
||||
@@ -359,14 +360,14 @@ function GetRIndent()
|
||||
let olnum = s:Get_prev_line(lnum)
|
||||
let oline = getline(olnum)
|
||||
if olnum > 0
|
||||
if line =~ g:r_indent_op_pattern
|
||||
if oline =~ g:r_indent_op_pattern
|
||||
if line =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
|
||||
if oline =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
|
||||
return indent(lnum)
|
||||
else
|
||||
return indent(lnum) + &sw
|
||||
endif
|
||||
else
|
||||
if oline =~ g:r_indent_op_pattern
|
||||
if oline =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
|
||||
return indent(lnum) - &sw
|
||||
endif
|
||||
endif
|
||||
@@ -471,7 +472,6 @@ function GetRIndent()
|
||||
endif
|
||||
|
||||
let ind = indent(lnum)
|
||||
let pind = indent(plnum)
|
||||
|
||||
if g:r_indent_align_args == 0 && pb != 0
|
||||
let ind += pb * &sw
|
||||
@@ -483,6 +483,12 @@ function GetRIndent()
|
||||
return ind
|
||||
endif
|
||||
|
||||
if plnum > 0
|
||||
let pind = indent(plnum)
|
||||
else
|
||||
let pind = 0
|
||||
endif
|
||||
|
||||
if ind == pind || (ind == (pind + &sw) && pline =~ '{$' && ppost_else == 0)
|
||||
return ind
|
||||
endif
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
" Vim indent file
|
||||
" Language: R Documentation (Help), *.Rd
|
||||
" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
|
||||
" Last Change: Thu Oct 16, 2014 07:07AM
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Tue Apr 07, 2015 04:38PM
|
||||
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
" Vim indent file
|
||||
" Language: Rmd
|
||||
" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
|
||||
" Last Change: Thu Jul 10, 2014 07:11PM
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Tue Apr 07, 2015 04:38PM
|
||||
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
" Vim indent file
|
||||
" Language: Rnoweb
|
||||
" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
|
||||
" Last Change: Sun Mar 22, 2015 09:28AM
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Tue Apr 07, 2015 04:38PM
|
||||
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
" Vim indent file
|
||||
" Language: Rrst
|
||||
" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
|
||||
" Last Change: Wed Jul 09, 2014 07:33PM
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Tue Apr 07, 2015 04:38PM
|
||||
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
|
||||
+184
-69
@@ -2,10 +2,9 @@
|
||||
" Language: LaTeX
|
||||
" Maintainer: YiChao Zhou <broken.zhou AT gmail.com>
|
||||
" Created: Sat, 16 Feb 2002 16:50:19 +0100
|
||||
" Last Change: 2012 Mar 18 19:19:50
|
||||
" Version: 0.7
|
||||
" Please email me if you found something we can do. Bug report and
|
||||
" feature request is welcome.
|
||||
" Version: 0.9.2
|
||||
" Please email me if you found something I can do. Comments, bug report and
|
||||
" feature request are welcome.
|
||||
|
||||
" Last Update: {{{
|
||||
" 25th Sep 2002, by LH :
|
||||
@@ -41,7 +40,7 @@
|
||||
" (*) Trust user when in "verbatim" and "lstlisting"
|
||||
" 2012/03/11 by Zhou Yichao <broken.zhou AT gmail.com>
|
||||
" (*) Modify "&" so that only indent when current line start with
|
||||
" "&".
|
||||
" "&".
|
||||
" 2012/03/12 by Zhou Yichao <broken.zhou AT gmail.com>
|
||||
" (*) Modify indentkeys.
|
||||
" 2012/03/18 by Zhou Yichao <broken.zhou AT gmail.com>
|
||||
@@ -49,6 +48,17 @@
|
||||
" 2013/05/02 by Zhou Yichao <broken.zhou AT gmail.com>
|
||||
" (*) Fix problem about GetTeXIndent checker. Thank Albert Netymk
|
||||
" for reporting this.
|
||||
" 2014/06/23 by Zhou Yichao <broken.zhou AT gmail.com>
|
||||
" (*) Remove the feature g:tex_indent_and because it is buggy.
|
||||
" (*) If there is not any obvious indentation hints, we do not
|
||||
" alert our user's current indentation.
|
||||
" (*) g:tex_indent_brace now only works if the open brace is the
|
||||
" last character of that line.
|
||||
" 2014/08/03 by Zhou Yichao <broken.zhou AT gmail.com>
|
||||
" (*) Indent current line if last line has larger indentation
|
||||
" 2014/08/09 by Zhou Yichao <broken.zhou AT gmail.com>
|
||||
" (*) Add missing return value for s:GetEndIndentation(...)
|
||||
"
|
||||
" }}}
|
||||
|
||||
" Document: {{{
|
||||
@@ -60,7 +70,17 @@
|
||||
" * g:tex_indent_brace
|
||||
"
|
||||
" If this variable is unset or non-zero, it will use smartindent-like style
|
||||
" for "{}" and "[]"
|
||||
" for "{}" and "[]". Now this only works if the open brace is the last
|
||||
" character of that line.
|
||||
"
|
||||
" % Example 1
|
||||
" \usetikzlibrary{
|
||||
" external
|
||||
" }
|
||||
"
|
||||
" % Example 2
|
||||
" \tikzexternalize[
|
||||
" prefix=tikz]
|
||||
"
|
||||
" * g:tex_indent_items
|
||||
"
|
||||
@@ -98,14 +118,6 @@
|
||||
"
|
||||
" A list of environment names. separated with '\|', where no indentation is
|
||||
" required. The default is 'document\|verbatim'.
|
||||
"
|
||||
" * g:tex_indent_and
|
||||
"
|
||||
" If this variable is unset or zero, vim will try to align the line with first
|
||||
" "&". This is pretty useful when you use environment like table or align.
|
||||
" Note that this feature need to search back some line, so vim may become
|
||||
" a little slow.
|
||||
"
|
||||
" }}}
|
||||
|
||||
" Only define the function once
|
||||
@@ -126,8 +138,8 @@ endif
|
||||
if !exists("g:tex_indent_brace")
|
||||
let g:tex_indent_brace = 1
|
||||
endif
|
||||
if !exists("g:tex_indent_and")
|
||||
let g:tex_indent_and = 1
|
||||
if !exists("g:tex_max_scan_line")
|
||||
let g:tex_max_scan_line = 60
|
||||
endif
|
||||
if g:tex_indent_items
|
||||
if !exists("g:tex_itemize_env")
|
||||
@@ -140,10 +152,6 @@ else
|
||||
let g:tex_items = ''
|
||||
endif
|
||||
|
||||
if !exists("g:tex_indent_paretheses")
|
||||
let g:tex_indent_paretheses = 1
|
||||
endif
|
||||
|
||||
if !exists("g:tex_noindent_env")
|
||||
let g:tex_noindent_env = 'document\|verbatim\|lstlisting'
|
||||
endif "}}}
|
||||
@@ -160,6 +168,7 @@ let g:tex_items = '^\s*' . substitute(g:tex_items, '^\(\^\\s\*\)*', '', '')
|
||||
function! GetTeXIndent() " {{{
|
||||
" Find a non-blank line above the current line.
|
||||
let lnum = prevnonblank(v:lnum - 1)
|
||||
let cnum = v:lnum
|
||||
|
||||
" Comment line is not what we need.
|
||||
while lnum != 0 && getline(lnum) =~ '^\s*%'
|
||||
@@ -171,8 +180,8 @@ function! GetTeXIndent() " {{{
|
||||
return 0
|
||||
endif
|
||||
|
||||
let line = substitute(getline(lnum), '%.*', ' ','g') " last line
|
||||
let cline = substitute(getline(v:lnum), '%.*', ' ', 'g') " current line
|
||||
let line = substitute(getline(lnum), '\s*%.*', '','g') " last line
|
||||
let cline = substitute(getline(v:lnum), '\s*%.*', '', 'g') " current line
|
||||
|
||||
" We are in verbatim, so do what our user what.
|
||||
if synIDattr(synID(v:lnum, indent(v:lnum), 1), "name") == "texZone"
|
||||
@@ -183,26 +192,12 @@ function! GetTeXIndent() " {{{
|
||||
end
|
||||
endif
|
||||
|
||||
" You want to align with "&"
|
||||
if g:tex_indent_and
|
||||
" Align only when current line start with "&"
|
||||
if line =~ '&.*\\\\' && cline =~ '^\s*&'
|
||||
return indent(v:lnum) + stridx(line, "&") - stridx(cline, "&")
|
||||
endif
|
||||
|
||||
" set line & lnum to the line which doesn't contain "&"
|
||||
while lnum != 0 && (stridx(line, "&") != -1 || line =~ '^\s*%')
|
||||
let lnum = prevnonblank(lnum - 1)
|
||||
let line = getline(lnum)
|
||||
endwhile
|
||||
endif
|
||||
|
||||
|
||||
if lnum == 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
let ind = indent(lnum)
|
||||
let stay = 1
|
||||
|
||||
" New code for comment: retain the indent of current line
|
||||
if cline =~ '^\s*%'
|
||||
@@ -216,77 +211,197 @@ function! GetTeXIndent() " {{{
|
||||
" ZYC modification : \end after \begin won't cause wrong indent anymore
|
||||
if line =~ '\\begin{.*}' && line !~ g:tex_noindent_env
|
||||
let ind = ind + &sw
|
||||
let stay = 0
|
||||
|
||||
if g:tex_indent_items
|
||||
" Add another sw for item-environments
|
||||
if line =~ g:tex_itemize_env
|
||||
let ind = ind + &sw
|
||||
let stay = 0
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
if cline =~ '\\end{.*}'
|
||||
let retn = s:GetEndIndentation(v:lnum)
|
||||
if retn != -1
|
||||
return retn
|
||||
endif
|
||||
end
|
||||
" Subtract a 'shiftwidth' when an environment ends
|
||||
if cline =~ '\\end{.*}' && cline !~ g:tex_noindent_env
|
||||
|
||||
if cline =~ '\\end{.*}'
|
||||
\ && cline !~ g:tex_noindent_env
|
||||
\ && cline !~ '\\begin{.*}.*\\end{.*}'
|
||||
if g:tex_indent_items
|
||||
" Remove another sw for item-environments
|
||||
if cline =~ g:tex_itemize_env
|
||||
let ind = ind - &sw
|
||||
let stay = 0
|
||||
endif
|
||||
endif
|
||||
|
||||
let ind = ind - &sw
|
||||
let stay = 0
|
||||
endif
|
||||
|
||||
if g:tex_indent_brace
|
||||
let sum1 = 0
|
||||
for i in range(0, strlen(line)-1)
|
||||
if line[i] == "}" || line[i] == "]" ||
|
||||
\ strpart(line, i, 7) == '\right)'
|
||||
let sum1 = max([0, sum1-1])
|
||||
endif
|
||||
if line[i] == "{" || line[i] == "[" ||
|
||||
\ strpart(line, i, 6) == '\left('
|
||||
let sum1 += 1
|
||||
let char = line[strlen(line)-1]
|
||||
if char == '[' || char == '{'
|
||||
let ind += &sw
|
||||
let stay = 0
|
||||
endif
|
||||
|
||||
let cind = indent(v:lnum)
|
||||
let char = cline[cind]
|
||||
if (char == ']' || char == '}') &&
|
||||
\ s:CheckPairedIsLastCharacter(v:lnum, cind)
|
||||
let ind -= &sw
|
||||
let stay = 0
|
||||
endif
|
||||
|
||||
for i in range(indent(lnum)+1, strlen(line)-1)
|
||||
let char = line[i]
|
||||
if char == ']' || char == '}'
|
||||
if s:CheckPairedIsLastCharacter(lnum, i)
|
||||
let ind -= &sw
|
||||
let stay = 0
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
|
||||
let sum2 = 0
|
||||
for i in reverse(range(0, strlen(cline)-1))
|
||||
if cline[i] == "{" || cline[i] == "[" ||
|
||||
\ strpart(cline, i, 6) == '\left('
|
||||
let sum2 = max([0, sum2-1])
|
||||
endif
|
||||
if cline[i] == "}" || cline[i] == "]" ||
|
||||
\ strpart(cline, i, 7) == '\right)'
|
||||
let sum2 += 1
|
||||
endif
|
||||
endfor
|
||||
|
||||
let ind += (sum1 - sum2) * &sw
|
||||
endif
|
||||
|
||||
if g:tex_indent_paretheses
|
||||
endif
|
||||
|
||||
" Special treatment for 'item'
|
||||
" ----------------------------
|
||||
|
||||
if g:tex_indent_items
|
||||
|
||||
" '\item' or '\bibitem' itself:
|
||||
if cline =~ g:tex_items
|
||||
let ind = ind - &sw
|
||||
let stay = 0
|
||||
endif
|
||||
|
||||
" lines following to '\item' are intented once again:
|
||||
if line =~ g:tex_items
|
||||
let ind = ind + &sw
|
||||
let stay = 0
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
return ind
|
||||
if stay
|
||||
" If there is no obvious indentation hint, we trust our user.
|
||||
if empty(cline)
|
||||
return ind
|
||||
else
|
||||
return max([indent(v:lnum), s:GetLastBeginIndentation(v:lnum)])
|
||||
endif
|
||||
else
|
||||
return ind
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function! s:GetLastBeginIndentation(lnum) " {{{
|
||||
let matchend = 1
|
||||
for lnum in range(a:lnum-1, max([a:lnum - g:tex_max_scan_line, 1]), -1)
|
||||
let line = getline(lnum)
|
||||
if line =~ '\\end{.*}'
|
||||
let matchend += 1
|
||||
endif
|
||||
if line =~ '\\begin{.*}'
|
||||
let matchend -= 1
|
||||
endif
|
||||
if matchend == 0
|
||||
if line =~ g:tex_itemize_env
|
||||
return indent(lnum) + 2 * &sw
|
||||
endif
|
||||
if line =~ g:tex_noindent_env
|
||||
return indent(lnum)
|
||||
endif
|
||||
return indent(lnum) + &sw
|
||||
endif
|
||||
endfor
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
function! s:GetEndIndentation(lnum) " {{{
|
||||
if getline(a:lnum) =~ '\\begin{.*}.*\\end{.*}'
|
||||
return -1
|
||||
endif
|
||||
|
||||
let min_indent = 100
|
||||
let matchend = 1
|
||||
for lnum in range(a:lnum-1, max([a:lnum-g:tex_max_scan_line, 1]), -1)
|
||||
let line = getline(lnum)
|
||||
if line =~ '\\end{.*}'
|
||||
let matchend += 1
|
||||
endif
|
||||
if line =~ '\\begin{.*}'
|
||||
let matchend -= 1
|
||||
endif
|
||||
if matchend == 0
|
||||
return indent(lnum)
|
||||
endif
|
||||
if !empty(line)
|
||||
let min_indent = min([min_indent, indent(lnum)])
|
||||
endif
|
||||
endfor
|
||||
return min_indent - &sw
|
||||
endfunction
|
||||
|
||||
" Most of the code is from matchparen.vim
|
||||
function! s:CheckPairedIsLastCharacter(lnum, col) "{{{
|
||||
" Get the character under the cursor and check if it's in 'matchpairs'.
|
||||
let c_lnum = a:lnum
|
||||
let c_col = a:col+1
|
||||
|
||||
|
||||
let c = getline(c_lnum)[c_col-1]
|
||||
let plist = split(&matchpairs, '.\zs[:,]')
|
||||
let i = index(plist, c)
|
||||
if i < 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
" Figure out the arguments for searchpairpos().
|
||||
if i % 2 == 0
|
||||
let s_flags = 'nW'
|
||||
let c2 = plist[i + 1]
|
||||
else
|
||||
let s_flags = 'nbW'
|
||||
let c2 = c
|
||||
let c = plist[i - 1]
|
||||
endif
|
||||
if c == '['
|
||||
let c = '\['
|
||||
let c2 = '\]'
|
||||
endif
|
||||
|
||||
" Find the match. When it was just before the cursor move it there for a
|
||||
" moment.
|
||||
let save_cursor = winsaveview()
|
||||
call cursor(c_lnum, c_col)
|
||||
|
||||
" When not in a string or comment ignore matches inside them.
|
||||
" We match "escape" for special items, such as lispEscapeSpecial.
|
||||
let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' .
|
||||
\ '=~? "string\\|character\\|singlequote\\|escape\\|comment"'
|
||||
execute 'if' s_skip '| let s_skip = 0 | endif'
|
||||
|
||||
let stopline = max([0, c_lnum - g:tex_max_scan_line])
|
||||
|
||||
" Limit the search time to 300 msec to avoid a hang on very long lines.
|
||||
" This fails when a timeout is not supported.
|
||||
try
|
||||
let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline, 100)
|
||||
catch /E118/
|
||||
endtry
|
||||
|
||||
call winrestview(save_cursor)
|
||||
|
||||
if m_lnum > 0
|
||||
let line = getline(m_lnum)
|
||||
return strlen(line) == m_col
|
||||
endif
|
||||
|
||||
return 0
|
||||
endfunction "}}}
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" Vim syntax file
|
||||
" Language: Python
|
||||
" Maintainer: Zvezdan Petkovic <zpetkovic@acm.org>
|
||||
" Last Change: 2015 Sep 15
|
||||
" Last Change: 2016 Feb 20
|
||||
" Credits: Neil Schemenauer <nas@python.ca>
|
||||
" Dmitry Vasiliev
|
||||
"
|
||||
@@ -199,6 +199,8 @@ if !exists("python_no_builtin_highlight")
|
||||
syn keyword pythonBuiltin ascii bytes exec
|
||||
" non-essential built-in functions; Python 2 only
|
||||
syn keyword pythonBuiltin apply buffer coerce intern
|
||||
" avoid highlighting attributes as builtins
|
||||
syn match pythonAttribute /\.\h\w*/hs=s+1 contains=ALLBUT,pythonBuiltin transparent
|
||||
endif
|
||||
|
||||
" From the 'Python Library Reference' class hierarchy at the bottom.
|
||||
|
||||
+35
-23
@@ -5,17 +5,21 @@
|
||||
" Tom Payne <tom@tompayne.org>
|
||||
" Contributor: Johannes Ranke <jranke@uni-bremen.de>
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Wed Oct 21, 2015 06:33AM
|
||||
" Last Change: Thu Mar 10, 2016 12:26PM
|
||||
" Filenames: *.R *.r *.Rhistory *.Rt
|
||||
"
|
||||
" NOTE: The highlighting of R functions is defined in
|
||||
" runtime files created by a filetype plugin, if installed.
|
||||
"
|
||||
" CONFIGURATION:
|
||||
" syntax folding can be turned on by
|
||||
" Syntax folding can be turned on by
|
||||
"
|
||||
" let r_syntax_folding = 1
|
||||
"
|
||||
" ROxygen highlighting can be turned off by
|
||||
"
|
||||
" let r_hl_roxygen = 0
|
||||
"
|
||||
" Some lines of code were borrowed from Zhuojun Chen.
|
||||
|
||||
if exists("b:current_syntax")
|
||||
@@ -24,9 +28,12 @@ endif
|
||||
|
||||
setlocal iskeyword=@,48-57,_,.
|
||||
|
||||
if exists("g:r_syntax_folding")
|
||||
if exists("g:r_syntax_folding") && g:r_syntax_folding
|
||||
setlocal foldmethod=syntax
|
||||
endif
|
||||
if !exists("g:r_hl_roxygen")
|
||||
let g:r_hl_roxygen = 1
|
||||
endif
|
||||
|
||||
syn case match
|
||||
|
||||
@@ -35,18 +42,20 @@ syn match rCommentTodo contained "\(BUG\|FIXME\|NOTE\|TODO\):"
|
||||
syn match rComment contains=@Spell,rCommentTodo,rOBlock "#.*"
|
||||
|
||||
" Roxygen
|
||||
syn region rOBlock start="^\s*\n#\{1,2}' " start="\%^#\{1,2}' " end="^\(#\{1,2}'\)\@!" contains=rOTitle,rOKeyword,rOExamples,@Spell keepend
|
||||
syn region rOTitle start="^\s*\n#\{1,2}' " start="\%^#\{1,2}' " end="^\(#\{1,2}'\s*$\)\@=" contained contains=rOCommentKey
|
||||
syn match rOCommentKey "#\{1,2}'" containedin=rOTitle contained
|
||||
if g:r_hl_roxygen
|
||||
syn region rOBlock start="^\s*\n#\{1,2}' " start="\%^#\{1,2}' " end="^\(#\{1,2}'\)\@!" contains=rOTitle,rOKeyword,rOExamples,@Spell keepend
|
||||
syn region rOTitle start="^\s*\n#\{1,2}' " start="\%^#\{1,2}' " end="^\(#\{1,2}'\s*$\)\@=" contained contains=rOCommentKey
|
||||
syn match rOCommentKey "#\{1,2}'" containedin=rOTitle contained
|
||||
|
||||
syn region rOExamples start="^#\{1,2}' @examples.*"rs=e+1,hs=e+1 end="^\(#\{1,2}' @.*\)\@=" end="^\(#\{1,2}'\)\@!" contained contains=rOKeyword
|
||||
syn region rOExamples start="^#\{1,2}' @examples.*"rs=e+1,hs=e+1 end="^\(#\{1,2}' @.*\)\@=" end="^\(#\{1,2}'\)\@!" contained contains=rOKeyword
|
||||
|
||||
syn match rOKeyword contained "@\(param\|return\|name\|rdname\|examples\|example\|include\|docType\)"
|
||||
syn match rOKeyword contained "@\(S3method\|TODO\|aliases\|alias\|assignee\|author\|callGraphDepth\|callGraph\)"
|
||||
syn match rOKeyword contained "@\(callGraphPrimitives\|concept\|exportClass\|exportMethod\|exportPattern\|export\|formals\)"
|
||||
syn match rOKeyword contained "@\(format\|importClassesFrom\|importFrom\|importMethodsFrom\|import\|keywords\|useDynLib\)"
|
||||
syn match rOKeyword contained "@\(method\|noRd\|note\|references\|seealso\|setClass\|slot\|source\|title\|usage\)"
|
||||
syn match rOKeyword contained "@\(family\|template\|templateVar\|description\|details\|inheritParams\|field\)"
|
||||
syn match rOKeyword contained "@\(param\|return\|name\|rdname\|examples\|example\|include\|docType\)"
|
||||
syn match rOKeyword contained "@\(S3method\|TODO\|aliases\|alias\|assignee\|author\|callGraphDepth\|callGraph\)"
|
||||
syn match rOKeyword contained "@\(callGraphPrimitives\|concept\|exportClass\|exportMethod\|exportPattern\|export\|formals\)"
|
||||
syn match rOKeyword contained "@\(format\|importClassesFrom\|importFrom\|importMethodsFrom\|import\|keywords\|useDynLib\)"
|
||||
syn match rOKeyword contained "@\(method\|noRd\|note\|references\|seealso\|setClass\|slot\|source\|title\|usage\)"
|
||||
syn match rOKeyword contained "@\(family\|template\|templateVar\|description\|details\|inheritParams\|field\)"
|
||||
endif
|
||||
|
||||
|
||||
if &filetype == "rhelp"
|
||||
@@ -159,12 +168,13 @@ syn match rBraceError "[)}]" contained
|
||||
syn match rCurlyError "[)\]]" contained
|
||||
syn match rParenError "[\]}]" contained
|
||||
|
||||
" Source list of R functions produced by a filetype plugin (if installed)
|
||||
if has("nvim")
|
||||
" Nvim-R
|
||||
if !exists("g:R_hi_fun")
|
||||
let g:R_hi_fun = 1
|
||||
endif
|
||||
if g:R_hi_fun
|
||||
" Nvim-R:
|
||||
runtime R/functions.vim
|
||||
else
|
||||
" Vim-R-plugin
|
||||
" Vim-R-plugin:
|
||||
runtime r-plugin/functions.vim
|
||||
endif
|
||||
|
||||
@@ -235,11 +245,13 @@ hi def link rStatement Statement
|
||||
hi def link rString String
|
||||
hi def link rStrError Error
|
||||
hi def link rType Type
|
||||
hi def link rOKeyword Title
|
||||
hi def link rOBlock Comment
|
||||
hi def link rOTitle Title
|
||||
hi def link rOCommentKey Comment
|
||||
hi def link rOExamples SpecialComment
|
||||
if g:r_hl_roxygen
|
||||
hi def link rOKeyword Title
|
||||
hi def link rOBlock Comment
|
||||
hi def link rOTitle Title
|
||||
hi def link rOCommentKey Comment
|
||||
hi def link rOExamples SpecialComment
|
||||
endif
|
||||
|
||||
|
||||
let b:current_syntax="r"
|
||||
|
||||
+136
-110
@@ -2,25 +2,21 @@
|
||||
" Language: R Help File
|
||||
" Maintainer: Jakson Aquino <jalvesaq@gmail.com>
|
||||
" Former Maintainer: Johannes Ranke <jranke@uni-bremen.de>
|
||||
" Last Change: Wed Jul 09, 2014 10:28PM
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Sat Feb 06, 2016 11:34AM
|
||||
" Remarks: - Includes R syntax highlighting in the appropriate
|
||||
" sections if an r.vim file is in the same directory or in the
|
||||
" default debian location.
|
||||
" - There is no Latex markup in equations
|
||||
" - Thanks to Will Gray for finding and fixing a bug
|
||||
" - No support for \if, \ifelse and \out as I don't understand
|
||||
" them and have no examples at hand (help welcome).
|
||||
" - No support for \var tag within quoted string (dito)
|
||||
" - No support for \var tag within quoted string
|
||||
|
||||
" Version Clears: {{{1
|
||||
" For version 5.x: Clear all syntax items
|
||||
" For version 6.x and 7.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
|
||||
|
||||
scriptencoding utf-8
|
||||
setlocal iskeyword=@,48-57,_,.
|
||||
|
||||
syn case match
|
||||
@@ -29,9 +25,11 @@ syn case match
|
||||
syn region rhelpIdentifier matchgroup=rhelpSection start="\\name{" end="}"
|
||||
syn region rhelpIdentifier matchgroup=rhelpSection start="\\alias{" end="}"
|
||||
syn region rhelpIdentifier matchgroup=rhelpSection start="\\pkg{" end="}" contains=rhelpLink
|
||||
syn region rhelpIdentifier matchgroup=rhelpSection start="\\CRANpkg{" end="}" contains=rhelpLink
|
||||
syn region rhelpIdentifier matchgroup=rhelpSection start="\\method{" end="}" contained
|
||||
syn region rhelpIdentifier matchgroup=rhelpSection start="\\Rdversion{" end="}"
|
||||
|
||||
|
||||
" Highlighting of R code using an existing r.vim syntax file if available {{{1
|
||||
syn include @R syntax/r.vim
|
||||
|
||||
@@ -69,76 +67,115 @@ syn match rhelpDelimiter "\\cr"
|
||||
syn match rhelpDelimiter "\\tab "
|
||||
|
||||
" Keywords {{{1
|
||||
syn match rhelpKeyword "\\R"
|
||||
syn match rhelpKeyword "\\ldots"
|
||||
syn match rhelpKeyword "\\R\>"
|
||||
syn match rhelpKeyword "\\ldots\>"
|
||||
syn match rhelpKeyword "\\sspace\>"
|
||||
syn match rhelpKeyword "--"
|
||||
syn match rhelpKeyword "---"
|
||||
syn match rhelpKeyword "<"
|
||||
syn match rhelpKeyword ">"
|
||||
syn match rhelpKeyword "\\ge"
|
||||
syn match rhelpKeyword "\\le"
|
||||
syn match rhelpKeyword "\\alpha"
|
||||
syn match rhelpKeyword "\\beta"
|
||||
syn match rhelpKeyword "\\gamma"
|
||||
syn match rhelpKeyword "\\delta"
|
||||
syn match rhelpKeyword "\\epsilon"
|
||||
syn match rhelpKeyword "\\zeta"
|
||||
syn match rhelpKeyword "\\eta"
|
||||
syn match rhelpKeyword "\\theta"
|
||||
syn match rhelpKeyword "\\iota"
|
||||
syn match rhelpKeyword "\\kappa"
|
||||
syn match rhelpKeyword "\\lambda"
|
||||
syn match rhelpKeyword "\\mu"
|
||||
syn match rhelpKeyword "\\nu"
|
||||
syn match rhelpKeyword "\\xi"
|
||||
syn match rhelpKeyword "\\omicron"
|
||||
syn match rhelpKeyword "\\pi"
|
||||
syn match rhelpKeyword "\\rho"
|
||||
syn match rhelpKeyword "\\sigma"
|
||||
syn match rhelpKeyword "\\tau"
|
||||
syn match rhelpKeyword "\\upsilon"
|
||||
syn match rhelpKeyword "\\phi"
|
||||
syn match rhelpKeyword "\\chi"
|
||||
syn match rhelpKeyword "\\psi"
|
||||
syn match rhelpKeyword "\\omega"
|
||||
syn match rhelpKeyword "\\Alpha"
|
||||
syn match rhelpKeyword "\\Beta"
|
||||
syn match rhelpKeyword "\\Gamma"
|
||||
syn match rhelpKeyword "\\Delta"
|
||||
syn match rhelpKeyword "\\Epsilon"
|
||||
syn match rhelpKeyword "\\Zeta"
|
||||
syn match rhelpKeyword "\\Eta"
|
||||
syn match rhelpKeyword "\\Theta"
|
||||
syn match rhelpKeyword "\\Iota"
|
||||
syn match rhelpKeyword "\\Kappa"
|
||||
syn match rhelpKeyword "\\Lambda"
|
||||
syn match rhelpKeyword "\\Mu"
|
||||
syn match rhelpKeyword "\\Nu"
|
||||
syn match rhelpKeyword "\\Xi"
|
||||
syn match rhelpKeyword "\\Omicron"
|
||||
syn match rhelpKeyword "\\Pi"
|
||||
syn match rhelpKeyword "\\Rho"
|
||||
syn match rhelpKeyword "\\Sigma"
|
||||
syn match rhelpKeyword "\\Tau"
|
||||
syn match rhelpKeyword "\\Upsilon"
|
||||
syn match rhelpKeyword "\\Phi"
|
||||
syn match rhelpKeyword "\\Chi"
|
||||
syn match rhelpKeyword "\\Psi"
|
||||
syn match rhelpKeyword "\\Omega"
|
||||
|
||||
" Condition Keywords {{{2
|
||||
syn match rhelpKeyword "\\if\>"
|
||||
syn match rhelpKeyword "\\ifelse\>"
|
||||
syn match rhelpKeyword "\\out\>"
|
||||
" Examples of usage:
|
||||
" \ifelse{latex}{\eqn{p = 5 + 6 - 7 \times 8}}{\eqn{p = 5 + 6 - 7 * 8}}
|
||||
" \ifelse{latex}{\out{$\alpha$}}{\ifelse{html}{\out{α}}{alpha}}
|
||||
|
||||
" Keywords and operators valid only if in math mode {{{2
|
||||
syn match rhelpMathOp "<" contained
|
||||
syn match rhelpMathOp ">" contained
|
||||
syn match rhelpMathOp "+" contained
|
||||
syn match rhelpMathOp "-" contained
|
||||
syn match rhelpMathOp "=" contained
|
||||
|
||||
" Conceal function based on syntax/tex.vim {{{2
|
||||
if exists("g:tex_conceal")
|
||||
let s:tex_conceal = g:tex_conceal
|
||||
else
|
||||
let s:tex_conceal = 'gm'
|
||||
endif
|
||||
function s:HideSymbol(pat, cchar, hide)
|
||||
if a:hide
|
||||
exe "syn match rhelpMathSymb '" . a:pat . "' contained conceal cchar=" . a:cchar
|
||||
else
|
||||
exe "syn match rhelpMathSymb '" . a:pat . "' contained"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Math symbols {{{2
|
||||
if s:tex_conceal =~ 'm'
|
||||
let s:hd = 1
|
||||
else
|
||||
let s:hd = 0
|
||||
endif
|
||||
call s:HideSymbol('\\infty\>', '∞', s:hd)
|
||||
call s:HideSymbol('\\ge\>', '≥', s:hd)
|
||||
call s:HideSymbol('\\le\>', '≤', s:hd)
|
||||
call s:HideSymbol('\\prod\>', '∏', s:hd)
|
||||
call s:HideSymbol('\\sum\>', '∑', s:hd)
|
||||
syn match rhelpMathSymb "\\sqrt\>" contained
|
||||
|
||||
" Greek letters {{{2
|
||||
if s:tex_conceal =~ 'g'
|
||||
let s:hd = 1
|
||||
else
|
||||
let s:hd = 0
|
||||
endif
|
||||
call s:HideSymbol('\\alpha\>', 'α', s:hd)
|
||||
call s:HideSymbol('\\beta\>', 'β', s:hd)
|
||||
call s:HideSymbol('\\gamma\>', 'γ', s:hd)
|
||||
call s:HideSymbol('\\delta\>', 'δ', s:hd)
|
||||
call s:HideSymbol('\\epsilon\>', 'ϵ', s:hd)
|
||||
call s:HideSymbol('\\zeta\>', 'ζ', s:hd)
|
||||
call s:HideSymbol('\\eta\>', 'η', s:hd)
|
||||
call s:HideSymbol('\\theta\>', 'θ', s:hd)
|
||||
call s:HideSymbol('\\iota\>', 'ι', s:hd)
|
||||
call s:HideSymbol('\\kappa\>', 'κ', s:hd)
|
||||
call s:HideSymbol('\\lambda\>', 'λ', s:hd)
|
||||
call s:HideSymbol('\\mu\>', 'μ', s:hd)
|
||||
call s:HideSymbol('\\nu\>', 'ν', s:hd)
|
||||
call s:HideSymbol('\\xi\>', 'ξ', s:hd)
|
||||
call s:HideSymbol('\\pi\>', 'π', s:hd)
|
||||
call s:HideSymbol('\\rho\>', 'ρ', s:hd)
|
||||
call s:HideSymbol('\\sigma\>', 'σ', s:hd)
|
||||
call s:HideSymbol('\\tau\>', 'τ', s:hd)
|
||||
call s:HideSymbol('\\upsilon\>', 'υ', s:hd)
|
||||
call s:HideSymbol('\\phi\>', 'ϕ', s:hd)
|
||||
call s:HideSymbol('\\chi\>', 'χ', s:hd)
|
||||
call s:HideSymbol('\\psi\>', 'ψ', s:hd)
|
||||
call s:HideSymbol('\\omega\>', 'ω', s:hd)
|
||||
call s:HideSymbol('\\Gamma\>', 'Γ', s:hd)
|
||||
call s:HideSymbol('\\Delta\>', 'Δ', s:hd)
|
||||
call s:HideSymbol('\\Theta\>', 'Θ', s:hd)
|
||||
call s:HideSymbol('\\Lambda\>', 'Λ', s:hd)
|
||||
call s:HideSymbol('\\Xi\>', 'Ξ', s:hd)
|
||||
call s:HideSymbol('\\Pi\>', 'Π', s:hd)
|
||||
call s:HideSymbol('\\Sigma\>', 'Σ', s:hd)
|
||||
call s:HideSymbol('\\Upsilon\>', 'Υ', s:hd)
|
||||
call s:HideSymbol('\\Phi\>', 'Φ', s:hd)
|
||||
call s:HideSymbol('\\Psi\>', 'Ψ', s:hd)
|
||||
call s:HideSymbol('\\Omega\>', 'Ω', s:hd)
|
||||
delfunction s:HideSymbol
|
||||
" Note: The letters 'omicron', 'Alpha', 'Beta', 'Epsilon', 'Zeta', 'Eta',
|
||||
" 'Iota', 'Kappa', 'Mu', 'Nu', 'Omicron', 'Rho', 'Tau' and 'Chi' are listed
|
||||
" at src/library/tools/R/Rd2txt.R because they are valid in HTML, although
|
||||
" they do not make valid LaTeX code (e.g. Α versus \Alpha).
|
||||
|
||||
" Links {{{1
|
||||
syn region rhelpLink matchgroup=rhelpSection start="\\link{" end="}" contained keepend extend
|
||||
syn region rhelpLink matchgroup=rhelpSection start="\\link\[.\{-}\]{" end="}" contained keepend extend
|
||||
syn region rhelpLink matchgroup=rhelpSection start="\\linkS4class{" end="}" contained keepend extend
|
||||
syn region rhelpLink matchgroup=rhelpType start="\\link{" end="}" contained keepend extend
|
||||
syn region rhelpLink matchgroup=rhelpType start="\\link\[.\{-}\]{" end="}" contained keepend extend
|
||||
syn region rhelpLink matchgroup=rhelpType start="\\linkS4class{" end="}" contained keepend extend
|
||||
syn region rhelpLink matchgroup=rhelpType start="\\url{" end="}" contained keepend extend
|
||||
syn region rhelpLink matchgroup=rhelpType start="\\href{" end="}" contained keepend extend
|
||||
syn region rhelpLink matchgroup=rhelpType start="\\figure{" end="}" contained keepend extend
|
||||
|
||||
" Verbatim like {{{1
|
||||
if v:version > 703
|
||||
syn region rhelpVerbatim matchgroup=rhelpType start="\\samp{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpSpecialChar,rhelpComment
|
||||
syn region rhelpVerbatim matchgroup=rhelpType start="\\verb{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpSpecialChar,rhelpComment
|
||||
else
|
||||
syn region rhelpVerbatim matchgroup=rhelpType start="\\samp{" skip='\\\@<!{.\{-}\\\@<!}' end="}" contains=rhelpSpecialChar,rhelpComment
|
||||
syn region rhelpVerbatim matchgroup=rhelpType start="\\verb{" skip='\\\@<!{.\{-}\\\@<!}' end="}" contains=rhelpSpecialChar,rhelpComment
|
||||
endif
|
||||
syn region rhelpVerbatim matchgroup=rhelpType start="\\samp{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpSpecialChar,rhelpComment
|
||||
syn region rhelpVerbatim matchgroup=rhelpType start="\\verb{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpSpecialChar,rhelpComment
|
||||
|
||||
" Equation {{{1
|
||||
syn region rhelpEquation matchgroup=rhelpType start="\\eqn{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpMathSymb,rhelpMathOp,rhelpRegion contained keepend extend
|
||||
syn region rhelpEquation matchgroup=rhelpType start="\\deqn{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpMathSymb,rhelpMathOp,rhelpRegion contained keepend extend
|
||||
|
||||
" Type Styles {{{1
|
||||
syn match rhelpType "\\emph\>"
|
||||
@@ -148,12 +185,9 @@ syn match rhelpType "\\sQuote\>"
|
||||
syn match rhelpType "\\dQuote\>"
|
||||
syn match rhelpType "\\preformatted\>"
|
||||
syn match rhelpType "\\kbd\>"
|
||||
syn match rhelpType "\\eqn\>"
|
||||
syn match rhelpType "\\deqn\>"
|
||||
syn match rhelpType "\\file\>"
|
||||
syn match rhelpType "\\email\>"
|
||||
syn match rhelpType "\\url\>"
|
||||
syn match rhelpType "\\href\>"
|
||||
syn match rhelpType "\\enc\>"
|
||||
syn match rhelpType "\\var\>"
|
||||
syn match rhelpType "\\env\>"
|
||||
syn match rhelpType "\\option\>"
|
||||
@@ -163,6 +197,7 @@ syn match rhelpType "\\renewcommand\>"
|
||||
syn match rhelpType "\\dfn\>"
|
||||
syn match rhelpType "\\cite\>"
|
||||
syn match rhelpType "\\acronym\>"
|
||||
syn match rhelpType "\\doi\>"
|
||||
|
||||
" rhelp sections {{{1
|
||||
syn match rhelpSection "\\encoding\>"
|
||||
@@ -202,9 +237,9 @@ syn match rhelpDelimiter "{\|\[\|(\|)\|\]\|}"
|
||||
syn match rhelpComment /%.*$/
|
||||
|
||||
" Error {{{1
|
||||
syn region rhelpRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim
|
||||
syn region rhelpRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim
|
||||
syn region rhelpRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim
|
||||
syn region rhelpRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim,rhelpEquation
|
||||
syn region rhelpRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim,rhelpEquation
|
||||
syn region rhelpRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim,rhelpEquation
|
||||
syn match rhelpError /[)\]}]/
|
||||
syn match rhelpBraceError /[)}]/ contained
|
||||
syn match rhelpCurlyError /[)\]]/ contained
|
||||
@@ -213,36 +248,27 @@ syn match rhelpParenError /[\]}]/ contained
|
||||
syntax sync match rhelpSyncRcode grouphere rhelpRcode "\\examples{"
|
||||
|
||||
" Define the default highlighting {{{1
|
||||
" 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_rhelp_syntax_inits")
|
||||
if version < 508
|
||||
let did_rhelp_syntax_inits = 1
|
||||
command -nargs=+ HiLink hi link <args>
|
||||
else
|
||||
command -nargs=+ HiLink hi def link <args>
|
||||
endif
|
||||
HiLink rhelpVerbatim String
|
||||
HiLink rhelpDelimiter Delimiter
|
||||
HiLink rhelpIdentifier Identifier
|
||||
HiLink rhelpString String
|
||||
HiLink rhelpCodeSpecial Special
|
||||
HiLink rhelpKeyword Keyword
|
||||
HiLink rhelpDots Keyword
|
||||
HiLink rhelpLink Underlined
|
||||
HiLink rhelpType Type
|
||||
HiLink rhelpSection PreCondit
|
||||
HiLink rhelpError Error
|
||||
HiLink rhelpBraceError Error
|
||||
HiLink rhelpCurlyError Error
|
||||
HiLink rhelpParenError Error
|
||||
HiLink rhelpPreProc PreProc
|
||||
HiLink rhelpDelimiter Delimiter
|
||||
HiLink rhelpComment Comment
|
||||
HiLink rhelpRComment Comment
|
||||
HiLink rhelpSpecialChar SpecialChar
|
||||
delcommand HiLink
|
||||
endif
|
||||
hi def link rhelpVerbatim String
|
||||
hi def link rhelpDelimiter Delimiter
|
||||
hi def link rhelpIdentifier Identifier
|
||||
hi def link rhelpString String
|
||||
hi def link rhelpCodeSpecial Special
|
||||
hi def link rhelpKeyword Keyword
|
||||
hi def link rhelpDots Keyword
|
||||
hi def link rhelpLink Underlined
|
||||
hi def link rhelpType Type
|
||||
hi def link rhelpSection PreCondit
|
||||
hi def link rhelpError Error
|
||||
hi def link rhelpBraceError Error
|
||||
hi def link rhelpCurlyError Error
|
||||
hi def link rhelpParenError Error
|
||||
hi def link rhelpPreProc PreProc
|
||||
hi def link rhelpDelimiter Delimiter
|
||||
hi def link rhelpComment Comment
|
||||
hi def link rhelpRComment Comment
|
||||
hi def link rhelpSpecialChar SpecialChar
|
||||
hi def link rhelpMathSymb Special
|
||||
hi def link rhelpMathOp Operator
|
||||
|
||||
let b:current_syntax = "rhelp"
|
||||
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
" markdown Text with R statements
|
||||
" Language: markdown with R code chunks
|
||||
" Last Change: Wed Jul 09, 2014 10:29PM
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Sat Feb 06, 2016 06:45AM
|
||||
"
|
||||
" CONFIGURATION:
|
||||
" To highlight chunk headers as R code, put in your vimrc:
|
||||
" let rmd_syn_hl_chunk = 1
|
||||
|
||||
" for portability
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
@@ -58,6 +56,8 @@ if rmdIsPandoc == 0
|
||||
if exists("b:current_syntax")
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
" Extend cluster
|
||||
syn cluster texMathZoneGroup add=rmdrInline
|
||||
" Inline
|
||||
syntax match rmdLaTeXInlDelim "\$"
|
||||
syntax match rmdLaTeXInlDelim "\\\$"
|
||||
|
||||
+14
-19
@@ -1,20 +1,14 @@
|
||||
" Vim syntax file
|
||||
" Language: R noweb Files
|
||||
" Maintainer: Johannes Ranke <jranke@uni-bremen.de>
|
||||
" Last Change: 2009 May 05
|
||||
" Version: 0.9
|
||||
" SVN: $Id: rnoweb.vim 84 2009-05-03 19:52:47Z ranke $
|
||||
" Last Change: Sat Feb 06, 2016 06:47AM
|
||||
" Version: 0.9.1
|
||||
" Remarks: - This file is inspired by the proposal of
|
||||
" Fernando Henrique Ferraz Pereira da Rosa <feferraz@ime.usp.br>
|
||||
" http://www.ime.usp.br/~feferraz/en/sweavevim.html
|
||||
" Fernando Henrique Ferraz Pereira da Rosa <feferraz@ime.usp.br>
|
||||
" http://www.ime.usp.br/~feferraz/en/sweavevim.html
|
||||
"
|
||||
|
||||
" Version Clears: {{{1
|
||||
" For version 5.x: Clear all syntax items
|
||||
" For version 6.x and 7.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
|
||||
|
||||
@@ -26,21 +20,22 @@ unlet b:current_syntax
|
||||
|
||||
syn cluster texMatchGroup add=@rnoweb
|
||||
syn cluster texMathMatchGroup add=rnowebSexpr
|
||||
syn cluster texMathZoneGroup add=rnowebSexpr
|
||||
syn cluster texEnvGroup add=@rnoweb
|
||||
syn cluster texFoldGroup add=@rnoweb
|
||||
syn cluster texDocGroup add=@rnoweb
|
||||
syn cluster texPartGroup add=@rnoweb
|
||||
syn cluster texChapterGroup add=@rnoweb
|
||||
syn cluster texSectionGroup add=@rnoweb
|
||||
syn cluster texSubSectionGroup add=@rnoweb
|
||||
syn cluster texSubSubSectionGroup add=@rnoweb
|
||||
syn cluster texParaGroup add=@rnoweb
|
||||
syn cluster texDocGroup add=@rnoweb
|
||||
syn cluster texPartGroup add=@rnoweb
|
||||
syn cluster texChapterGroup add=@rnoweb
|
||||
syn cluster texSectionGroup add=@rnoweb
|
||||
syn cluster texSubSectionGroup add=@rnoweb
|
||||
syn cluster texSubSubSectionGroup add=@rnoweb
|
||||
syn cluster texParaGroup add=@rnoweb
|
||||
|
||||
" Highlighting of R code using an existing r.vim syntax file if available {{{1
|
||||
syn include @rnowebR syntax/r.vim
|
||||
syn region rnowebChunk matchgroup=rnowebDelimiter start="^<<.*>>=" matchgroup=rnowebDelimiter end="^@" contains=@rnowebR,rnowebChunkReference,rnowebChunk fold keepend
|
||||
syn match rnowebChunkReference "^<<.*>>$" contained
|
||||
syn region rnowebSexpr matchgroup=Delimiter start="\\Sexpr{" matchgroup=Delimiter end="}" contains=@rnowebR
|
||||
syn region rnowebSexpr matchgroup=Delimiter start="\\Sexpr{" matchgroup=Delimiter end="}" contains=@rnowebR contained
|
||||
|
||||
" Sweave options command {{{1
|
||||
syn region rnowebSweaveopts matchgroup=Delimiter start="\\SweaveOpts{" matchgroup=Delimiter end="}"
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
" reStructured Text with R statements
|
||||
" Language: reST with R code chunks
|
||||
" Maintainer: Alex Zvoleff, azvoleff@mail.sdsu.edu
|
||||
" Last Change: Wed Jul 09, 2014 10:29PM
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Sat Feb 06, 2016 06:45AM
|
||||
"
|
||||
" CONFIGURATION:
|
||||
" To highlight chunk headers as R code, put in your vimrc:
|
||||
" let rrst_syn_hl_chunk = 1
|
||||
|
||||
" for portability
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
" Maintainer: Dominik Fischer <d dot f dot fischer at web dot de>
|
||||
" Contributor: Leonard Ehrenfried <leonard.ehrenfried@web.de>
|
||||
" Contributor: Karsten Hopp <karsten@redhat.com>
|
||||
" Last Change: 2016 Jan 15
|
||||
" SSH Version: 7.1
|
||||
" Last Change: 2016 Mar 1
|
||||
" SSH Version: 7.2
|
||||
"
|
||||
|
||||
" Setup
|
||||
@@ -40,26 +40,57 @@ syn keyword sshconfigYesNo yes no ask
|
||||
syn keyword sshconfigYesNo any auto
|
||||
syn keyword sshconfigYesNo force autoask none
|
||||
|
||||
syn keyword sshconfigCipher 3des blowfish
|
||||
syn keyword sshconfigCiphers aes128-cbc 3des-cbc blowfish blowfish-cbc cast128-cbc
|
||||
syn keyword sshconfigCiphers aes192-cbc aes256-cbc aes128-ctr aes192-ctr aes256-ctr
|
||||
syn keyword sshconfigCiphers arcfour arcfour128 arcfour256 cast128-cbc
|
||||
syn keyword sshconfigCipher 3des blowfish
|
||||
|
||||
syn keyword sshconfigMAC hmac-md5 hmac-sha1 hmac-ripemd160 hmac-sha1-96
|
||||
syn keyword sshconfigMAC hmac-md5-96
|
||||
syn keyword sshconfigMAC hmac-sha2-256 hmac-sha2-256-96 hmac-sha2-512
|
||||
syn keyword sshconfigMAC hmac-sha2-512-96
|
||||
syn keyword sshconfigCiphers 3des-cbc
|
||||
syn keyword sshconfigCiphers blowfish-cbc
|
||||
syn keyword sshconfigCiphers cast128-cbc
|
||||
syn keyword sshconfigCiphers arcfour
|
||||
syn keyword sshconfigCiphers arcfour128
|
||||
syn keyword sshconfigCiphers arcfour256
|
||||
syn keyword sshconfigCiphers aes128-cbc
|
||||
syn keyword sshconfigCiphers aes192-cbc
|
||||
syn keyword sshconfigCiphers aes256-cbc
|
||||
syn match sshconfigCiphers "\<rijndael-cbc@lysator\.liu.se\>"
|
||||
syn keyword sshconfigCiphers aes128-ctr
|
||||
syn keyword sshconfigCiphers aes192-ctr
|
||||
syn keyword sshconfigCiphers aes256-ctr
|
||||
syn match sshconfigCiphers "\<aes128-gcm@openssh\.com\>"
|
||||
syn match sshconfigCiphers "\<aes256-gcm@openssh\.com\>"
|
||||
syn match sshconfigCiphers "\<chacha20-poly1305@openssh\.com\>"
|
||||
|
||||
syn keyword sshconfigMAC hmac-sha1
|
||||
syn keyword sshconfigMAC mac-sha1-96
|
||||
syn keyword sshconfigMAC mac-sha2-256
|
||||
syn keyword sshconfigMAC mac-sha2-512
|
||||
syn keyword sshconfigMAC mac-md5
|
||||
syn keyword sshconfigMAC mac-md5-96
|
||||
syn keyword sshconfigMAC mac-ripemd160
|
||||
syn match sshconfigMAC "\<hmac-ripemd160@openssh\.com\>"
|
||||
syn match sshconfigMAC "\<umac-64@openssh\.com\>"
|
||||
syn match sshconfigMAC "\<umac-128@openssh\.com\>"
|
||||
syn match sshconfigMAC "\<hmac-sha1-etm@openssh\.com\>"
|
||||
syn match sshconfigMAC "\<hmac-sha1-96-etm@openssh\.com\>"
|
||||
syn match sshconfigMAC "\<hmac-sha2-256-etm@openssh\.com\>"
|
||||
syn match sshconfigMAC "\<hmac-sha2-512-etm@openssh\.com\>"
|
||||
syn match sshconfigMAC "\<hmac-md5-etm@openssh\.com\>"
|
||||
syn match sshconfigMAC "\<hmac-md5-96-etm@openssh\.com\>"
|
||||
syn match sshconfigMAC "\<hmac-ripemd160-etm@openssh\.com\>"
|
||||
syn match sshconfigMAC "\<umac-64-etm@openssh\.com\>"
|
||||
syn match sshconfigMAC "\<umac-128-etm@openssh\.com\>"
|
||||
|
||||
syn keyword sshconfigHostKeyAlg ssh-rsa ssh-dss
|
||||
syn match sshconfigHostKeyAlg "\<ecdsa-sha2-nistp256-cert-v01@openssh\.com\>"
|
||||
syn match sshconfigHostKeyAlg "\<ecdsa-sha2-nistp384-cert-v01@openssh\.com\>"
|
||||
syn match sshconfigHostKeyAlg "\<ecdsa-sha2-nistp521-cert-v01@openssh\.com\>"
|
||||
syn match sshconfigHostKeyAlg "\<ssh-rsa-cert-v01@openssh\.com\>"
|
||||
syn match sshconfigHostKeyAlg "\<ssh-dss-cert-v01@openssh\.com\>"
|
||||
syn match sshconfigHostKeyAlg "\<ssh-rsa-cert-v00@openssh\.com\>"
|
||||
syn match sshconfigHostKeyAlg "\<ssh-dss-cert-v00@openssh\.com\>"
|
||||
syn keyword sshconfigHostKeyAlg ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521
|
||||
syn keyword sshconfigHostKeyAlgo ssh-ed25519
|
||||
syn match sshconfigHostKeyAlgo "\<ssh-ed25519-cert-v01@openssh\.com\>"
|
||||
syn keyword sshconfigHostKeyAlgo ssh-rsa
|
||||
syn keyword sshconfigHostKeyAlgo ssh-dss
|
||||
syn keyword sshconfigHostKeyAlgo ecdsa-sha2-nistp256
|
||||
syn keyword sshconfigHostKeyAlgo ecdsa-sha2-nistp384
|
||||
syn keyword sshconfigHostKeyAlgo ecdsa-sha2-nistp521
|
||||
syn match sshconfigHostKeyAlgo "\<ssh-rsa-cert-v01@openssh\.com\>"
|
||||
syn match sshconfigHostKeyAlgo "\<ssh-dss-cert-v01@openssh\.com\>"
|
||||
syn match sshconfigHostKeyAlgo "\<ecdsa-sha2-nistp256-cert-v01@openssh\.com\>"
|
||||
syn match sshconfigHostKeyAlgo "\<ecdsa-sha2-nistp384-cert-v01@openssh\.com\>"
|
||||
syn match sshconfigHostKeyAlgo "\<ecdsa-sha2-nistp521-cert-v01@openssh\.com\>"
|
||||
|
||||
syn keyword sshconfigPreferredAuth hostbased publickey password gssapi-with-mic
|
||||
syn keyword sshconfigPreferredAuth keyboard-interactive
|
||||
@@ -78,11 +109,14 @@ syn match sshconfigIPQoS "cs[0-7]"
|
||||
syn keyword sshconfigIPQoS ef lowdelay throughput reliability
|
||||
syn keyword sshconfigKbdInteractive bsdauth pam skey
|
||||
|
||||
syn keyword sshconfigKexAlgo ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521
|
||||
syn keyword sshconfigKexAlgo diffie-hellman-group-exchange-sha256
|
||||
syn keyword sshconfigKexAlgo diffie-hellman-group-exchange-sha1
|
||||
syn keyword sshconfigKexAlgo diffie-hellman-group14-sha1
|
||||
syn keyword sshconfigKexAlgo diffie-hellman-group1-sha1
|
||||
syn keyword sshconfigKexAlgo diffie-hellman-group1-sha1
|
||||
syn keyword sshconfigKexAlgo diffie-hellman-group14-sha1
|
||||
syn keyword sshconfigKexAlgo diffie-hellman-group-exchange-sha1
|
||||
syn keyword sshconfigKexAlgo diffie-hellman-group-exchange-sha256
|
||||
syn keyword sshconfigKexAlgo ecdh-sha2-nistp256
|
||||
syn keyword sshconfigKexAlgo ecdh-sha2-nistp384
|
||||
syn keyword sshconfigKexAlgo ecdh-sha2-nistp521
|
||||
syn match sshconfigKexAlgo "\<curve25519-sha256@libssh\.org\>"
|
||||
|
||||
syn keyword sshconfigTunnel point-to-point ethernet
|
||||
|
||||
@@ -111,6 +145,7 @@ syn keyword sshconfigKeyword CanonicalDomains
|
||||
syn keyword sshconfigKeyword CanonicalizeFallbackLocal
|
||||
syn keyword sshconfigKeyword CanonicalizeHostname
|
||||
syn keyword sshconfigKeyword CanonicalizeMaxDots
|
||||
syn keyword sshconfigKeyword CertificateFile
|
||||
syn keyword sshconfigKeyword ChallengeResponseAuthentication
|
||||
syn keyword sshconfigKeyword CheckHostIP
|
||||
syn keyword sshconfigKeyword Cipher
|
||||
@@ -212,7 +247,7 @@ if version >= 508 || !exists("did_sshconfig_syntax_inits")
|
||||
HiLink sshconfigCipher sshconfigEnum
|
||||
HiLink sshconfigCiphers sshconfigEnum
|
||||
HiLink sshconfigMAC sshconfigEnum
|
||||
HiLink sshconfigHostKeyAlg sshconfigEnum
|
||||
HiLink sshconfigHostKeyAlgo sshconfigEnum
|
||||
HiLink sshconfigLogLevel sshconfigEnum
|
||||
HiLink sshconfigSysLogFacility sshconfigEnum
|
||||
HiLink sshconfigAddressFamily sshconfigEnum
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
" Contributor: Leonard Ehrenfried <leonard.ehrenfried@web.de>
|
||||
" Contributor: Karsten Hopp <karsten@redhat.com>
|
||||
" Originally: 2009-07-09
|
||||
" Last Change: 2016 Jan 12
|
||||
" SSH Version: 7.1
|
||||
" Last Change: 2016 Mar 1
|
||||
" SSH Version: 7.2
|
||||
"
|
||||
|
||||
" Setup
|
||||
@@ -47,15 +47,55 @@ syn keyword sshdconfigTcpForwarding local remote
|
||||
|
||||
syn keyword sshdconfigRootLogin prohibit-password without-password forced-commands-only
|
||||
|
||||
syn keyword sshdconfigCipher aes128-cbc 3des-cbc blowfish-cbc cast128-cbc
|
||||
syn keyword sshdconfigCipher aes192-cbc aes256-cbc aes128-ctr aes192-ctr aes256-ctr
|
||||
syn keyword sshdconfigCipher arcfour arcfour128 arcfour256 cast128-cbc
|
||||
syn keyword sshdconfigCiphers 3des-cbc
|
||||
syn keyword sshdconfigCiphers blowfish-cbc
|
||||
syn keyword sshdconfigCiphers cast128-cbc
|
||||
syn keyword sshdconfigCiphers arcfour
|
||||
syn keyword sshdconfigCiphers arcfour128
|
||||
syn keyword sshdconfigCiphers arcfour256
|
||||
syn keyword sshdconfigCiphers aes128-cbc
|
||||
syn keyword sshdconfigCiphers aes192-cbc
|
||||
syn keyword sshdconfigCiphers aes256-cbc
|
||||
syn match sshdconfigCiphers "\<rijndael-cbc@lysator\.liu.se\>"
|
||||
syn keyword sshdconfigCiphers aes128-ctr
|
||||
syn keyword sshdconfigCiphers aes192-ctr
|
||||
syn keyword sshdconfigCiphers aes256-ctr
|
||||
syn match sshdconfigCiphers "\<aes128-gcm@openssh\.com\>"
|
||||
syn match sshdconfigCiphers "\<aes256-gcm@openssh\.com\>"
|
||||
syn match sshdconfigCiphers "\<chacha20-poly1305@openssh\.com\>"
|
||||
|
||||
syn keyword sshdconfigMAC hmac-md5 hmac-sha1 hmac-ripemd160 hmac-sha1-96
|
||||
syn keyword sshdconfigMAC hmac-md5-96
|
||||
syn keyword sshdconfigMAC hmac-sha2-256 hmac-sha256-96 hmac-sha2-512
|
||||
syn keyword sshdconfigMAC hmac-sha2-512-96
|
||||
syn keyword sshdconfigMAC hmac-sha1
|
||||
syn keyword sshdconfigMAC mac-sha1-96
|
||||
syn keyword sshdconfigMAC mac-sha2-256
|
||||
syn keyword sshdconfigMAC mac-sha2-512
|
||||
syn keyword sshdconfigMAC mac-md5
|
||||
syn keyword sshdconfigMAC mac-md5-96
|
||||
syn keyword sshdconfigMAC mac-ripemd160
|
||||
syn match sshdconfigMAC "\<hmac-ripemd160@openssh\.com\>"
|
||||
syn match sshdconfigMAC "\<umac-64@openssh\.com\>"
|
||||
syn match sshdconfigMAC "\<umac-128@openssh\.com\>"
|
||||
syn match sshdconfigMAC "\<hmac-sha1-etm@openssh\.com\>"
|
||||
syn match sshdconfigMAC "\<hmac-sha1-96-etm@openssh\.com\>"
|
||||
syn match sshdconfigMAC "\<hmac-sha2-256-etm@openssh\.com\>"
|
||||
syn match sshdconfigMAC "\<hmac-sha2-512-etm@openssh\.com\>"
|
||||
syn match sshdconfigMAC "\<hmac-md5-etm@openssh\.com\>"
|
||||
syn match sshdconfigMAC "\<hmac-md5-96-etm@openssh\.com\>"
|
||||
syn match sshdconfigMAC "\<hmac-ripemd160-etm@openssh\.com\>"
|
||||
syn match sshdconfigMAC "\<umac-64-etm@openssh\.com\>"
|
||||
syn match sshdconfigMAC "\<umac-128-etm@openssh\.com\>"
|
||||
|
||||
syn keyword sshdconfigHostKeyAlgo ssh-ed25519
|
||||
syn match sshdconfigHostKeyAlgo "\<ssh-ed25519-cert-v01@openssh\.com\>"
|
||||
syn keyword sshdconfigHostKeyAlgo ssh-rsa
|
||||
syn keyword sshdconfigHostKeyAlgo ssh-dss
|
||||
syn keyword sshdconfigHostKeyAlgo ecdsa-sha2-nistp256
|
||||
syn keyword sshdconfigHostKeyAlgo ecdsa-sha2-nistp384
|
||||
syn keyword sshdconfigHostKeyAlgo ecdsa-sha2-nistp521
|
||||
syn match sshdconfigHostKeyAlgo "\<ssh-rsa-cert-v01@openssh\.com\>"
|
||||
syn match sshdconfigHostKeyAlgo "\<ssh-dss-cert-v01@openssh\.com\>"
|
||||
syn match sshdconfigHostKeyAlgo "\<ecdsa-sha2-nistp256-cert-v01@openssh\.com\>"
|
||||
syn match sshdconfigHostKeyAlgo "\<ecdsa-sha2-nistp384-cert-v01@openssh\.com\>"
|
||||
syn match sshdconfigHostKeyAlgo "\<ecdsa-sha2-nistp521-cert-v01@openssh\.com\>"
|
||||
|
||||
syn keyword sshdconfigRootLogin prohibit-password without-password forced-commands-only
|
||||
|
||||
@@ -73,11 +113,14 @@ syn match sshdconfigIPQoS "af4[123]"
|
||||
syn match sshdconfigIPQoS "cs[0-7]"
|
||||
syn keyword sshdconfigIPQoS ef lowdelay throughput reliability
|
||||
|
||||
syn keyword sshdconfigKexAlgo ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521
|
||||
syn keyword sshdconfigKexAlgo diffie-hellman-group-exchange-sha256
|
||||
syn keyword sshdconfigKexAlgo diffie-hellman-group-exchange-sha1
|
||||
syn keyword sshdconfigKexAlgo diffie-hellman-group14-sha1
|
||||
syn keyword sshdconfigKexAlgo diffie-hellman-group1-sha1
|
||||
syn keyword sshdconfigKexAlgo diffie-hellman-group1-sha1
|
||||
syn keyword sshdconfigKexAlgo diffie-hellman-group14-sha1
|
||||
syn keyword sshdconfigKexAlgo diffie-hellman-group-exchange-sha1
|
||||
syn keyword sshdconfigKexAlgo diffie-hellman-group-exchange-sha256
|
||||
syn keyword sshdconfigKexAlgo ecdh-sha2-nistp256
|
||||
syn keyword sshdconfigKexAlgo ecdh-sha2-nistp384
|
||||
syn keyword sshdconfigKexAlgo ecdh-sha2-nistp521
|
||||
syn match sshdconfigKexAlgo "\<curve25519-sha256@libssh\.org\>"
|
||||
|
||||
syn keyword sshdconfigTunnel point-to-point ethernet
|
||||
|
||||
@@ -215,8 +258,9 @@ if version >= 508 || !exists("did_sshdconfig_syntax_inits")
|
||||
HiLink sshdconfigPrivilegeSeparation sshdconfigEnum
|
||||
HiLink sshdconfigTcpForwarding sshdconfigEnum
|
||||
HiLink sshdconfigRootLogin sshdconfigEnum
|
||||
HiLink sshdconfigCipher sshdconfigEnum
|
||||
HiLink sshdconfigCiphers sshdconfigEnum
|
||||
HiLink sshdconfigMAC sshdconfigEnum
|
||||
HiLink sshdconfigHostKeyAlgo sshdconfigEnum
|
||||
HiLink sshdconfigRootLogin sshdconfigEnum
|
||||
HiLink sshdconfigLogLevel sshdconfigEnum
|
||||
HiLink sshdconfigSysLogFacility sshdconfigEnum
|
||||
|
||||
+64
-37
@@ -1,14 +1,10 @@
|
||||
" Vim syntax file
|
||||
" Language: VHDL
|
||||
" Maintainer: Daniel Kho <daniel.kho@tauhop.com>
|
||||
" Language: VHDL [VHSIC (Very High Speed Integrated Circuit) Hardware Description Language]
|
||||
" Maintainer: Daniel Kho <daniel.kho@tauhop.com>
|
||||
" Previous Maintainer: Czo <Olivier.Sirol@lip6.fr>
|
||||
" Credits: Stephan Hegel <stephan.hegel@snc.siemens.com.cn>
|
||||
" Last Changed: 2015 Dec 4 by Daniel Kho
|
||||
" Credits: Stephan Hegel <stephan.hegel@snc.siemens.com.cn>
|
||||
" Last Changed: 2016 Mar 05 by Daniel Kho
|
||||
|
||||
" VHSIC (Very High Speed Integrated Circuit) Hardware Description Language
|
||||
|
||||
" 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")
|
||||
@@ -56,17 +52,40 @@ syn keyword vhdlStatement note warning error failure
|
||||
syn match vhdlStatement "\<\(if\|else\)\>"
|
||||
syn match vhdlError "\<else\s\+if\>"
|
||||
|
||||
" Predefined VHDL types
|
||||
syn keyword vhdlType bit bit_vector
|
||||
syn keyword vhdlType character boolean integer real time
|
||||
syn keyword vhdlType boolean_vector integer_vector real_vector time_vector
|
||||
syn keyword vhdlType string severity_level
|
||||
" Predefined standard ieee VHDL types
|
||||
syn keyword vhdlType positive natural signed unsigned
|
||||
syn keyword vhdlType unresolved_signed unresolved_unsigned u_signed u_unsigned
|
||||
syn keyword vhdlType line text
|
||||
syn keyword vhdlType std_logic std_logic_vector
|
||||
syn keyword vhdlType std_ulogic std_ulogic_vector
|
||||
" Types and type qualifiers
|
||||
" Predefined standard VHDL types
|
||||
syn match vhdlType "\<bit\>\'\="
|
||||
syn match vhdlType "\<boolean\>\'\="
|
||||
syn match vhdlType "\<natural\>\'\="
|
||||
syn match vhdlType "\<positive\>\'\="
|
||||
syn match vhdlType "\<integer\>\'\="
|
||||
syn match vhdlType "\<real\>\'\="
|
||||
syn match vhdlType "\<time\>\'\="
|
||||
|
||||
syn match vhdlType "\<bit_vector\>\'\="
|
||||
syn match vhdlType "\<boolean_vector\>\'\="
|
||||
syn match vhdlType "\<integer_vector\>\'\="
|
||||
syn match vhdlType "\<real_vector\>\'\="
|
||||
syn match vhdlType "\<time_vector\>\'\="
|
||||
|
||||
syn match vhdlType "\<character\>\'\="
|
||||
syn match vhdlType "\<string\>\'\="
|
||||
"syn keyword vhdlType severity_level
|
||||
syn keyword vhdlType line
|
||||
syn keyword vhdlType text
|
||||
|
||||
" Predefined standard IEEE VHDL types
|
||||
syn match vhdlType "\<std_ulogic\>\'\="
|
||||
syn match vhdlType "\<std_logic\>\'\="
|
||||
syn match vhdlType "\<std_ulogic_vector\>\'\="
|
||||
syn match vhdlType "\<std_logic_vector\>\'\="
|
||||
syn match vhdlType "\<unresolved_signed\>\'\="
|
||||
syn match vhdlType "\<unresolved_unsigned\>\'\="
|
||||
syn match vhdlType "\<u_signed\>\'\="
|
||||
syn match vhdlType "\<u_unsigned\>\'\="
|
||||
syn match vhdlType "\<signed\>\'\="
|
||||
syn match vhdlType "\<unsigned\>\'\="
|
||||
|
||||
|
||||
" array attributes
|
||||
syn match vhdlAttribute "\'high"
|
||||
@@ -191,15 +210,23 @@ syn case ignore
|
||||
syn region vhdlComment start="/\*" end="\*/" contains=vhdlTodo,vhdlFixme,@Spell
|
||||
syn match vhdlComment "\(^\|\s\)--.*" contains=vhdlTodo,vhdlFixme,@Spell
|
||||
|
||||
" Standard IEEE P1076.6 preprocessor directives (metacomments).
|
||||
syn match vhdlPreProc "/\*\s*rtl_synthesis\s\+\(on\|off\)\s*\*/"
|
||||
syn match vhdlPreProc "\(^\|\s\)--\s*rtl_synthesis\s\+\(on\|off\)\s*"
|
||||
syn match vhdlPreProc "/\*\s*rtl_syn\s\+\(on\|off\)\s*\*/"
|
||||
syn match vhdlPreProc "\(^\|\s\)--\s*rtl_syn\s\+\(on\|off\)\s*"
|
||||
|
||||
" Industry-standard directives. These are not standard VHDL, but are commonly
|
||||
" used in the industry.
|
||||
syn match vhdlPreProc "/\*\s*synthesis\s\+translate_\(on\|off\)\s*\*/"
|
||||
"syn match vhdlPreProc "/\*\s*simulation\s\+translate_\(on\|off\)\s*\*/"
|
||||
syn match vhdlPreProc "/\*\s*pragma\s\+translate_\(on\|off\)\s*\*/"
|
||||
syn match vhdlPreProc "/\*\s*pragma\s\+synthesis_\(on\|off\)\s*\*/"
|
||||
syn match vhdlPreProc "/\*\s*synopsys\s\+translate_\(on\|off\)\s*\*/"
|
||||
|
||||
syn match vhdlPreProc "\(^\|\s\)--\s*synthesis\s\+translate_\(on\|off\)\s*"
|
||||
"syn match vhdlPreProc "\(^\|\s\)--\s*simulation\s\+translate_\(on\|off\)\s*"
|
||||
syn match vhdlPreProc "\(^\|\s\)--\s*pragma\s\+translate_\(on\|off\)\s*"
|
||||
syn match vhdlPreProc "\(^\|\s\)--\s*pragma\s\+synthesis_\(on\|off\)\s*"
|
||||
syn match vhdlPreProc "\(^\|\s\)--\s*synopsys\s\+translate_\(on\|off\)\s*"
|
||||
|
||||
@@ -216,24 +243,24 @@ if version >= 508 || !exists("did_vhdl_syntax_inits")
|
||||
else
|
||||
command -nargs=+ HiLink hi def link <args>
|
||||
endif
|
||||
|
||||
HiLink vhdlSpecial Special
|
||||
HiLink vhdlStatement Statement
|
||||
HiLink vhdlCharacter Character
|
||||
HiLink vhdlString String
|
||||
HiLink vhdlVector Number
|
||||
HiLink vhdlBoolean Number
|
||||
HiLink vhdlTodo Todo
|
||||
HiLink vhdlFixme Fixme
|
||||
HiLink vhdlComment Comment
|
||||
HiLink vhdlNumber Number
|
||||
HiLink vhdlTime Number
|
||||
HiLink vhdlType Type
|
||||
HiLink vhdlOperator Operator
|
||||
HiLink vhdlError Error
|
||||
HiLink vhdlAttribute Special
|
||||
HiLink vhdlPreProc PreProc
|
||||
|
||||
|
||||
HiLink vhdlSpecial Special
|
||||
HiLink vhdlStatement Statement
|
||||
HiLink vhdlCharacter Character
|
||||
HiLink vhdlString String
|
||||
HiLink vhdlVector Number
|
||||
HiLink vhdlBoolean Number
|
||||
HiLink vhdlTodo Todo
|
||||
HiLink vhdlFixme Fixme
|
||||
HiLink vhdlComment Comment
|
||||
HiLink vhdlNumber Number
|
||||
HiLink vhdlTime Number
|
||||
HiLink vhdlType Type
|
||||
HiLink vhdlOperator Operator
|
||||
HiLink vhdlError Error
|
||||
HiLink vhdlAttribute Special
|
||||
HiLink vhdlPreProc PreProc
|
||||
|
||||
delcommand HiLink
|
||||
endif
|
||||
|
||||
|
||||
@@ -43,6 +43,10 @@ else
|
||||
DEL = del
|
||||
endif
|
||||
endif
|
||||
# Set the default $(WINVER) to make it work with WinXP.
|
||||
ifndef WINVER
|
||||
WINVER = 0x0501
|
||||
endif
|
||||
CXX := $(CROSS_COMPILE)g++
|
||||
WINDRES := $(CROSS_COMPILE)windres
|
||||
WINDRES_CXX = $(CXX)
|
||||
@@ -68,7 +72,7 @@ $(DLL): $(OBJ) $(RES) $(DEFFILE)
|
||||
$(LIBS)
|
||||
|
||||
gvimext.o: gvimext.cpp
|
||||
$(CXX) $(CXXFLAGS) -DFEAT_GETTEXT -c $? -o $@
|
||||
$(CXX) $(CXXFLAGS) -DFEAT_GETTEXT -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) -c $? -o $@
|
||||
|
||||
$(RES): gvimext_ming.rc
|
||||
$(WINDRES) $(WINDRES_FLAGS) --input-format=rc --output-format=coff -DMING $? -o $@
|
||||
|
||||
@@ -1255,7 +1255,7 @@
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>98</string>
|
||||
<string>99</string>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
|
||||
+1
-1
@@ -464,7 +464,7 @@ NBDEBUG_DEP = nbdebug.h nbdebug.c
|
||||
!endif
|
||||
|
||||
!if ("$(CHANNEL)"=="yes")
|
||||
DEFINES = $(DEFINES) -DFEAT_CHANNEL
|
||||
DEFINES = $(DEFINES) -DFEAT_JOB_CHANNEL
|
||||
!endif
|
||||
|
||||
!ifdef XPM
|
||||
|
||||
@@ -529,7 +529,7 @@ endif
|
||||
endif
|
||||
|
||||
ifeq ($(CHANNEL),yes)
|
||||
DEFINES += -DFEAT_CHANNEL
|
||||
DEFINES += -DFEAT_JOB_CHANNEL
|
||||
endif
|
||||
|
||||
# DirectWrite (DirectX)
|
||||
|
||||
+1
-1
@@ -332,7 +332,7 @@ XPM_INC = -I $(XPM)\include -I $(XPM)\..\include
|
||||
!if "$(CHANNEL)" == "yes"
|
||||
CHANNEL_PRO = proto/channel.pro
|
||||
CHANNEL_OBJ = $(OBJDIR)/channel.obj
|
||||
CHANNEL_DEFS = -DFEAT_CHANNEL
|
||||
CHANNEL_DEFS = -DFEAT_JOB_CHANNEL
|
||||
|
||||
NETBEANS_LIB = WSock32.lib
|
||||
!endif
|
||||
|
||||
Vendored
+1
-1
@@ -7511,7 +7511,7 @@ if test "$enable_netbeans" = "yes"; then
|
||||
|
||||
fi
|
||||
if test "$enable_channel" = "yes"; then
|
||||
$as_echo "#define FEAT_CHANNEL 1" >>confdefs.h
|
||||
$as_echo "#define FEAT_JOB_CHANNEL 1" >>confdefs.h
|
||||
|
||||
CHANNEL_SRC="channel.c"
|
||||
|
||||
|
||||
+1
-1
@@ -3732,7 +3732,7 @@ build_stl_str_hl(
|
||||
{
|
||||
/* remove group if all items are empty */
|
||||
for (n = groupitem[groupdepth] + 1; n < curitem; n++)
|
||||
if (item[n].type == Normal)
|
||||
if (item[n].type == Normal || item[n].type == Highlight)
|
||||
break;
|
||||
if (n == curitem)
|
||||
{
|
||||
|
||||
+1573
-267
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -432,7 +432,7 @@
|
||||
#undef FEAT_NETBEANS_INTG
|
||||
|
||||
/* Define if you want to include process communication. */
|
||||
#undef FEAT_CHANNEL
|
||||
#undef FEAT_JOB_CHANNEL
|
||||
|
||||
/* Define default global runtime path */
|
||||
#undef RUNTIME_GLOBAL
|
||||
|
||||
+1
-1
@@ -2067,7 +2067,7 @@ if test "$enable_netbeans" = "yes"; then
|
||||
AC_SUBST(NETBEANS_OBJ)
|
||||
fi
|
||||
if test "$enable_channel" = "yes"; then
|
||||
AC_DEFINE(FEAT_CHANNEL)
|
||||
AC_DEFINE(FEAT_JOB_CHANNEL)
|
||||
CHANNEL_SRC="channel.c"
|
||||
AC_SUBST(CHANNEL_SRC)
|
||||
CHANNEL_OBJ="objects/channel.o"
|
||||
|
||||
+1
-1
@@ -641,7 +641,7 @@ diff_write(buf_T *buf, char_u *fname)
|
||||
*/
|
||||
void
|
||||
ex_diffupdate(
|
||||
exarg_T *eap UNUSED) /* can be NULL */
|
||||
exarg_T *eap) /* can be NULL */
|
||||
{
|
||||
buf_T *buf;
|
||||
int idx_orig;
|
||||
|
||||
+2
-2
@@ -2320,13 +2320,13 @@ keymap_init(void)
|
||||
/* try finding "keymap/'keymap'_'encoding'.vim" in 'runtimepath' */
|
||||
vim_snprintf((char *)buf, buflen, "keymap/%s_%s.vim",
|
||||
curbuf->b_p_keymap, p_enc);
|
||||
if (source_runtime(buf, FALSE) == FAIL)
|
||||
if (source_runtime(buf, 0) == FAIL)
|
||||
# endif
|
||||
{
|
||||
/* try finding "keymap/'keymap'.vim" in 'runtimepath' */
|
||||
vim_snprintf((char *)buf, buflen, "keymap/%s.vim",
|
||||
curbuf->b_p_keymap);
|
||||
if (source_runtime(buf, FALSE) == FAIL)
|
||||
if (source_runtime(buf, 0) == FAIL)
|
||||
{
|
||||
vim_free(buf);
|
||||
return (char_u *)N_("E544: Keymap file not found");
|
||||
|
||||
@@ -1599,7 +1599,9 @@ ins_redraw(
|
||||
curwin->w_p_cole > 0
|
||||
# endif
|
||||
)
|
||||
# ifdef FEAT_AUTOCMD
|
||||
&& !equalpos(last_cursormoved, curwin->w_cursor)
|
||||
# endif
|
||||
# ifdef FEAT_INS_EXPAND
|
||||
&& !pum_visible()
|
||||
# endif
|
||||
@@ -1625,12 +1627,16 @@ ins_redraw(
|
||||
# ifdef FEAT_CONCEAL
|
||||
if (curwin->w_p_cole > 0)
|
||||
{
|
||||
# ifdef FEAT_AUTOCMD
|
||||
conceal_old_cursor_line = last_cursormoved.lnum;
|
||||
# endif
|
||||
conceal_new_cursor_line = curwin->w_cursor.lnum;
|
||||
conceal_update_lines = TRUE;
|
||||
}
|
||||
# endif
|
||||
# ifdef FEAT_AUTOCMD
|
||||
last_cursormoved = curwin->w_cursor;
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+155
-1047
File diff suppressed because it is too large
Load Diff
+146
-127
@@ -6575,135 +6575,9 @@ ex_viusage(exarg_T *eap UNUSED)
|
||||
do_cmdline_cmd((char_u *)"help normal-index");
|
||||
}
|
||||
|
||||
static void helptags_one(char_u *dir, char_u *ext, char_u *lang, int add_help_tags);
|
||||
|
||||
/*
|
||||
* ":helptags"
|
||||
* Generate tags in one help directory.
|
||||
*/
|
||||
void
|
||||
ex_helptags(exarg_T *eap)
|
||||
{
|
||||
expand_T xpc;
|
||||
char_u *dirname;
|
||||
int add_help_tags = FALSE;
|
||||
#ifdef FEAT_MULTI_LANG
|
||||
int len;
|
||||
int i, j;
|
||||
garray_T ga;
|
||||
char_u lang[2];
|
||||
char_u ext[5];
|
||||
char_u fname[8];
|
||||
int filecount;
|
||||
char_u **files;
|
||||
#endif
|
||||
|
||||
/* Check for ":helptags ++t {dir}". */
|
||||
if (STRNCMP(eap->arg, "++t", 3) == 0 && vim_iswhite(eap->arg[3]))
|
||||
{
|
||||
add_help_tags = TRUE;
|
||||
eap->arg = skipwhite(eap->arg + 3);
|
||||
}
|
||||
|
||||
ExpandInit(&xpc);
|
||||
xpc.xp_context = EXPAND_DIRECTORIES;
|
||||
dirname = ExpandOne(&xpc, eap->arg, NULL,
|
||||
WILD_LIST_NOTFOUND|WILD_SILENT, WILD_EXPAND_FREE);
|
||||
if (dirname == NULL || !mch_isdir(dirname))
|
||||
{
|
||||
EMSG2(_("E150: Not a directory: %s"), eap->arg);
|
||||
vim_free(dirname);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef FEAT_MULTI_LANG
|
||||
/* Get a list of all files in the help directory and in subdirectories. */
|
||||
STRCPY(NameBuff, dirname);
|
||||
add_pathsep(NameBuff);
|
||||
STRCAT(NameBuff, "**");
|
||||
if (gen_expand_wildcards(1, &NameBuff, &filecount, &files,
|
||||
EW_FILE|EW_SILENT) == FAIL
|
||||
|| filecount == 0)
|
||||
{
|
||||
EMSG2("E151: No match: %s", NameBuff);
|
||||
vim_free(dirname);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Go over all files in the directory to find out what languages are
|
||||
* present. */
|
||||
ga_init2(&ga, 1, 10);
|
||||
for (i = 0; i < filecount; ++i)
|
||||
{
|
||||
len = (int)STRLEN(files[i]);
|
||||
if (len > 4)
|
||||
{
|
||||
if (STRICMP(files[i] + len - 4, ".txt") == 0)
|
||||
{
|
||||
/* ".txt" -> language "en" */
|
||||
lang[0] = 'e';
|
||||
lang[1] = 'n';
|
||||
}
|
||||
else if (files[i][len - 4] == '.'
|
||||
&& ASCII_ISALPHA(files[i][len - 3])
|
||||
&& ASCII_ISALPHA(files[i][len - 2])
|
||||
&& TOLOWER_ASC(files[i][len - 1]) == 'x')
|
||||
{
|
||||
/* ".abx" -> language "ab" */
|
||||
lang[0] = TOLOWER_ASC(files[i][len - 3]);
|
||||
lang[1] = TOLOWER_ASC(files[i][len - 2]);
|
||||
}
|
||||
else
|
||||
continue;
|
||||
|
||||
/* Did we find this language already? */
|
||||
for (j = 0; j < ga.ga_len; j += 2)
|
||||
if (STRNCMP(lang, ((char_u *)ga.ga_data) + j, 2) == 0)
|
||||
break;
|
||||
if (j == ga.ga_len)
|
||||
{
|
||||
/* New language, add it. */
|
||||
if (ga_grow(&ga, 2) == FAIL)
|
||||
break;
|
||||
((char_u *)ga.ga_data)[ga.ga_len++] = lang[0];
|
||||
((char_u *)ga.ga_data)[ga.ga_len++] = lang[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Loop over the found languages to generate a tags file for each one.
|
||||
*/
|
||||
for (j = 0; j < ga.ga_len; j += 2)
|
||||
{
|
||||
STRCPY(fname, "tags-xx");
|
||||
fname[5] = ((char_u *)ga.ga_data)[j];
|
||||
fname[6] = ((char_u *)ga.ga_data)[j + 1];
|
||||
if (fname[5] == 'e' && fname[6] == 'n')
|
||||
{
|
||||
/* English is an exception: use ".txt" and "tags". */
|
||||
fname[4] = NUL;
|
||||
STRCPY(ext, ".txt");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Language "ab" uses ".abx" and "tags-ab". */
|
||||
STRCPY(ext, ".xxx");
|
||||
ext[1] = fname[5];
|
||||
ext[2] = fname[6];
|
||||
}
|
||||
helptags_one(dirname, ext, fname, add_help_tags);
|
||||
}
|
||||
|
||||
ga_clear(&ga);
|
||||
FreeWild(filecount, files);
|
||||
|
||||
#else
|
||||
/* No language support, just use "*.txt" and "tags". */
|
||||
helptags_one(dirname, (char_u *)".txt", (char_u *)"tags", add_help_tags);
|
||||
#endif
|
||||
vim_free(dirname);
|
||||
}
|
||||
|
||||
static void
|
||||
helptags_one(
|
||||
char_u *dir, /* doc directory */
|
||||
@@ -6960,6 +6834,151 @@ helptags_one(
|
||||
fclose(fd_tags); /* there is no check for an error... */
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate tags in one help directory, taking care of translations.
|
||||
*/
|
||||
static void
|
||||
do_helptags(char_u *dirname, int add_help_tags)
|
||||
{
|
||||
#ifdef FEAT_MULTI_LANG
|
||||
int len;
|
||||
int i, j;
|
||||
garray_T ga;
|
||||
char_u lang[2];
|
||||
char_u ext[5];
|
||||
char_u fname[8];
|
||||
int filecount;
|
||||
char_u **files;
|
||||
|
||||
/* Get a list of all files in the help directory and in subdirectories. */
|
||||
STRCPY(NameBuff, dirname);
|
||||
add_pathsep(NameBuff);
|
||||
STRCAT(NameBuff, "**");
|
||||
if (gen_expand_wildcards(1, &NameBuff, &filecount, &files,
|
||||
EW_FILE|EW_SILENT) == FAIL
|
||||
|| filecount == 0)
|
||||
{
|
||||
EMSG2("E151: No match: %s", NameBuff);
|
||||
vim_free(dirname);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Go over all files in the directory to find out what languages are
|
||||
* present. */
|
||||
ga_init2(&ga, 1, 10);
|
||||
for (i = 0; i < filecount; ++i)
|
||||
{
|
||||
len = (int)STRLEN(files[i]);
|
||||
if (len > 4)
|
||||
{
|
||||
if (STRICMP(files[i] + len - 4, ".txt") == 0)
|
||||
{
|
||||
/* ".txt" -> language "en" */
|
||||
lang[0] = 'e';
|
||||
lang[1] = 'n';
|
||||
}
|
||||
else if (files[i][len - 4] == '.'
|
||||
&& ASCII_ISALPHA(files[i][len - 3])
|
||||
&& ASCII_ISALPHA(files[i][len - 2])
|
||||
&& TOLOWER_ASC(files[i][len - 1]) == 'x')
|
||||
{
|
||||
/* ".abx" -> language "ab" */
|
||||
lang[0] = TOLOWER_ASC(files[i][len - 3]);
|
||||
lang[1] = TOLOWER_ASC(files[i][len - 2]);
|
||||
}
|
||||
else
|
||||
continue;
|
||||
|
||||
/* Did we find this language already? */
|
||||
for (j = 0; j < ga.ga_len; j += 2)
|
||||
if (STRNCMP(lang, ((char_u *)ga.ga_data) + j, 2) == 0)
|
||||
break;
|
||||
if (j == ga.ga_len)
|
||||
{
|
||||
/* New language, add it. */
|
||||
if (ga_grow(&ga, 2) == FAIL)
|
||||
break;
|
||||
((char_u *)ga.ga_data)[ga.ga_len++] = lang[0];
|
||||
((char_u *)ga.ga_data)[ga.ga_len++] = lang[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Loop over the found languages to generate a tags file for each one.
|
||||
*/
|
||||
for (j = 0; j < ga.ga_len; j += 2)
|
||||
{
|
||||
STRCPY(fname, "tags-xx");
|
||||
fname[5] = ((char_u *)ga.ga_data)[j];
|
||||
fname[6] = ((char_u *)ga.ga_data)[j + 1];
|
||||
if (fname[5] == 'e' && fname[6] == 'n')
|
||||
{
|
||||
/* English is an exception: use ".txt" and "tags". */
|
||||
fname[4] = NUL;
|
||||
STRCPY(ext, ".txt");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Language "ab" uses ".abx" and "tags-ab". */
|
||||
STRCPY(ext, ".xxx");
|
||||
ext[1] = fname[5];
|
||||
ext[2] = fname[6];
|
||||
}
|
||||
helptags_one(dirname, ext, fname, add_help_tags);
|
||||
}
|
||||
|
||||
ga_clear(&ga);
|
||||
FreeWild(filecount, files);
|
||||
|
||||
#else
|
||||
/* No language support, just use "*.txt" and "tags". */
|
||||
helptags_one(dirname, (char_u *)".txt", (char_u *)"tags", add_help_tags);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
helptags_cb(char_u *fname, void *cookie)
|
||||
{
|
||||
do_helptags(fname, *(int *)cookie);
|
||||
}
|
||||
|
||||
/*
|
||||
* ":helptags"
|
||||
*/
|
||||
void
|
||||
ex_helptags(exarg_T *eap)
|
||||
{
|
||||
expand_T xpc;
|
||||
char_u *dirname;
|
||||
int add_help_tags = FALSE;
|
||||
|
||||
/* Check for ":helptags ++t {dir}". */
|
||||
if (STRNCMP(eap->arg, "++t", 3) == 0 && vim_iswhite(eap->arg[3]))
|
||||
{
|
||||
add_help_tags = TRUE;
|
||||
eap->arg = skipwhite(eap->arg + 3);
|
||||
}
|
||||
|
||||
if (STRCMP(eap->arg, "ALL") == 0)
|
||||
{
|
||||
do_in_path(p_rtp, (char_u *)"doc", DIP_ALL + DIP_DIR,
|
||||
helptags_cb, &add_help_tags);
|
||||
}
|
||||
else
|
||||
{
|
||||
ExpandInit(&xpc);
|
||||
xpc.xp_context = EXPAND_DIRECTORIES;
|
||||
dirname = ExpandOne(&xpc, eap->arg, NULL,
|
||||
WILD_LIST_NOTFOUND|WILD_SILENT, WILD_EXPAND_FREE);
|
||||
if (dirname == NULL || !mch_isdir(dirname))
|
||||
EMSG2(_("E150: Not a directory: %s"), eap->arg);
|
||||
else
|
||||
do_helptags(dirname, add_help_tags);
|
||||
vim_free(dirname);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(FEAT_SIGNS) || defined(PROTO)
|
||||
|
||||
/*
|
||||
|
||||
+6
-3
@@ -810,9 +810,6 @@ EX(CMD_loadview, "loadview", ex_loadview,
|
||||
EX(CMD_loadkeymap, "loadkeymap", ex_loadkeymap,
|
||||
CMDWIN,
|
||||
ADDR_LINES),
|
||||
EX(CMD_loadplugin, "loadplugin", ex_loadplugin,
|
||||
BANG|FILE1|TRLBAR|SBOXOK|CMDWIN,
|
||||
ADDR_LINES),
|
||||
EX(CMD_lockmarks, "lockmarks", ex_wrongmodifier,
|
||||
NEEDARG|EXTRA|NOTRLCOM,
|
||||
ADDR_LINES),
|
||||
@@ -1020,6 +1017,12 @@ EX(CMD_ownsyntax, "ownsyntax", ex_ownsyntax,
|
||||
EX(CMD_print, "print", ex_print,
|
||||
RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|SBOXOK,
|
||||
ADDR_LINES),
|
||||
EX(CMD_packadd, "packadd", ex_packadd,
|
||||
BANG|FILE1|NEEDARG|TRLBAR|SBOXOK|CMDWIN,
|
||||
ADDR_LINES),
|
||||
EX(CMD_packloadall, "packloadall", ex_packloadall,
|
||||
BANG|TRLBAR|SBOXOK|CMDWIN,
|
||||
ADDR_LINES),
|
||||
EX(CMD_pclose, "pclose", ex_pclose,
|
||||
BANG|TRLBAR,
|
||||
ADDR_LINES),
|
||||
|
||||
+218
-82
@@ -2106,7 +2106,7 @@ set_arglist(char_u *str)
|
||||
static int
|
||||
do_arglist(
|
||||
char_u *str,
|
||||
int what UNUSED,
|
||||
int what,
|
||||
int after UNUSED) /* 0 means before first one */
|
||||
{
|
||||
garray_T new_ga;
|
||||
@@ -2945,7 +2945,7 @@ ex_compiler(exarg_T *eap)
|
||||
do_unlet((char_u *)"b:current_compiler", TRUE);
|
||||
|
||||
sprintf((char *)buf, "compiler/%s.vim", eap->arg);
|
||||
if (source_runtime(buf, TRUE) == FAIL)
|
||||
if (source_runtime(buf, DIP_ALL) == FAIL)
|
||||
EMSG2(_("E666: compiler not supported: %s"), eap->arg);
|
||||
vim_free(buf);
|
||||
|
||||
@@ -2974,12 +2974,38 @@ ex_compiler(exarg_T *eap)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ":runtime {name}"
|
||||
* ":runtime [what] {name}"
|
||||
*/
|
||||
void
|
||||
ex_runtime(exarg_T *eap)
|
||||
{
|
||||
source_runtime(eap->arg, eap->forceit);
|
||||
char_u *arg = eap->arg;
|
||||
char_u *p = skiptowhite(arg);
|
||||
int len = (int)(p - arg);
|
||||
int flags = eap->forceit ? DIP_ALL : 0;
|
||||
|
||||
if (STRNCMP(arg, "START", len) == 0)
|
||||
{
|
||||
flags += DIP_START + DIP_NORTP;
|
||||
arg = skipwhite(arg + len);
|
||||
}
|
||||
else if (STRNCMP(arg, "OPT", len) == 0)
|
||||
{
|
||||
flags += DIP_OPT + DIP_NORTP;
|
||||
arg = skipwhite(arg + len);
|
||||
}
|
||||
else if (STRNCMP(arg, "PACK", len) == 0)
|
||||
{
|
||||
flags += DIP_START + DIP_OPT + DIP_NORTP;
|
||||
arg = skipwhite(arg + len);
|
||||
}
|
||||
else if (STRNCMP(arg, "ALL", len) == 0)
|
||||
{
|
||||
flags += DIP_START + DIP_OPT;
|
||||
arg = skipwhite(arg + len);
|
||||
}
|
||||
|
||||
source_runtime(arg, flags);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2991,20 +3017,31 @@ source_callback(char_u *fname, void *cookie UNUSED)
|
||||
/*
|
||||
* Source the file "name" from all directories in 'runtimepath'.
|
||||
* "name" can contain wildcards.
|
||||
* When "all" is TRUE, source all files, otherwise only the first one.
|
||||
* When "flags" has DIP_ALL: source all files, otherwise only the first one.
|
||||
*
|
||||
* return FAIL when no file could be sourced, OK otherwise.
|
||||
*/
|
||||
int
|
||||
source_runtime(char_u *name, int all)
|
||||
source_runtime(char_u *name, int flags)
|
||||
{
|
||||
return do_in_runtimepath(name, all, source_callback, NULL);
|
||||
return do_in_runtimepath(name, flags, source_callback, NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
/*
|
||||
* Find the file "name" in all directories in "path" and invoke
|
||||
* "callback(fname, cookie)".
|
||||
* "name" can contain wildcards.
|
||||
* When "flags" has DIP_ALL: source all files, otherwise only the first one.
|
||||
* When "flags" has DIP_DIR: find directories instead of files.
|
||||
* When "flags" has DIP_ERR: give an error message if there is no match.
|
||||
*
|
||||
* return FAIL when no file could be sourced, OK otherwise.
|
||||
*/
|
||||
int
|
||||
do_in_path(
|
||||
char_u *path,
|
||||
char_u *name,
|
||||
int all,
|
||||
int flags,
|
||||
void (*callback)(char_u *fname, void *ck),
|
||||
void *cookie)
|
||||
{
|
||||
@@ -3041,7 +3078,7 @@ do_in_path(
|
||||
|
||||
/* Loop over all entries in 'runtimepath'. */
|
||||
rtp = rtp_copy;
|
||||
while (*rtp != NUL && (all || !did_one))
|
||||
while (*rtp != NUL && ((flags & DIP_ALL) || !did_one))
|
||||
{
|
||||
/* Copy the path from 'runtimepath' to buf[]. */
|
||||
copy_option_part(&rtp, buf, MAXPATHL, ",");
|
||||
@@ -3058,7 +3095,7 @@ do_in_path(
|
||||
|
||||
/* Loop over all patterns in "name" */
|
||||
np = name;
|
||||
while (*np != NUL && (all || !did_one))
|
||||
while (*np != NUL && ((flags & DIP_ALL) || !did_one))
|
||||
{
|
||||
/* Append the pattern from "name" to buf[]. */
|
||||
copy_option_part(&np, tail, (int)(MAXPATHL - (tail - buf)),
|
||||
@@ -3073,13 +3110,13 @@ do_in_path(
|
||||
|
||||
/* Expand wildcards, invoke the callback for each match. */
|
||||
if (gen_expand_wildcards(1, &buf, &num_files, &files,
|
||||
EW_FILE) == OK)
|
||||
(flags & DIP_DIR) ? EW_DIR : EW_FILE) == OK)
|
||||
{
|
||||
for (i = 0; i < num_files; ++i)
|
||||
{
|
||||
(*callback)(files[i], cookie);
|
||||
did_one = TRUE;
|
||||
if (!all)
|
||||
if (!(flags & DIP_ALL))
|
||||
break;
|
||||
}
|
||||
FreeWild(num_files, files);
|
||||
@@ -3090,11 +3127,18 @@ do_in_path(
|
||||
}
|
||||
vim_free(buf);
|
||||
vim_free(rtp_copy);
|
||||
if (p_verbose > 0 && !did_one && name != NULL)
|
||||
if (!did_one && name != NULL)
|
||||
{
|
||||
verbose_enter();
|
||||
smsg((char_u *)_("not found in 'runtimepath': \"%s\""), name);
|
||||
verbose_leave();
|
||||
char *basepath = path == p_rtp ? "runtimepath" : "packpath";
|
||||
|
||||
if (flags & DIP_ERR)
|
||||
EMSG3(_(e_dirnotf), basepath, name);
|
||||
else if (p_verbose > 0)
|
||||
{
|
||||
verbose_enter();
|
||||
smsg((char_u *)_("not found in '%s': \"%s\""), basepath, name);
|
||||
verbose_leave();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef AMIGA
|
||||
@@ -3107,8 +3151,8 @@ do_in_path(
|
||||
/*
|
||||
* Find "name" in 'runtimepath'. When found, invoke the callback function for
|
||||
* it: callback(fname, "cookie")
|
||||
* When "all" is TRUE repeat for all matches, otherwise only the first one is
|
||||
* used.
|
||||
* When "flags" has DIP_ALL repeat for all matches, otherwise only the first
|
||||
* one is used.
|
||||
* Returns OK when at least one match found, FAIL otherwise.
|
||||
*
|
||||
* If "name" is NULL calls callback for each entry in runtimepath. Cookie is
|
||||
@@ -3118,101 +3162,193 @@ do_in_path(
|
||||
int
|
||||
do_in_runtimepath(
|
||||
char_u *name,
|
||||
int all,
|
||||
int flags,
|
||||
void (*callback)(char_u *fname, void *ck),
|
||||
void *cookie)
|
||||
{
|
||||
return do_in_path(p_rtp, name, all, callback, cookie);
|
||||
int done = FAIL;
|
||||
char_u *s;
|
||||
int len;
|
||||
char *start_dir = "pack/*/start/*/%s";
|
||||
char *opt_dir = "pack/*/opt/*/%s";
|
||||
|
||||
if ((flags & DIP_NORTP) == 0)
|
||||
done = do_in_path(p_rtp, name, flags, callback, cookie);
|
||||
|
||||
if ((done == FAIL || (flags & DIP_ALL)) && (flags & DIP_START))
|
||||
{
|
||||
len = STRLEN(start_dir) + STRLEN(name);
|
||||
s = alloc(len);
|
||||
if (s == NULL)
|
||||
return FAIL;
|
||||
vim_snprintf((char *)s, len, start_dir, name);
|
||||
done = do_in_path(p_pp, s, flags, callback, cookie);
|
||||
vim_free(s);
|
||||
}
|
||||
|
||||
if ((done == FAIL || (flags & DIP_ALL)) && (flags & DIP_OPT))
|
||||
{
|
||||
len = STRLEN(opt_dir) + STRLEN(name);
|
||||
s = alloc(len);
|
||||
if (s == NULL)
|
||||
return FAIL;
|
||||
vim_snprintf((char *)s, len, opt_dir, name);
|
||||
done = do_in_path(p_pp, s, flags, callback, cookie);
|
||||
vim_free(s);
|
||||
}
|
||||
|
||||
return done;
|
||||
}
|
||||
|
||||
/*
|
||||
* Expand wildcards in "pat" and invoke do_source() for each match.
|
||||
*/
|
||||
static void
|
||||
source_all_matches(char_u *pat)
|
||||
{
|
||||
int num_files;
|
||||
char_u **files;
|
||||
int i;
|
||||
|
||||
if (gen_expand_wildcards(1, &pat, &num_files, &files, EW_FILE) == OK)
|
||||
{
|
||||
for (i = 0; i < num_files; ++i)
|
||||
(void)do_source(files[i], FALSE, DOSO_NONE);
|
||||
FreeWild(num_files, files);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
source_pack_plugin(char_u *fname, void *cookie UNUSED)
|
||||
add_pack_plugin(char_u *fname, void *cookie)
|
||||
{
|
||||
char_u *p6, *p5, *p4, *p3, *p2, *p1, *p;
|
||||
int c;
|
||||
char_u *new_rtp;
|
||||
int keep;
|
||||
int oldlen;
|
||||
int addlen;
|
||||
char_u *p4, *p3, *p2, *p1, *p;
|
||||
char_u *insp;
|
||||
int c;
|
||||
char_u *new_rtp;
|
||||
int keep;
|
||||
int oldlen;
|
||||
int addlen;
|
||||
char_u *ffname = fix_fname(fname);
|
||||
int load_files = cookie != NULL;
|
||||
|
||||
p6 = p5 = p4 = p3 = p2 = p1 = get_past_head(fname);
|
||||
for (p = p1; *p; mb_ptr_adv(p))
|
||||
if (vim_ispathsep_nocolon(*p))
|
||||
{
|
||||
p6 = p5; p5 = p4; p4 = p3; p3 = p2; p2 = p1; p1 = p;
|
||||
}
|
||||
|
||||
/* now we have:
|
||||
* rtp/pack/name/ever/name/plugin/name.vim
|
||||
* p6 p5 p4 p3 p2 p1
|
||||
*/
|
||||
|
||||
/* find the part up to "pack" in 'runtimepath' */
|
||||
c = *p6;
|
||||
*p6 = NUL;
|
||||
p = (char_u *)strstr((char *)p_rtp, (char *)fname);
|
||||
if (p == NULL)
|
||||
/* not found, append at the end */
|
||||
p = p_rtp + STRLEN(p_rtp);
|
||||
else
|
||||
/* append after the matching directory. */
|
||||
p += STRLEN(fname);
|
||||
*p6 = c;
|
||||
|
||||
c = *p2;
|
||||
*p2 = NUL;
|
||||
if (strstr((char *)p_rtp, (char *)fname) == NULL)
|
||||
if (ffname == NULL)
|
||||
return;
|
||||
if (strstr((char *)p_rtp, (char *)ffname) == NULL)
|
||||
{
|
||||
/* directory not in 'runtimepath', add it */
|
||||
p4 = p3 = p2 = p1 = get_past_head(ffname);
|
||||
for (p = p1; *p; mb_ptr_adv(p))
|
||||
if (vim_ispathsep_nocolon(*p))
|
||||
{
|
||||
p4 = p3; p3 = p2; p2 = p1; p1 = p;
|
||||
}
|
||||
|
||||
/* now we have:
|
||||
* rtp/pack/name/start/name
|
||||
* p4 p3 p2 p1
|
||||
*
|
||||
* find the part up to "pack" in 'runtimepath' */
|
||||
c = *p4;
|
||||
*p4 = NUL;
|
||||
insp = (char_u *)strstr((char *)p_rtp, (char *)ffname);
|
||||
if (insp == NULL)
|
||||
/* not found, append at the end */
|
||||
insp = p_rtp + STRLEN(p_rtp);
|
||||
else
|
||||
{
|
||||
/* append after the matching directory. */
|
||||
insp += STRLEN(ffname);
|
||||
while (*insp != NUL && *insp != ',')
|
||||
++insp;
|
||||
}
|
||||
*p4 = c;
|
||||
|
||||
oldlen = (int)STRLEN(p_rtp);
|
||||
addlen = (int)STRLEN(fname);
|
||||
addlen = (int)STRLEN(ffname);
|
||||
new_rtp = alloc(oldlen + addlen + 2);
|
||||
if (new_rtp == NULL)
|
||||
{
|
||||
*p2 = c;
|
||||
return;
|
||||
}
|
||||
keep = (int)(p - p_rtp);
|
||||
goto theend;
|
||||
keep = (int)(insp - p_rtp);
|
||||
mch_memmove(new_rtp, p_rtp, keep);
|
||||
new_rtp[keep] = ',';
|
||||
mch_memmove(new_rtp + keep + 1, fname, addlen + 1);
|
||||
mch_memmove(new_rtp + keep + 1, ffname, addlen + 1);
|
||||
if (p_rtp[keep] != NUL)
|
||||
mch_memmove(new_rtp + keep + 1 + addlen, p_rtp + keep,
|
||||
oldlen - keep + 1);
|
||||
free_string_option(p_rtp);
|
||||
p_rtp = new_rtp;
|
||||
set_option_value((char_u *)"rtp", 0L, new_rtp, 0);
|
||||
vim_free(new_rtp);
|
||||
}
|
||||
*p2 = c;
|
||||
|
||||
(void)do_source(fname, FALSE, DOSO_NONE);
|
||||
if (load_files)
|
||||
{
|
||||
static char *plugpat = "%s/plugin/*.vim";
|
||||
static char *ftpat = "%s/ftdetect/*.vim";
|
||||
int len;
|
||||
char_u *pat;
|
||||
|
||||
len = (int)STRLEN(ffname) + (int)STRLEN(ftpat);
|
||||
pat = alloc(len);
|
||||
if (pat == NULL)
|
||||
goto theend;
|
||||
vim_snprintf((char *)pat, len, plugpat, ffname);
|
||||
source_all_matches(pat);
|
||||
|
||||
#ifdef FEAT_AUTOCMD
|
||||
{
|
||||
char_u *cmd = vim_strsave((char_u *)"g:did_load_filetypes");
|
||||
|
||||
/* If runtime/filetype.vim wasn't loaded yet, the scripts will be
|
||||
* found when it loads. */
|
||||
if (cmd != NULL && eval_to_number(cmd) > 0)
|
||||
{
|
||||
do_cmdline_cmd((char_u *)"augroup filetypedetect");
|
||||
vim_snprintf((char *)pat, len, ftpat, ffname);
|
||||
source_all_matches(pat);
|
||||
do_cmdline_cmd((char_u *)"augroup END");
|
||||
}
|
||||
vim_free(cmd);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
theend:
|
||||
vim_free(ffname);
|
||||
}
|
||||
|
||||
static int did_source_packages = FALSE;
|
||||
|
||||
/*
|
||||
* ":packloadall"
|
||||
* Find plugins in the package directories and source them.
|
||||
*/
|
||||
void
|
||||
ex_packloadall(exarg_T *eap)
|
||||
{
|
||||
if (!did_source_packages || (eap != NULL && eap->forceit))
|
||||
{
|
||||
did_source_packages = TRUE;
|
||||
do_in_path(p_pp, (char_u *)"pack/*/start/*", DIP_ALL + DIP_DIR,
|
||||
add_pack_plugin, p_pp);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Source the plugins in the package directories.
|
||||
* ":packadd[!] {name}"
|
||||
*/
|
||||
void
|
||||
source_packages()
|
||||
ex_packadd(exarg_T *eap)
|
||||
{
|
||||
do_in_path(p_pp, (char_u *)"pack/*/ever/*/plugin/*.vim",
|
||||
TRUE, source_pack_plugin, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* ":loadplugin {name}"
|
||||
*/
|
||||
void
|
||||
ex_loadplugin(exarg_T *eap)
|
||||
{
|
||||
static char *pattern = "pack/*/opt/%s/plugin/*.vim";
|
||||
static char *plugpat = "pack/*/opt/%s";
|
||||
int len;
|
||||
char *pat;
|
||||
|
||||
len = (int)STRLEN(pattern) + (int)STRLEN(eap->arg);
|
||||
len = (int)STRLEN(plugpat) + (int)STRLEN(eap->arg);
|
||||
pat = (char *)alloc(len);
|
||||
if (pat == NULL)
|
||||
return;
|
||||
vim_snprintf(pat, len, pattern, eap->arg);
|
||||
do_in_path(p_pp, (char_u *)pat, TRUE, source_pack_plugin, NULL);
|
||||
vim_snprintf(pat, len, plugpat, eap->arg);
|
||||
do_in_path(p_pp, (char_u *)pat, DIP_ALL + DIP_DIR + DIP_ERR,
|
||||
add_pack_plugin, eap->forceit ? NULL : p_pp);
|
||||
vim_free(pat);
|
||||
}
|
||||
|
||||
|
||||
+14
-8
@@ -4208,6 +4208,11 @@ set_one_cmd_context(
|
||||
xp->xp_pattern = arg;
|
||||
break;
|
||||
|
||||
case CMD_packadd:
|
||||
xp->xp_context = EXPAND_PACKADD;
|
||||
xp->xp_pattern = arg;
|
||||
break;
|
||||
|
||||
#if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
|
||||
&& (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE))
|
||||
case CMD_language:
|
||||
@@ -5863,6 +5868,7 @@ static struct
|
||||
{EXPAND_SYNTIME, "syntime"},
|
||||
#endif
|
||||
{EXPAND_SETTINGS, "option"},
|
||||
{EXPAND_PACKADD, "packadd"},
|
||||
{EXPAND_SHELLCMD, "shellcmd"},
|
||||
#if defined(FEAT_SIGNS)
|
||||
{EXPAND_SIGN, "sign"},
|
||||
@@ -9281,7 +9287,7 @@ ex_bang(exarg_T *eap)
|
||||
* ":undo".
|
||||
*/
|
||||
static void
|
||||
ex_undo(exarg_T *eap UNUSED)
|
||||
ex_undo(exarg_T *eap)
|
||||
{
|
||||
if (eap->addr_count == 1) /* :undo 123 */
|
||||
undo_time(eap->line2, FALSE, FALSE, TRUE);
|
||||
@@ -9786,7 +9792,7 @@ theend:
|
||||
#if ((defined(FEAT_SESSION) || defined(FEAT_EVAL)) && defined(vim_mkdir)) \
|
||||
|| defined(PROTO)
|
||||
int
|
||||
vim_mkdir_emsg(char_u *name, int prot UNUSED)
|
||||
vim_mkdir_emsg(char_u *name, int prot)
|
||||
{
|
||||
if (vim_mkdir(name, prot) != 0)
|
||||
{
|
||||
@@ -11806,16 +11812,16 @@ ex_filetype(exarg_T *eap)
|
||||
{
|
||||
if (*arg == 'o' || !filetype_detect)
|
||||
{
|
||||
source_runtime((char_u *)FILETYPE_FILE, TRUE);
|
||||
source_runtime((char_u *)FILETYPE_FILE, DIP_ALL);
|
||||
filetype_detect = TRUE;
|
||||
if (plugin)
|
||||
{
|
||||
source_runtime((char_u *)FTPLUGIN_FILE, TRUE);
|
||||
source_runtime((char_u *)FTPLUGIN_FILE, DIP_ALL);
|
||||
filetype_plugin = TRUE;
|
||||
}
|
||||
if (indent)
|
||||
{
|
||||
source_runtime((char_u *)INDENT_FILE, TRUE);
|
||||
source_runtime((char_u *)INDENT_FILE, DIP_ALL);
|
||||
filetype_indent = TRUE;
|
||||
}
|
||||
}
|
||||
@@ -11831,18 +11837,18 @@ ex_filetype(exarg_T *eap)
|
||||
{
|
||||
if (plugin)
|
||||
{
|
||||
source_runtime((char_u *)FTPLUGOF_FILE, TRUE);
|
||||
source_runtime((char_u *)FTPLUGOF_FILE, DIP_ALL);
|
||||
filetype_plugin = FALSE;
|
||||
}
|
||||
if (indent)
|
||||
{
|
||||
source_runtime((char_u *)INDOFF_FILE, TRUE);
|
||||
source_runtime((char_u *)INDOFF_FILE, DIP_ALL);
|
||||
filetype_indent = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
source_runtime((char_u *)FTOFF_FILE, TRUE);
|
||||
source_runtime((char_u *)FTOFF_FILE, DIP_ALL);
|
||||
filetype_detect = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -432,7 +432,7 @@ get_exception_string(
|
||||
|
||||
if (type == ET_ERROR)
|
||||
{
|
||||
*should_free = FALSE;
|
||||
*should_free = TRUE;
|
||||
mesg = ((struct msglist *)value)->throw_msg;
|
||||
if (cmdname != NULL && *cmdname != NUL)
|
||||
{
|
||||
@@ -489,7 +489,7 @@ get_exception_string(
|
||||
else
|
||||
{
|
||||
*should_free = FALSE;
|
||||
ret = (char_u *) value;
|
||||
ret = (char_u *)value;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -112,6 +112,7 @@ static int expand_showtail(expand_T *xp);
|
||||
#ifdef FEAT_CMDL_COMPL
|
||||
static int expand_shellcmd(char_u *filepat, int *num_file, char_u ***file, int flagsarg);
|
||||
static int ExpandRTDir(char_u *pat, int *num_file, char_u ***file, char *dirname[]);
|
||||
static int ExpandPackAddDir(char_u *pat, int *num_file, char_u ***file);
|
||||
# ifdef FEAT_CMDHIST
|
||||
static char_u *get_history_arg(expand_T *xp, int idx);
|
||||
# endif
|
||||
@@ -4242,6 +4243,7 @@ addstar(
|
||||
|| context == EXPAND_COMPILER
|
||||
|| context == EXPAND_OWNSYNTAX
|
||||
|| context == EXPAND_FILETYPE
|
||||
|| context == EXPAND_PACKADD
|
||||
|| (context == EXPAND_TAGS && fname[0] == '/'))
|
||||
retval = vim_strnsave(fname, len);
|
||||
else
|
||||
@@ -4658,6 +4660,8 @@ ExpandFromContext(
|
||||
if (xp->xp_context == EXPAND_USER_LIST)
|
||||
return ExpandUserList(xp, num_file, file);
|
||||
# endif
|
||||
if (xp->xp_context == EXPAND_PACKADD)
|
||||
return ExpandPackAddDir(pat, num_file, file);
|
||||
|
||||
regmatch.regprog = vim_regcomp(pat, p_magic ? RE_MAGIC : 0);
|
||||
if (regmatch.regprog == NULL)
|
||||
@@ -5194,6 +5198,58 @@ ExpandRTDir(
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Expand loadplugin names:
|
||||
* 'packpath'/pack/ * /opt/{pat}
|
||||
*/
|
||||
static int
|
||||
ExpandPackAddDir(
|
||||
char_u *pat,
|
||||
int *num_file,
|
||||
char_u ***file)
|
||||
{
|
||||
char_u *s;
|
||||
char_u *e;
|
||||
char_u *match;
|
||||
garray_T ga;
|
||||
int i;
|
||||
int pat_len;
|
||||
|
||||
*num_file = 0;
|
||||
*file = NULL;
|
||||
pat_len = (int)STRLEN(pat);
|
||||
ga_init2(&ga, (int)sizeof(char *), 10);
|
||||
|
||||
s = alloc((unsigned)(pat_len + 26));
|
||||
if (s == NULL)
|
||||
{
|
||||
ga_clear_strings(&ga);
|
||||
return FAIL;
|
||||
}
|
||||
sprintf((char *)s, "pack/*/opt/%s*", pat);
|
||||
globpath(p_pp, s, &ga, 0);
|
||||
vim_free(s);
|
||||
|
||||
for (i = 0; i < ga.ga_len; ++i)
|
||||
{
|
||||
match = ((char_u **)ga.ga_data)[i];
|
||||
s = gettail(match);
|
||||
e = s + STRLEN(s);
|
||||
mch_memmove(match, s, e - s + 1);
|
||||
}
|
||||
|
||||
if (ga.ga_len == 0)
|
||||
return FAIL;
|
||||
|
||||
/* Sort and remove duplicates which can happen when specifying multiple
|
||||
* directories in dirnames. */
|
||||
remove_duplicates(&ga);
|
||||
|
||||
*file = ga.ga_data;
|
||||
*num_file = ga.ga_len;
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(FEAT_CMDL_COMPL) || defined(FEAT_EVAL) || defined(PROTO)
|
||||
@@ -5741,6 +5797,7 @@ clr_history(int histype)
|
||||
{
|
||||
vim_free(hisptr->hisstr);
|
||||
clear_hist_entry(hisptr);
|
||||
hisptr++;
|
||||
}
|
||||
hisidx[histype] = -1; /* mark history as cleared */
|
||||
hisnum[histype] = 0; /* reset identifier counter */
|
||||
|
||||
+2
-9
@@ -1264,15 +1264,8 @@
|
||||
/*
|
||||
* The +channel feature requires +eval.
|
||||
*/
|
||||
#if !defined(FEAT_EVAL) && defined(FEAT_CHANNEL)
|
||||
# undef FEAT_CHANNEL
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The +job feature requires +eval and Unix or MS-Windows.
|
||||
*/
|
||||
#if (defined(UNIX) || defined(WIN32)) && defined(FEAT_EVAL)
|
||||
# define FEAT_JOB
|
||||
#if !defined(FEAT_EVAL) && defined(FEAT_JOB_CHANNEL)
|
||||
# undef FEAT_JOB_CHANNEL
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@@ -1581,6 +1581,7 @@ EXTERN char_u e_notset[] INIT(= N_("E764: Option '%s' is not set"));
|
||||
#ifndef FEAT_CLIPBOARD
|
||||
EXTERN char_u e_invalidreg[] INIT(= N_("E850: Invalid register name"));
|
||||
#endif
|
||||
EXTERN char_u e_dirnotf[] INIT(= N_("E919: Directory not found in '%s': \"%s\""));
|
||||
|
||||
#ifdef MACOS_X_UNIX
|
||||
EXTERN short disallow_gui INIT(= FALSE);
|
||||
|
||||
@@ -5009,7 +5009,7 @@ ex_gui(exarg_T *eap)
|
||||
* of the argument ending up after the shell prompt. */
|
||||
msg_clr_eos_force();
|
||||
gui_start();
|
||||
#ifdef FEAT_CHANNEL
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
channel_gui_register_all();
|
||||
#endif
|
||||
}
|
||||
@@ -5049,7 +5049,7 @@ gui_find_bitmap(char_u *name, char_u *buffer, char *ext)
|
||||
if (STRLEN(name) > MAXPATHL - 14)
|
||||
return FAIL;
|
||||
vim_snprintf((char *)buffer, MAXPATHL, "bitmaps/%s.%s", name, ext);
|
||||
if (do_in_runtimepath(buffer, FALSE, gfp_setname, buffer) == FAIL
|
||||
if (do_in_runtimepath(buffer, 0, gfp_setname, buffer) == FAIL
|
||||
|| *buffer == NUL)
|
||||
return FAIL;
|
||||
return OK;
|
||||
|
||||
+66
-14
@@ -617,9 +617,9 @@ visibility_event(GtkWidget *widget UNUSED,
|
||||
*/
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
static gboolean is_key_pressed = FALSE;
|
||||
static gboolean blink_mode = TRUE;
|
||||
|
||||
static gboolean gui_gtk_is_blink_on(void);
|
||||
static gboolean gui_gtk_is_no_blink(void);
|
||||
static void gui_gtk_window_clear(GdkWindow *win);
|
||||
|
||||
static void
|
||||
@@ -636,7 +636,10 @@ gui_gtk3_update_cursor(cairo_t *cr)
|
||||
if (gui.row == gui.cursor_row)
|
||||
{
|
||||
gui.by_signal = TRUE;
|
||||
gui_update_cursor(TRUE, TRUE);
|
||||
if (State & CMDLINE)
|
||||
gui_update_cursor(TRUE, FALSE);
|
||||
else
|
||||
gui_update_cursor(TRUE, TRUE);
|
||||
gui.by_signal = FALSE;
|
||||
cairo_paint(cr);
|
||||
}
|
||||
@@ -647,9 +650,9 @@ gui_gtk3_should_draw_cursor(void)
|
||||
{
|
||||
unsigned int cond = 0;
|
||||
cond |= gui_gtk_is_blink_on();
|
||||
cond |= is_key_pressed;
|
||||
if (gui.cursor_col >= gui.col)
|
||||
cond |= is_key_pressed;
|
||||
cond |= gui.in_focus == FALSE;
|
||||
cond |= gui_gtk_is_no_blink();
|
||||
return cond;
|
||||
}
|
||||
|
||||
@@ -681,17 +684,32 @@ draw_event(GtkWidget *widget,
|
||||
for (i = 0; i < list->num_rectangles; i++)
|
||||
{
|
||||
const cairo_rectangle_t rect = list->rectangles[i];
|
||||
gui_gtk3_redraw(rect.x, rect.y, rect.width, rect.height);
|
||||
if (blink_mode)
|
||||
gui_gtk3_redraw(rect.x, rect.y, rect.width, rect.height);
|
||||
else
|
||||
{
|
||||
if (get_real_state() & VISUAL)
|
||||
gui_gtk3_redraw(rect.x, rect.y,
|
||||
rect.width, rect.height);
|
||||
else
|
||||
gui_redraw(rect.x, rect.y, rect.width, rect.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
cairo_rectangle_list_destroy(list);
|
||||
|
||||
if (get_real_state() & VISUAL)
|
||||
{
|
||||
if (gui.cursor_row == gui.row && gui.cursor_col >= gui.col)
|
||||
gui_update_cursor(TRUE, TRUE);
|
||||
}
|
||||
|
||||
cairo_paint(cr);
|
||||
}
|
||||
gui.by_signal = FALSE;
|
||||
|
||||
/* Add the cursor to the window if necessary.*/
|
||||
if (gui_gtk3_should_draw_cursor())
|
||||
if (gui_gtk3_should_draw_cursor() && blink_mode)
|
||||
gui_gtk3_update_cursor(cr);
|
||||
|
||||
return FALSE;
|
||||
@@ -790,20 +808,33 @@ gui_gtk_is_blink_on(void)
|
||||
{
|
||||
return blink_state == BLINK_ON;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gui_gtk_is_no_blink(void)
|
||||
{
|
||||
return blink_waittime == 0 || blink_ontime == 0 || blink_offtime == 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
gui_mch_set_blinking(long waittime, long on, long off)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
if (waittime == 0 || on == 0 || off == 0)
|
||||
{
|
||||
blink_mode = FALSE;
|
||||
|
||||
blink_waittime = 700;
|
||||
blink_ontime = 400;
|
||||
blink_offtime = 250;
|
||||
}
|
||||
else
|
||||
{
|
||||
blink_mode = TRUE;
|
||||
|
||||
blink_waittime = waittime;
|
||||
blink_ontime = on;
|
||||
blink_offtime = off;
|
||||
}
|
||||
#else
|
||||
blink_waittime = waittime;
|
||||
blink_ontime = on;
|
||||
blink_offtime = off;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1820,6 +1851,7 @@ gui_gtk_get_pointer(GtkWidget *widget,
|
||||
return gdk_window_get_device_position(win, dev , x, y, state);
|
||||
}
|
||||
|
||||
# if defined(FEAT_GUI_TABLINE) || defined(PROTO)
|
||||
static GdkWindow *
|
||||
gui_gtk_window_at_position(GtkWidget *widget,
|
||||
gint *x,
|
||||
@@ -1828,6 +1860,7 @@ gui_gtk_window_at_position(GtkWidget *widget,
|
||||
GdkDevice * const dev = gui_gtk_get_pointer_device(widget);
|
||||
return gdk_device_get_window_at_position(dev, x, y);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -3329,6 +3362,8 @@ set_toolbar_style(GtkToolbar *toolbar)
|
||||
case TBIS_SMALL: size = GTK_ICON_SIZE_SMALL_TOOLBAR; break;
|
||||
case TBIS_MEDIUM: size = GTK_ICON_SIZE_BUTTON; break;
|
||||
case TBIS_LARGE: size = GTK_ICON_SIZE_LARGE_TOOLBAR; break;
|
||||
case TBIS_HUGE: size = GTK_ICON_SIZE_DND; break;
|
||||
case TBIS_GIANT: size = GTK_ICON_SIZE_DIALOG; break;
|
||||
default: size = GTK_ICON_SIZE_INVALID; break;
|
||||
}
|
||||
oldsize = gtk_toolbar_get_icon_size(toolbar);
|
||||
@@ -6291,8 +6326,25 @@ gui_mch_flash(int msec)
|
||||
gui_mch_invert_rectangle(int r, int c, int nr, int nc)
|
||||
{
|
||||
#if GTK_CHECK_VERSION(3,0,0)
|
||||
/* TODO Replace GdkGC with Cairo */
|
||||
(void)r; (void)c; (void)nr; (void)nc;
|
||||
const GdkRectangle rect = {
|
||||
FILL_X(c), FILL_Y(r), nc * gui.char_width, nr * gui.char_height
|
||||
};
|
||||
cairo_t * const cr = cairo_create(gui.surface);
|
||||
|
||||
set_cairo_source_rgb_from_pixel(cr, gui.norm_pixel ^ gui.back_pixel);
|
||||
# if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1,9,2)
|
||||
cairo_set_operator(cr, CAIRO_OPERATOR_DIFFERENCE);
|
||||
# else
|
||||
/* Give an implementation for older cairo versions if necessary. */
|
||||
# endif
|
||||
gdk_cairo_rectangle(cr, &rect);
|
||||
cairo_fill(cr);
|
||||
|
||||
cairo_destroy(cr);
|
||||
|
||||
if (!gui.by_signal)
|
||||
gtk_widget_queue_draw_area(gui.drawarea, rect.x, rect.y,
|
||||
rect.width, rect.height);
|
||||
#else
|
||||
GdkGCValues values;
|
||||
GdkGC *invert_gc;
|
||||
|
||||
+1
-1
@@ -1741,7 +1741,7 @@ prt_find_resource(char *name, struct prt_ps_resource_S *resource)
|
||||
vim_strcat(buffer, (char_u *)name, MAXPATHL);
|
||||
vim_strcat(buffer, (char_u *)".ps", MAXPATHL);
|
||||
resource->filename[0] = NUL;
|
||||
retval = (do_in_runtimepath(buffer, FALSE, prt_resource_name,
|
||||
retval = (do_in_runtimepath(buffer, 0, prt_resource_name,
|
||||
resource->filename)
|
||||
&& resource->filename[0] != NUL);
|
||||
vim_free(buffer);
|
||||
|
||||
+2
-2
@@ -1061,7 +1061,7 @@ VimForeachRTP(PyObject *self UNUSED, PyObject *callable)
|
||||
data.callable = callable;
|
||||
data.result = NULL;
|
||||
|
||||
do_in_runtimepath(NULL, FALSE, &map_rtp_callback, &data);
|
||||
do_in_runtimepath(NULL, 0, &map_rtp_callback, &data);
|
||||
|
||||
if (data.result == NULL)
|
||||
{
|
||||
@@ -1150,7 +1150,7 @@ Vim_GetPaths(PyObject *self UNUSED)
|
||||
if (!(ret = PyList_New(0)))
|
||||
return NULL;
|
||||
|
||||
do_in_runtimepath(NULL, FALSE, &map_finder_callback, ret);
|
||||
do_in_runtimepath(NULL, 0, &map_finder_callback, ret);
|
||||
|
||||
if (PyErr_Occurred())
|
||||
{
|
||||
|
||||
@@ -506,6 +506,7 @@ json_decode_object(js_read_T *reader, typval_T *res, int options)
|
||||
return FAIL;
|
||||
}
|
||||
di->di_tv = item;
|
||||
di->di_tv.v_lock = 0;
|
||||
if (dict_add(res->vval.v_dict, di) == FAIL)
|
||||
{
|
||||
dictitem_free(di);
|
||||
|
||||
+2
-2
@@ -317,7 +317,7 @@
|
||||
# define PLINES_NOFILL(x) plines(x)
|
||||
#endif
|
||||
|
||||
#if defined(FEAT_CHANNEL) || defined(FEAT_JOB) || defined(FEAT_CLIENTSERVER)
|
||||
#if defined(FEAT_JOB_CHANNEL) || defined(FEAT_CLIENTSERVER)
|
||||
# define MESSAGE_QUEUE
|
||||
#endif
|
||||
|
||||
@@ -331,7 +331,7 @@
|
||||
# if defined(WIN32)
|
||||
# ifndef isnan
|
||||
# define isnan(x) _isnan(x)
|
||||
# define isinf(x) (!_finite(x) && !_isnan(x))
|
||||
static __inline int isinf(double x) { return !_finite(x) && !_isnan(x); }
|
||||
# endif
|
||||
# else
|
||||
# ifndef HAVE_ISNAN
|
||||
|
||||
+12
-5
@@ -644,13 +644,13 @@ vim_main2(int argc UNUSED, char **argv UNUSED)
|
||||
if (p_lpl)
|
||||
{
|
||||
# ifdef VMS /* Somehow VMS doesn't handle the "**". */
|
||||
source_runtime((char_u *)"plugin/*.vim", TRUE);
|
||||
source_runtime((char_u *)"plugin/*.vim", DIP_ALL);
|
||||
# else
|
||||
source_runtime((char_u *)"plugin/**/*.vim", TRUE);
|
||||
source_runtime((char_u *)"plugin/**/*.vim", DIP_ALL);
|
||||
# endif
|
||||
TIME_MSG("loading plugins");
|
||||
|
||||
source_packages();
|
||||
ex_packloadall(NULL);
|
||||
TIME_MSG("loading packages");
|
||||
}
|
||||
#endif
|
||||
@@ -1239,7 +1239,10 @@ main_loop(
|
||||
curwin->w_p_cole > 0
|
||||
# endif
|
||||
)
|
||||
&& !equalpos(last_cursormoved, curwin->w_cursor))
|
||||
# ifdef FEAT_AUTOCMD
|
||||
&& !equalpos(last_cursormoved, curwin->w_cursor)
|
||||
# endif
|
||||
)
|
||||
{
|
||||
# ifdef FEAT_AUTOCMD
|
||||
if (has_cursormoved())
|
||||
@@ -1249,12 +1252,16 @@ main_loop(
|
||||
# ifdef FEAT_CONCEAL
|
||||
if (curwin->w_p_cole > 0)
|
||||
{
|
||||
# ifdef FEAT_AUTOCMD
|
||||
conceal_old_cursor_line = last_cursormoved.lnum;
|
||||
# endif
|
||||
conceal_new_cursor_line = curwin->w_cursor.lnum;
|
||||
conceal_update_lines = TRUE;
|
||||
}
|
||||
# endif
|
||||
# ifdef FEAT_AUTOCMD
|
||||
last_cursormoved = curwin->w_cursor;
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1551,7 +1558,7 @@ getout(int exitval)
|
||||
windgoto((int)Rows - 1, 0);
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_JOB
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
job_stop_on_exit();
|
||||
#endif
|
||||
#ifdef FEAT_LUA
|
||||
|
||||
@@ -3059,6 +3059,11 @@ ml_append_int(
|
||||
(char_u *)"\n", 1);
|
||||
}
|
||||
#endif
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
if (buf->b_write_to_channel)
|
||||
channel_write_new_lines(buf);
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -1127,7 +1127,7 @@ free_all_mem(void)
|
||||
# ifdef FEAT_DIFF
|
||||
diff_clear(curtab);
|
||||
# endif
|
||||
# ifdef FEAT_CHANNEL
|
||||
# ifdef FEAT_JOB_CHANNEL
|
||||
channel_free_all();
|
||||
# endif
|
||||
clear_sb_text(); /* free any scrollback text */
|
||||
@@ -6227,7 +6227,7 @@ has_non_ascii(char_u *s)
|
||||
parse_queued_messages(void)
|
||||
{
|
||||
/* For Win32 mch_breakcheck() does not check for input, do it here. */
|
||||
# if defined(WIN32) && defined(FEAT_CHANNEL)
|
||||
# if defined(WIN32) && defined(FEAT_JOB_CHANNEL)
|
||||
channel_handle_events();
|
||||
# endif
|
||||
|
||||
@@ -6235,7 +6235,7 @@ parse_queued_messages(void)
|
||||
/* Process the queued netbeans messages. */
|
||||
netbeans_parse_messages();
|
||||
# endif
|
||||
# ifdef FEAT_CHANNEL
|
||||
# ifdef FEAT_JOB_CHANNEL
|
||||
/* Process the messages queued on channels. */
|
||||
channel_parse_messages();
|
||||
# endif
|
||||
@@ -6243,7 +6243,7 @@ parse_queued_messages(void)
|
||||
/* Process the queued clientserver messages. */
|
||||
server_parse_messages();
|
||||
# endif
|
||||
# ifdef FEAT_JOB
|
||||
# ifdef FEAT_JOB_CHANNEL
|
||||
/* Check if any jobs have ended. */
|
||||
job_check_ended();
|
||||
# endif
|
||||
|
||||
+12
-5
@@ -9247,13 +9247,20 @@ nv_join(cmdarg_T *cap)
|
||||
cap->count0 = 2; /* default for join is two lines! */
|
||||
if (curwin->w_cursor.lnum + cap->count0 - 1 >
|
||||
curbuf->b_ml.ml_line_count)
|
||||
clearopbeep(cap->oap); /* beyond last line */
|
||||
else
|
||||
{
|
||||
prep_redo(cap->oap->regname, cap->count0,
|
||||
NUL, cap->cmdchar, NUL, NUL, cap->nchar);
|
||||
(void)do_join(cap->count0, cap->nchar == NUL, TRUE, TRUE, TRUE);
|
||||
/* can't join when on the last line */
|
||||
if (cap->count0 <= 2)
|
||||
{
|
||||
clearopbeep(cap->oap);
|
||||
return;
|
||||
}
|
||||
cap->count0 = curbuf->b_ml.ml_line_count
|
||||
- curwin->w_cursor.lnum + 1;
|
||||
}
|
||||
|
||||
prep_redo(cap->oap->regname, cap->count0,
|
||||
NUL, cap->cmdchar, NUL, NUL, cap->nchar);
|
||||
(void)do_join(cap->count0, cap->nchar == NUL, TRUE, TRUE, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -410,7 +410,15 @@ shift_block(oparg_T *oap, int amount)
|
||||
{
|
||||
#ifdef FEAT_MBYTE
|
||||
if (has_mbyte)
|
||||
bd.textstart += (*mb_ptr2len)(bd.textstart);
|
||||
{
|
||||
if ((*mb_ptr2len)(bd.textstart) == 1)
|
||||
++bd.textstart;
|
||||
else
|
||||
{
|
||||
ws_vcol = 0;
|
||||
bd.startspaces = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
++bd.textstart;
|
||||
|
||||
+1
-1
@@ -7385,7 +7385,7 @@ did_set_string_option(
|
||||
if (vim_strchr((char_u *)"_.,", *p) != NULL)
|
||||
break;
|
||||
vim_snprintf((char *)fname, 200, "spell/%.*s.vim", (int)(p - q), q);
|
||||
source_runtime(fname, TRUE);
|
||||
source_runtime(fname, DIP_ALL);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
+3
-1
@@ -890,12 +890,14 @@ static char *(p_toolbar_values[]) = {"text", "icons", "tooltips", "horiz", NULL}
|
||||
EXTERN char_u *p_tbis; /* 'toolbariconsize' */
|
||||
EXTERN unsigned tbis_flags;
|
||||
# ifdef IN_OPTION_C
|
||||
static char *(p_tbis_values[]) = {"tiny", "small", "medium", "large", NULL};
|
||||
static char *(p_tbis_values[]) = {"tiny", "small", "medium", "large", "huge", "giant", NULL};
|
||||
# endif
|
||||
# define TBIS_TINY 0x01
|
||||
# define TBIS_SMALL 0x02
|
||||
# define TBIS_MEDIUM 0x04
|
||||
# define TBIS_LARGE 0x08
|
||||
# define TBIS_HUGE 0x10
|
||||
# define TBIS_GIANT 0x20
|
||||
#endif
|
||||
EXTERN long p_ttyscroll; /* 'ttyscroll' */
|
||||
#if defined(FEAT_MOUSE) && (defined(UNIX) || defined(VMS))
|
||||
|
||||
+4
-4
@@ -144,7 +144,7 @@ extern HWND s_hwnd;
|
||||
static HWND s_hwnd = 0; /* console window handle, set by GetConsoleHwnd() */
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_CHANNEL
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
int WSInitialized = FALSE; /* WinSock is initialized */
|
||||
#endif
|
||||
|
||||
@@ -216,7 +216,7 @@ mch_exit(int r)
|
||||
# ifdef FEAT_OLE
|
||||
UninitOLE();
|
||||
# endif
|
||||
# ifdef FEAT_CHANNEL
|
||||
# ifdef FEAT_JOB_CHANNEL
|
||||
if (WSInitialized)
|
||||
{
|
||||
WSInitialized = FALSE;
|
||||
@@ -950,7 +950,7 @@ mch_icon_load_cb(char_u *fname, void *cookie)
|
||||
mch_icon_load(HANDLE *iconp)
|
||||
{
|
||||
return do_in_runtimepath((char_u *)"bitmaps/vim.ico",
|
||||
FALSE, mch_icon_load_cb, iconp);
|
||||
0, mch_icon_load_cb, iconp);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -3018,7 +3018,7 @@ theend:
|
||||
|
||||
#endif /* defined(FEAT_GUI) || defined(FEAT_PRINTER) */
|
||||
|
||||
#if defined(FEAT_CHANNEL) || defined(PROTO)
|
||||
#if defined(FEAT_JOB_CHANNEL) || defined(PROTO)
|
||||
/*
|
||||
* Initialize the Winsock dll.
|
||||
*/
|
||||
|
||||
+151
-58
@@ -3925,7 +3925,7 @@ wait4pid(pid_t child, waitstatus *status)
|
||||
return wait_pid;
|
||||
}
|
||||
|
||||
#if defined(FEAT_JOB) || !defined(USE_SYSTEM) || defined(PROTO)
|
||||
#if defined(FEAT_JOB_CHANNEL) || !defined(USE_SYSTEM) || defined(PROTO)
|
||||
/*
|
||||
* Parse "cmd" and put the white-separated parts in "argv".
|
||||
* "argv" is an allocated array with "argc" entries.
|
||||
@@ -3990,7 +3990,7 @@ mch_parse_cmd(char_u *cmd, int use_shcf, char ***argv, int *argc)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(USE_SYSTEM) || defined(FEAT_JOB)
|
||||
#if !defined(USE_SYSTEM) || defined(FEAT_JOB_CHANNEL)
|
||||
static void
|
||||
set_child_environment(void)
|
||||
{
|
||||
@@ -5057,34 +5057,92 @@ error:
|
||||
#endif /* USE_SYSTEM */
|
||||
}
|
||||
|
||||
#if defined(FEAT_JOB) || defined(PROTO)
|
||||
#if defined(FEAT_JOB_CHANNEL) || defined(PROTO)
|
||||
void
|
||||
mch_start_job(char **argv, job_T *job, jobopt_T *options)
|
||||
mch_start_job(char **argv, job_T *job, jobopt_T *options UNUSED)
|
||||
{
|
||||
pid_t pid;
|
||||
int fd_in[2]; /* for stdin */
|
||||
int fd_out[2]; /* for stdout */
|
||||
int fd_err[2]; /* for stderr */
|
||||
# ifdef FEAT_CHANNEL
|
||||
channel_T *channel = NULL;
|
||||
#endif
|
||||
int use_null_for_in = options->jo_io[PART_IN] == JIO_NULL;
|
||||
int use_null_for_out = options->jo_io[PART_OUT] == JIO_NULL;
|
||||
int use_null_for_err = options->jo_io[PART_ERR] == JIO_NULL;
|
||||
int use_file_for_in = options->jo_io[PART_IN] == JIO_FILE;
|
||||
int use_file_for_out = options->jo_io[PART_OUT] == JIO_FILE;
|
||||
int use_file_for_err = options->jo_io[PART_ERR] == JIO_FILE;
|
||||
int use_out_for_err = options->jo_io[PART_ERR] == JIO_OUT;
|
||||
|
||||
if (use_out_for_err && use_null_for_out)
|
||||
use_null_for_err = TRUE;
|
||||
|
||||
/* default is to fail */
|
||||
job->jv_status = JOB_FAILED;
|
||||
fd_in[0] = -1;
|
||||
fd_in[1] = -1;
|
||||
fd_out[0] = -1;
|
||||
fd_out[1] = -1;
|
||||
fd_err[0] = -1;
|
||||
fd_err[1] = -1;
|
||||
|
||||
/* TODO: without the channel feature connect the child to /dev/null? */
|
||||
# ifdef FEAT_CHANNEL
|
||||
/* Open pipes for stdin, stdout, stderr. */
|
||||
if ((pipe(fd_in) < 0) || (pipe(fd_out) < 0) ||(pipe(fd_err) < 0))
|
||||
if (use_file_for_in)
|
||||
{
|
||||
char_u *fname = options->jo_io_name[PART_IN];
|
||||
|
||||
fd_in[0] = mch_open((char *)fname, O_RDONLY, 0);
|
||||
if (fd_in[0] < 0)
|
||||
{
|
||||
EMSG2(_(e_notopen), fname);
|
||||
goto failed;
|
||||
}
|
||||
}
|
||||
else if (!use_null_for_in && pipe(fd_in) < 0)
|
||||
goto failed;
|
||||
|
||||
channel = add_channel();
|
||||
if (channel == NULL)
|
||||
if (use_file_for_out)
|
||||
{
|
||||
char_u *fname = options->jo_io_name[PART_OUT];
|
||||
|
||||
fd_out[1] = mch_open((char *)fname, O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
if (fd_out[1] < 0)
|
||||
{
|
||||
EMSG2(_(e_notopen), fname);
|
||||
goto failed;
|
||||
}
|
||||
}
|
||||
else if (!use_null_for_out && pipe(fd_out) < 0)
|
||||
goto failed;
|
||||
# endif
|
||||
|
||||
if (use_file_for_err)
|
||||
{
|
||||
char_u *fname = options->jo_io_name[PART_ERR];
|
||||
|
||||
fd_err[1] = mch_open((char *)fname, O_WRONLY | O_CREAT | O_TRUNC, 0600);
|
||||
if (fd_err[1] < 0)
|
||||
{
|
||||
EMSG2(_(e_notopen), fname);
|
||||
goto failed;
|
||||
}
|
||||
}
|
||||
else if (!use_out_for_err && !use_null_for_err && pipe(fd_err) < 0)
|
||||
goto failed;
|
||||
|
||||
if (!use_null_for_in || !use_null_for_out || !use_null_for_err)
|
||||
{
|
||||
if (options->jo_set & JO_CHANNEL)
|
||||
{
|
||||
channel = options->jo_channel;
|
||||
if (channel != NULL)
|
||||
++channel->ch_refcount;
|
||||
}
|
||||
else
|
||||
channel = add_channel();
|
||||
if (channel == NULL)
|
||||
goto failed;
|
||||
}
|
||||
|
||||
pid = fork(); /* maybe we should use vfork() */
|
||||
if (pid == -1)
|
||||
@@ -5095,6 +5153,8 @@ mch_start_job(char **argv, job_T *job, jobopt_T *options)
|
||||
|
||||
if (pid == 0)
|
||||
{
|
||||
int null_fd = -1;
|
||||
|
||||
/* child */
|
||||
reset_signals(); /* handle signals normally */
|
||||
|
||||
@@ -5107,26 +5167,60 @@ mch_start_job(char **argv, job_T *job, jobopt_T *options)
|
||||
|
||||
set_child_environment();
|
||||
|
||||
/* TODO: re-enable this when pipes connect without a channel */
|
||||
# ifdef FEAT_CHANNEL
|
||||
/* set up stdin for the child */
|
||||
close(fd_in[1]);
|
||||
close(0);
|
||||
ignored = dup(fd_in[0]);
|
||||
close(fd_in[0]);
|
||||
if (use_null_for_in || use_null_for_out || use_null_for_err)
|
||||
null_fd = open("/dev/null", O_RDWR | O_EXTRA, 0);
|
||||
|
||||
/* set up stdout for the child */
|
||||
close(fd_out[0]);
|
||||
close(1);
|
||||
ignored = dup(fd_out[1]);
|
||||
close(fd_out[1]);
|
||||
/* set up stdin for the child */
|
||||
if (use_null_for_in)
|
||||
{
|
||||
close(0);
|
||||
ignored = dup(null_fd);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!use_file_for_in)
|
||||
close(fd_in[1]);
|
||||
close(0);
|
||||
ignored = dup(fd_in[0]);
|
||||
close(fd_in[0]);
|
||||
}
|
||||
|
||||
/* set up stderr for the child */
|
||||
close(fd_err[0]);
|
||||
close(2);
|
||||
ignored = dup(fd_err[1]);
|
||||
close(fd_err[1]);
|
||||
# endif
|
||||
if (use_null_for_err)
|
||||
{
|
||||
close(2);
|
||||
ignored = dup(null_fd);
|
||||
}
|
||||
else if (use_out_for_err)
|
||||
{
|
||||
close(2);
|
||||
ignored = dup(fd_out[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!use_file_for_err)
|
||||
close(fd_err[0]);
|
||||
close(2);
|
||||
ignored = dup(fd_err[1]);
|
||||
close(fd_err[1]);
|
||||
}
|
||||
|
||||
/* set up stdout for the child */
|
||||
if (use_null_for_out)
|
||||
{
|
||||
close(0);
|
||||
ignored = dup(null_fd);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!use_file_for_out)
|
||||
close(fd_out[0]);
|
||||
close(1);
|
||||
ignored = dup(fd_out[1]);
|
||||
close(fd_out[1]);
|
||||
}
|
||||
if (null_fd >= 0)
|
||||
close(null_fd);
|
||||
|
||||
/* See above for type of argv. */
|
||||
execvp(argv[0], argv);
|
||||
@@ -5138,45 +5232,44 @@ mch_start_job(char **argv, job_T *job, jobopt_T *options)
|
||||
/* parent */
|
||||
job->jv_pid = pid;
|
||||
job->jv_status = JOB_STARTED;
|
||||
# ifdef FEAT_CHANNEL
|
||||
job->jv_channel = channel;
|
||||
# endif
|
||||
job->jv_channel = channel; /* ch_refcount was set above */
|
||||
|
||||
/* child stdin, stdout and stderr */
|
||||
close(fd_in[0]);
|
||||
close(fd_out[1]);
|
||||
close(fd_err[1]);
|
||||
# ifdef FEAT_CHANNEL
|
||||
channel_set_pipes(channel, fd_in[1], fd_out[0], fd_err[0]);
|
||||
channel_set_job(channel, job);
|
||||
channel_set_options(channel, options);
|
||||
# ifdef FEAT_GUI
|
||||
channel_gui_register(channel);
|
||||
# endif
|
||||
# endif
|
||||
if (!use_file_for_in)
|
||||
close(fd_in[0]);
|
||||
if (!use_file_for_out)
|
||||
close(fd_out[1]);
|
||||
if (!use_out_for_err && !use_file_for_err)
|
||||
close(fd_err[1]);
|
||||
if (channel != NULL)
|
||||
{
|
||||
channel_set_pipes(channel,
|
||||
use_file_for_in || use_null_for_in
|
||||
? INVALID_FD : fd_in[1],
|
||||
use_file_for_out || use_null_for_out
|
||||
? INVALID_FD : fd_out[0],
|
||||
use_out_for_err || use_file_for_err || use_null_for_err
|
||||
? INVALID_FD : fd_err[0]);
|
||||
channel_set_job(channel, job, options);
|
||||
}
|
||||
|
||||
/* success! */
|
||||
return;
|
||||
|
||||
failed:
|
||||
# ifdef FEAT_CHANNEL
|
||||
if (channel != NULL)
|
||||
channel_free(channel);
|
||||
# endif
|
||||
channel_unref(channel);
|
||||
if (fd_in[0] >= 0)
|
||||
{
|
||||
close(fd_in[0]);
|
||||
if (fd_in[1] >= 0)
|
||||
close(fd_in[1]);
|
||||
}
|
||||
if (fd_out[0] >= 0)
|
||||
{
|
||||
close(fd_out[0]);
|
||||
if (fd_out[1] >= 0)
|
||||
close(fd_out[1]);
|
||||
}
|
||||
if (fd_err[0] >= 0)
|
||||
{
|
||||
close(fd_err[0]);
|
||||
if (fd_err[1] >= 0)
|
||||
close(fd_err[1]);
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
@@ -5257,9 +5350,9 @@ mch_clear_job(job_T *job)
|
||||
{
|
||||
/* call waitpid because child process may become zombie */
|
||||
# ifdef __NeXT__
|
||||
wait4(job->jv_pid, NULL, WNOHANG, (struct rusage *)0);
|
||||
(void)wait4(job->jv_pid, NULL, WNOHANG, (struct rusage *)0);
|
||||
# else
|
||||
waitpid(job->jv_pid, NULL, WNOHANG);
|
||||
(void)waitpid(job->jv_pid, NULL, WNOHANG);
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
@@ -5476,7 +5569,7 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED)
|
||||
nfd++;
|
||||
}
|
||||
# endif
|
||||
#ifdef FEAT_CHANNEL
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
nfd = channel_poll_setup(nfd, &fds);
|
||||
#endif
|
||||
|
||||
@@ -5524,7 +5617,7 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED)
|
||||
finished = FALSE; /* Try again */
|
||||
}
|
||||
# endif
|
||||
#ifdef FEAT_CHANNEL
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
if (ret > 0)
|
||||
ret = channel_poll_check(ret, &fds);
|
||||
#endif
|
||||
@@ -5606,7 +5699,7 @@ select_eintr:
|
||||
maxfd = xsmp_icefd;
|
||||
}
|
||||
# endif
|
||||
# ifdef FEAT_CHANNEL
|
||||
# ifdef FEAT_JOB_CHANNEL
|
||||
maxfd = channel_select_setup(maxfd, &rfds);
|
||||
# endif
|
||||
|
||||
@@ -5688,7 +5781,7 @@ select_eintr:
|
||||
}
|
||||
}
|
||||
# endif
|
||||
#ifdef FEAT_CHANNEL
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
if (ret > 0)
|
||||
ret = channel_select_check(ret, &rfds);
|
||||
#endif
|
||||
|
||||
+138
-37
@@ -1492,7 +1492,7 @@ WaitForChar(long msec)
|
||||
{
|
||||
DWORD dwWaitTime = dwEndTime - dwNow;
|
||||
|
||||
#ifdef FEAT_CHANNEL
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
/* Check channel while waiting input. */
|
||||
if (dwWaitTime > 100)
|
||||
dwWaitTime = 100;
|
||||
@@ -4991,19 +4991,64 @@ mch_call_shell(
|
||||
return x;
|
||||
}
|
||||
|
||||
#if defined(FEAT_JOB) || defined(PROTO)
|
||||
#if defined(FEAT_JOB_CHANNEL) || defined(PROTO)
|
||||
static HANDLE
|
||||
job_io_file_open(
|
||||
char_u *fname,
|
||||
DWORD dwDesiredAccess,
|
||||
DWORD dwShareMode,
|
||||
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
|
||||
DWORD dwCreationDisposition,
|
||||
DWORD dwFlagsAndAttributes)
|
||||
{
|
||||
HANDLE h;
|
||||
# ifdef FEAT_MBYTE
|
||||
WCHAR *wn = NULL;
|
||||
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
|
||||
{
|
||||
wn = enc_to_utf16(fname, NULL);
|
||||
if (wn != NULL)
|
||||
{
|
||||
h = CreateFileW(wn, dwDesiredAccess, dwShareMode,
|
||||
lpSecurityAttributes, dwCreationDisposition,
|
||||
dwFlagsAndAttributes, NULL);
|
||||
vim_free(wn);
|
||||
if (h == INVALID_HANDLE_VALUE
|
||||
&& GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
|
||||
wn = NULL;
|
||||
}
|
||||
}
|
||||
if (wn == NULL)
|
||||
# endif
|
||||
|
||||
h = CreateFile((LPCSTR)fname, dwDesiredAccess, dwShareMode,
|
||||
lpSecurityAttributes, dwCreationDisposition,
|
||||
dwFlagsAndAttributes, NULL);
|
||||
return h;
|
||||
}
|
||||
|
||||
void
|
||||
mch_start_job(char *cmd, job_T *job, jobopt_T *options)
|
||||
{
|
||||
STARTUPINFO si;
|
||||
PROCESS_INFORMATION pi;
|
||||
HANDLE jo;
|
||||
# ifdef FEAT_CHANNEL
|
||||
channel_T *channel;
|
||||
SECURITY_ATTRIBUTES saAttr;
|
||||
channel_T *channel = NULL;
|
||||
HANDLE ifd[2];
|
||||
HANDLE ofd[2];
|
||||
HANDLE efd[2];
|
||||
SECURITY_ATTRIBUTES saAttr;
|
||||
|
||||
int use_null_for_in = options->jo_io[PART_IN] == JIO_NULL;
|
||||
int use_null_for_out = options->jo_io[PART_OUT] == JIO_NULL;
|
||||
int use_null_for_err = options->jo_io[PART_ERR] == JIO_NULL;
|
||||
int use_file_for_in = options->jo_io[PART_IN] == JIO_FILE;
|
||||
int use_file_for_out = options->jo_io[PART_OUT] == JIO_FILE;
|
||||
int use_file_for_err = options->jo_io[PART_ERR] == JIO_FILE;
|
||||
int use_out_for_err = options->jo_io[PART_ERR] == JIO_OUT;
|
||||
|
||||
if (use_out_for_err && use_null_for_out)
|
||||
use_null_for_err = TRUE;
|
||||
|
||||
ifd[0] = INVALID_HANDLE_VALUE;
|
||||
ifd[1] = INVALID_HANDLE_VALUE;
|
||||
@@ -5012,11 +5057,6 @@ mch_start_job(char *cmd, job_T *job, jobopt_T *options)
|
||||
efd[0] = INVALID_HANDLE_VALUE;
|
||||
efd[1] = INVALID_HANDLE_VALUE;
|
||||
|
||||
channel = add_channel();
|
||||
if (channel == NULL)
|
||||
return;
|
||||
# endif
|
||||
|
||||
jo = CreateJobObject(NULL, NULL);
|
||||
if (jo == NULL)
|
||||
{
|
||||
@@ -5030,22 +5070,82 @@ mch_start_job(char *cmd, job_T *job, jobopt_T *options)
|
||||
si.dwFlags |= STARTF_USESHOWWINDOW;
|
||||
si.wShowWindow = SW_HIDE;
|
||||
|
||||
# ifdef FEAT_CHANNEL
|
||||
saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
|
||||
saAttr.bInheritHandle = TRUE;
|
||||
saAttr.lpSecurityDescriptor = NULL;
|
||||
if (!CreatePipe(&ifd[0], &ifd[1], &saAttr, 0)
|
||||
|| !pSetHandleInformation(ifd[1], HANDLE_FLAG_INHERIT, 0)
|
||||
|| !CreatePipe(&ofd[0], &ofd[1], &saAttr, 0)
|
||||
|| !pSetHandleInformation(ofd[0], HANDLE_FLAG_INHERIT, 0)
|
||||
|| !CreatePipe(&efd[0], &efd[1], &saAttr, 0)
|
||||
|| !pSetHandleInformation(efd[0], HANDLE_FLAG_INHERIT, 0))
|
||||
|
||||
if (use_file_for_in)
|
||||
{
|
||||
char_u *fname = options->jo_io_name[PART_IN];
|
||||
|
||||
ifd[0] = job_io_file_open(fname, GENERIC_READ,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
&saAttr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL);
|
||||
if (ifd[0] == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
EMSG2(_(e_notopen), fname);
|
||||
goto failed;
|
||||
}
|
||||
}
|
||||
else if (!use_null_for_in &&
|
||||
(!CreatePipe(&ifd[0], &ifd[1], &saAttr, 0)
|
||||
|| !pSetHandleInformation(ifd[1], HANDLE_FLAG_INHERIT, 0)))
|
||||
goto failed;
|
||||
|
||||
if (use_file_for_out)
|
||||
{
|
||||
char_u *fname = options->jo_io_name[PART_OUT];
|
||||
|
||||
ofd[1] = job_io_file_open(fname, GENERIC_WRITE,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
&saAttr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL);
|
||||
if (ofd[1] == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
EMSG2(_(e_notopen), fname);
|
||||
goto failed;
|
||||
}
|
||||
}
|
||||
else if (!use_null_for_out &&
|
||||
(!CreatePipe(&ofd[0], &ofd[1], &saAttr, 0)
|
||||
|| !pSetHandleInformation(ofd[0], HANDLE_FLAG_INHERIT, 0)))
|
||||
goto failed;
|
||||
|
||||
if (use_file_for_err)
|
||||
{
|
||||
char_u *fname = options->jo_io_name[PART_ERR];
|
||||
|
||||
efd[1] = job_io_file_open(fname, GENERIC_WRITE,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
&saAttr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL);
|
||||
if (efd[1] == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
EMSG2(_(e_notopen), fname);
|
||||
goto failed;
|
||||
}
|
||||
}
|
||||
else if (!use_out_for_err && !use_null_for_err &&
|
||||
(!CreatePipe(&efd[0], &efd[1], &saAttr, 0)
|
||||
|| !pSetHandleInformation(efd[0], HANDLE_FLAG_INHERIT, 0)))
|
||||
goto failed;
|
||||
|
||||
si.dwFlags |= STARTF_USESTDHANDLES;
|
||||
si.hStdInput = ifd[0];
|
||||
si.hStdOutput = ofd[1];
|
||||
si.hStdError = efd[1];
|
||||
# endif
|
||||
si.hStdError = use_out_for_err ? ofd[1] : efd[1];
|
||||
|
||||
if (!use_null_for_in || !use_null_for_out || !use_null_for_err)
|
||||
{
|
||||
if (options->jo_set & JO_CHANNEL)
|
||||
{
|
||||
channel = options->jo_channel;
|
||||
if (channel != NULL)
|
||||
++channel->ch_refcount;
|
||||
}
|
||||
else
|
||||
channel = add_channel();
|
||||
if (channel == NULL)
|
||||
goto failed;
|
||||
}
|
||||
|
||||
if (!vim_create_process(cmd, TRUE,
|
||||
CREATE_SUSPENDED |
|
||||
@@ -5067,39 +5167,40 @@ mch_start_job(char *cmd, job_T *job, jobopt_T *options)
|
||||
jo = NULL;
|
||||
}
|
||||
ResumeThread(pi.hThread);
|
||||
CloseHandle(job->jv_proc_info.hThread);
|
||||
CloseHandle(pi.hThread);
|
||||
job->jv_proc_info = pi;
|
||||
job->jv_job_object = jo;
|
||||
job->jv_status = JOB_STARTED;
|
||||
|
||||
# ifdef FEAT_CHANNEL
|
||||
CloseHandle(ifd[0]);
|
||||
CloseHandle(ofd[1]);
|
||||
CloseHandle(efd[1]);
|
||||
if (!use_file_for_in)
|
||||
CloseHandle(ifd[0]);
|
||||
if (!use_file_for_out)
|
||||
CloseHandle(ofd[1]);
|
||||
if (!use_out_for_err && !use_file_for_err)
|
||||
CloseHandle(efd[1]);
|
||||
|
||||
job->jv_channel = channel;
|
||||
channel_set_pipes(channel, (sock_T)ifd[1], (sock_T)ofd[0], (sock_T)efd[0]);
|
||||
channel_set_job(channel, job);
|
||||
channel_set_options(channel, options);
|
||||
|
||||
# ifdef FEAT_GUI
|
||||
channel_gui_register(channel);
|
||||
# endif
|
||||
# endif
|
||||
if (channel != NULL)
|
||||
{
|
||||
channel_set_pipes(channel,
|
||||
use_file_for_in || use_null_for_in
|
||||
? INVALID_FD : (sock_T)ifd[1],
|
||||
use_file_for_out || use_null_for_out
|
||||
? INVALID_FD : (sock_T)ofd[0],
|
||||
use_out_for_err || use_file_for_err || use_null_for_err
|
||||
? INVALID_FD : (sock_T)efd[0]);
|
||||
channel_set_job(channel, job, options);
|
||||
}
|
||||
return;
|
||||
|
||||
failed:
|
||||
# ifdef FEAT_CHANNEL
|
||||
CloseHandle(ifd[0]);
|
||||
CloseHandle(ofd[0]);
|
||||
CloseHandle(efd[0]);
|
||||
CloseHandle(ifd[1]);
|
||||
CloseHandle(ofd[1]);
|
||||
CloseHandle(efd[1]);
|
||||
channel_free(channel);
|
||||
# else
|
||||
; /* make compiler happy */
|
||||
# endif
|
||||
channel_unref(channel);
|
||||
}
|
||||
|
||||
char *
|
||||
|
||||
+1
-1
@@ -193,7 +193,7 @@ void qsort(void *base, size_t elm_count, size_t elm_size, int (*cmp)(const void
|
||||
# ifdef FEAT_NETBEANS_INTG
|
||||
# include "netbeans.pro"
|
||||
# endif
|
||||
# ifdef FEAT_CHANNEL
|
||||
# ifdef FEAT_JOB_CHANNEL
|
||||
# include "channel.pro"
|
||||
# endif
|
||||
|
||||
|
||||
+21
-4
@@ -1,18 +1,20 @@
|
||||
/* channel.c */
|
||||
void ch_logfile(FILE *file);
|
||||
void ch_logfile(char_u *fname, char_u *opt);
|
||||
int ch_log_active(void);
|
||||
void ch_log(channel_T *ch, char *msg);
|
||||
void ch_logs(channel_T *ch, char *msg, char *name);
|
||||
channel_T *add_channel(void);
|
||||
int channel_may_free(channel_T *channel);
|
||||
int channel_unref(channel_T *channel);
|
||||
void channel_free(channel_T *channel);
|
||||
void channel_gui_register(channel_T *channel);
|
||||
void channel_gui_register_all(void);
|
||||
channel_T *channel_open(char *hostname, int port_in, int waittime, void (*nb_close_cb)(void));
|
||||
channel_T *channel_open_func(typval_T *argvars);
|
||||
void channel_set_pipes(channel_T *channel, sock_T in, sock_T out, sock_T err);
|
||||
void channel_set_job(channel_T *channel, job_T *job);
|
||||
void channel_set_job(channel_T *channel, job_T *job, jobopt_T *options);
|
||||
void channel_set_options(channel_T *channel, jobopt_T *opt);
|
||||
void channel_set_req_callback(channel_T *channel, int part, char_u *callback, int id);
|
||||
void channel_write_in(channel_T *channel);
|
||||
void channel_write_new_lines(buf_T *buf);
|
||||
char_u *channel_get(channel_T *channel, int part);
|
||||
int channel_collapse(channel_T *channel, int part);
|
||||
int channel_can_write_to(channel_T *channel);
|
||||
@@ -26,9 +28,13 @@ int channel_get_id(void);
|
||||
void channel_read(channel_T *channel, int part, char *func);
|
||||
char_u *channel_read_block(channel_T *channel, int part, int timeout);
|
||||
int channel_read_json_block(channel_T *channel, int part, int timeout, int id, typval_T **rettv);
|
||||
void common_channel_read(typval_T *argvars, typval_T *rettv, int raw);
|
||||
channel_T *channel_fd2channel(sock_T fd, int *partp);
|
||||
void channel_handle_events(void);
|
||||
int channel_send(channel_T *channel, int part, char_u *buf, char *fun);
|
||||
channel_T *send_common(typval_T *argvars, char_u *text, int id, int eval, jobopt_T *opt, char *fun, int *part_read);
|
||||
void ch_expr_common(typval_T *argvars, typval_T *rettv, int eval);
|
||||
void ch_raw_common(typval_T *argvars, typval_T *rettv, int eval);
|
||||
int channel_poll_setup(int nfd_in, void *fds_in);
|
||||
int channel_poll_check(int ret_in, void *fds_in);
|
||||
int channel_select_setup(int maxfd_in, void *rfds_in);
|
||||
@@ -39,4 +45,15 @@ int channel_part_send(channel_T *channel);
|
||||
int channel_part_read(channel_T *channel);
|
||||
ch_mode_T channel_get_mode(channel_T *channel, int part);
|
||||
int channel_get_timeout(channel_T *channel, int part);
|
||||
void clear_job_options(jobopt_T *opt);
|
||||
int get_job_options(typval_T *tv, jobopt_T *opt, int supported);
|
||||
channel_T *get_channel_arg(typval_T *tv, int check_open);
|
||||
void job_unref(job_T *job);
|
||||
void job_set_options(job_T *job, jobopt_T *opt);
|
||||
void job_stop_on_exit(void);
|
||||
void job_check_ended(void);
|
||||
job_T *job_start(typval_T *argvars);
|
||||
char *job_status(job_T *job);
|
||||
void job_info(job_T *job, dict_T *dict);
|
||||
int job_stop(job_T *job, typval_T *argvars);
|
||||
/* vim: set ft=c : */
|
||||
|
||||
+4
-3
@@ -79,15 +79,13 @@ int dict_add_list(dict_T *d, char *key, list_T *list);
|
||||
dictitem_T *dict_find(dict_T *d, char_u *key, int len);
|
||||
char_u *get_dict_string(dict_T *d, char_u *key, int save);
|
||||
long get_dict_number(dict_T *d, char_u *key);
|
||||
int channel_unref(channel_T *channel);
|
||||
void job_stop_on_exit(void);
|
||||
int string2float(char_u *text, float_T *value);
|
||||
char_u *get_function_name(expand_T *xp, int idx);
|
||||
char_u *get_expr_name(expand_T *xp, int idx);
|
||||
int call_func(char_u *funcname, int len, typval_T *rettv, int argcount, typval_T *argvars, linenr_T firstline, linenr_T lastline, int *doesrange, int evaluate, dict_T *selfdict);
|
||||
buf_T *buflist_find_by_name(char_u *name, int curtab_only);
|
||||
int func_call(char_u *name, typval_T *args, dict_T *selfdict, typval_T *rettv);
|
||||
void dict_extend(dict_T *d1, dict_T *d2, char_u *action);
|
||||
void job_check_ended(void);
|
||||
void mzscheme_call_vim(char_u *name, typval_T *args, typval_T *rettv);
|
||||
float_T vim_round(float_T f);
|
||||
long do_searchpair(char_u *spat, char_u *mpat, char_u *epat, int dir, char_u *skip, int flags, pos_T *match_pos, linenr_T lnum_stop, long time_limit);
|
||||
@@ -107,7 +105,10 @@ char_u *set_cmdarg(exarg_T *eap, char_u *oldarg);
|
||||
typval_T *alloc_tv(void);
|
||||
void free_tv(typval_T *varp);
|
||||
void clear_tv(typval_T *varp);
|
||||
long get_tv_number(typval_T *varp);
|
||||
long get_tv_number_chk(typval_T *varp, int *denote);
|
||||
char_u *get_tv_string(typval_T *varp);
|
||||
char_u *get_tv_string_buf(typval_T *varp, char_u *buf);
|
||||
char_u *get_tv_string_chk(typval_T *varp);
|
||||
char_u *get_tv_string_buf_chk(typval_T *varp, char_u *buf);
|
||||
char_u *get_var_value(char_u *name);
|
||||
|
||||
@@ -61,9 +61,10 @@ void ex_listdo(exarg_T *eap);
|
||||
void ex_compiler(exarg_T *eap);
|
||||
void ex_runtime(exarg_T *eap);
|
||||
int source_runtime(char_u *name, int all);
|
||||
int do_in_path(char_u *path, char_u *name, int flags, void (*callback)(char_u *fname, void *ck), void *cookie);
|
||||
int do_in_runtimepath(char_u *name, int all, void (*callback)(char_u *fname, void *ck), void *cookie);
|
||||
void source_packages(void);
|
||||
void ex_loadplugin(exarg_T *eap);
|
||||
void ex_packloadall(exarg_T *eap);
|
||||
void ex_packadd(exarg_T *eap);
|
||||
void ex_options(exarg_T *eap);
|
||||
void ex_source(exarg_T *eap);
|
||||
linenr_T *source_breakpoint(void *cookie);
|
||||
|
||||
+3
-3
@@ -2478,7 +2478,7 @@ spell_load_lang(char_u *lang)
|
||||
"spell/%s.%s.spl",
|
||||
#endif
|
||||
lang, spell_enc());
|
||||
r = do_in_runtimepath(fname_enc, FALSE, spell_load_cb, &sl);
|
||||
r = do_in_runtimepath(fname_enc, 0, spell_load_cb, &sl);
|
||||
|
||||
if (r == FAIL && *sl.sl_lang != NUL)
|
||||
{
|
||||
@@ -2490,7 +2490,7 @@ spell_load_lang(char_u *lang)
|
||||
"spell/%s.ascii.spl",
|
||||
#endif
|
||||
lang);
|
||||
r = do_in_runtimepath(fname_enc, FALSE, spell_load_cb, &sl);
|
||||
r = do_in_runtimepath(fname_enc, 0, spell_load_cb, &sl);
|
||||
|
||||
#ifdef FEAT_AUTOCMD
|
||||
if (r == FAIL && *sl.sl_lang != NUL && round == 1
|
||||
@@ -2519,7 +2519,7 @@ spell_load_lang(char_u *lang)
|
||||
{
|
||||
/* At least one file was loaded, now load ALL the additions. */
|
||||
STRCPY(fname_enc + STRLEN(fname_enc) - 3, "add.spl");
|
||||
do_in_runtimepath(fname_enc, TRUE, spell_load_cb, &sl);
|
||||
do_in_runtimepath(fname_enc, DIP_ALL, spell_load_cb, &sl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+24
-7
@@ -1147,10 +1147,8 @@ typedef struct
|
||||
char_u *v_string; /* string value (can be NULL!) */
|
||||
list_T *v_list; /* list value (can be NULL!) */
|
||||
dict_T *v_dict; /* dict value (can be NULL!) */
|
||||
#ifdef FEAT_JOB
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
job_T *v_job; /* job value (can be NULL!) */
|
||||
#endif
|
||||
#ifdef FEAT_CHANNEL
|
||||
channel_T *v_channel; /* channel value (can be NULL!) */
|
||||
#endif
|
||||
} vval;
|
||||
@@ -1267,6 +1265,8 @@ struct jobvar_S
|
||||
int jv_exitval;
|
||||
char_u *jv_exit_cb; /* allocated */
|
||||
|
||||
buf_T *jv_in_buf; /* buffer from "in-name" */
|
||||
|
||||
int jv_refcount; /* reference count */
|
||||
channel_T *jv_channel; /* channel for I/O, reference counted */
|
||||
};
|
||||
@@ -1310,8 +1310,7 @@ typedef enum
|
||||
#define PART_SOCK 0
|
||||
#define CH_SOCK_FD ch_part[PART_SOCK].ch_fd
|
||||
|
||||
#if defined(UNIX) || defined(WIN32)
|
||||
# define CHANNEL_PIPES
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
# define INVALID_FD (-1)
|
||||
|
||||
# define PART_OUT 1
|
||||
@@ -1350,7 +1349,10 @@ typedef struct {
|
||||
|
||||
cbq_T ch_cb_head; /* dummy node for per-request callbacks */
|
||||
char_u *ch_callback; /* call when a msg is not handled */
|
||||
|
||||
buf_T *ch_buffer; /* buffer to read from or write to */
|
||||
linenr_T ch_buf_top; /* next line to send */
|
||||
linenr_T ch_buf_bot; /* last line to send */
|
||||
} chanpart_T;
|
||||
|
||||
struct channel_S {
|
||||
@@ -1405,7 +1407,13 @@ struct channel_S {
|
||||
#define JO_OUT_NAME 0x80000 /* "out-name" */
|
||||
#define JO_ERR_NAME 0x100000 /* "err-name" (JO_OUT_NAME << 1) */
|
||||
#define JO_IN_NAME 0x200000 /* "in-name" (JO_OUT_NAME << 2) */
|
||||
#define JO_ALL 0xffffff
|
||||
#define JO_IN_TOP 0x400000 /* "in-top" */
|
||||
#define JO_IN_BOT 0x800000 /* "in-bot" */
|
||||
#define JO_OUT_BUF 0x1000000 /* "out-buf" */
|
||||
#define JO_ERR_BUF 0x2000000 /* "err-buf" (JO_OUT_BUF << 1) */
|
||||
#define JO_IN_BUF 0x4000000 /* "in-buf" (JO_OUT_BUF << 2) */
|
||||
#define JO_CHANNEL 0x8000000 /* "channel" */
|
||||
#define JO_ALL 0xfffffff
|
||||
|
||||
#define JO_MODE_ALL (JO_MODE + JO_IN_MODE + JO_OUT_MODE + JO_ERR_MODE)
|
||||
#define JO_CB_ALL \
|
||||
@@ -1413,8 +1421,8 @@ struct channel_S {
|
||||
#define JO_TIMEOUT_ALL (JO_TIMEOUT + JO_OUT_TIMEOUT + JO_ERR_TIMEOUT)
|
||||
|
||||
typedef enum {
|
||||
JIO_PIPE, /* default */
|
||||
JIO_NULL,
|
||||
JIO_PIPE,
|
||||
JIO_FILE,
|
||||
JIO_BUFFER,
|
||||
JIO_OUT
|
||||
@@ -1435,6 +1443,11 @@ typedef struct
|
||||
job_io_T jo_io[4]; /* PART_OUT, PART_ERR, PART_IN */
|
||||
char_u jo_io_name_buf[4][NUMBUFLEN];
|
||||
char_u *jo_io_name[4]; /* not allocated! */
|
||||
int jo_io_buf[4];
|
||||
channel_T *jo_channel;
|
||||
|
||||
linenr_T jo_in_top;
|
||||
linenr_T jo_in_bot;
|
||||
|
||||
char_u *jo_callback; /* not allocated! */
|
||||
char_u *jo_out_cb; /* not allocated! */
|
||||
@@ -2047,6 +2060,10 @@ struct file_buffer
|
||||
int b_netbeans_file; /* TRUE when buffer is owned by NetBeans */
|
||||
int b_was_netbeans_file;/* TRUE if b_netbeans_file was once set */
|
||||
#endif
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
int b_write_to_channel; /* TRUE when appended lines are written to
|
||||
* a channel. */
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_ODB_EDITOR
|
||||
uint32_t b_odb_server_id; /* FourCC of the ODB server (0 if none) */
|
||||
|
||||
+7
-3
@@ -4813,7 +4813,7 @@ syn_cmd_include(exarg_T *eap, int syncing UNUSED)
|
||||
prev_toplvl_grp = curwin->w_s->b_syn_topgrp;
|
||||
curwin->w_s->b_syn_topgrp = sgl_id;
|
||||
if (source ? do_source(eap->arg, FALSE, DOSO_NONE) == FAIL
|
||||
: source_runtime(eap->arg, TRUE) == FAIL)
|
||||
: source_runtime(eap->arg, DIP_ALL) == FAIL)
|
||||
EMSG2(_(e_notopen), eap->arg);
|
||||
curwin->w_s->b_syn_topgrp = prev_toplvl_grp;
|
||||
current_syn_inc_tag = prev_syn_inc_tag;
|
||||
@@ -6342,9 +6342,11 @@ ex_ownsyntax(exarg_T *eap)
|
||||
if (old_value != NULL)
|
||||
old_value = vim_strsave(old_value);
|
||||
|
||||
#ifdef FEAT_AUTOCMD
|
||||
/* Apply the "syntax" autocommand event, this finds and loads the syntax
|
||||
* file. */
|
||||
apply_autocmds(EVENT_SYNTAX, eap->arg, curbuf->b_fname, TRUE, curbuf);
|
||||
#endif
|
||||
|
||||
/* move value of b:current_syntax to w:current_syntax */
|
||||
new_value = get_var_value((char_u *)"b:current_syntax");
|
||||
@@ -7073,7 +7075,7 @@ init_highlight(
|
||||
else
|
||||
{
|
||||
++recursive;
|
||||
(void)source_runtime((char_u *)"syntax/syncolor.vim", TRUE);
|
||||
(void)source_runtime((char_u *)"syntax/syncolor.vim", DIP_ALL);
|
||||
--recursive;
|
||||
}
|
||||
}
|
||||
@@ -7102,7 +7104,7 @@ load_colors(char_u *name)
|
||||
if (buf != NULL)
|
||||
{
|
||||
sprintf((char *)buf, "colors/%s.vim", name);
|
||||
retval = source_runtime(buf, FALSE);
|
||||
retval = source_runtime(buf, DIP_START + DIP_OPT);
|
||||
vim_free(buf);
|
||||
#ifdef FEAT_AUTOCMD
|
||||
apply_autocmds(EVENT_COLORSCHEME, name, curbuf->b_fname, FALSE, curbuf);
|
||||
@@ -8998,6 +9000,8 @@ highlight_color(
|
||||
n = HL_TABLE()[id - 1].sg_cterm_fg - 1;
|
||||
else
|
||||
n = HL_TABLE()[id - 1].sg_cterm_bg - 1;
|
||||
if (n < 0)
|
||||
return NULL;
|
||||
sprintf((char *)name, "%d", n);
|
||||
return name;
|
||||
}
|
||||
|
||||
@@ -2638,7 +2638,7 @@ get_tagfname(
|
||||
#else
|
||||
"doc/tags"
|
||||
#endif
|
||||
, TRUE, found_tagfile_cb, NULL);
|
||||
, DIP_ALL, found_tagfile_cb, NULL);
|
||||
}
|
||||
|
||||
if (tnp->tn_hf_idx >= tag_fnames.ga_len)
|
||||
|
||||
@@ -175,14 +175,17 @@ NEW_TESTS = test_arglist.res \
|
||||
test_cdo.res \
|
||||
test_channel.res \
|
||||
test_hardcopy.res \
|
||||
test_history.res \
|
||||
test_increment.res \
|
||||
test_json.res \
|
||||
test_langmap.res \
|
||||
test_packadd.res \
|
||||
test_perl.res \
|
||||
test_quickfix.res \
|
||||
test_syntax.res \
|
||||
test_viminfo.res \
|
||||
test_viml.res \
|
||||
test_visual.res \
|
||||
test_alot.res
|
||||
|
||||
|
||||
|
||||
+27
-14
@@ -72,6 +72,24 @@ function GetAllocId(name)
|
||||
return lnum - top - 1
|
||||
endfunc
|
||||
|
||||
function RunTheTest(test)
|
||||
echo 'Executing ' . a:test
|
||||
if exists("*SetUp")
|
||||
call SetUp()
|
||||
endif
|
||||
|
||||
call add(s:messages, 'Executing ' . a:test)
|
||||
let s:done += 1
|
||||
try
|
||||
exe 'call ' . a:test
|
||||
catch
|
||||
call add(v:errors, 'Caught exception in ' . a:test . ': ' . v:exception . ' @ ' . v:throwpoint)
|
||||
endtry
|
||||
|
||||
if exists("*TearDown")
|
||||
call TearDown()
|
||||
endif
|
||||
endfunc
|
||||
|
||||
" Source the test script. First grab the file name, in case the script
|
||||
" navigates away. g:testname can be used by the tests.
|
||||
@@ -92,6 +110,9 @@ else
|
||||
endtry
|
||||
endif
|
||||
|
||||
" Names of flaky tests.
|
||||
let s:flaky = ['Test_reltime()']
|
||||
|
||||
" Locate Test_ functions and execute them.
|
||||
set nomore
|
||||
redir @q
|
||||
@@ -106,18 +127,13 @@ endif
|
||||
|
||||
" Execute the tests in alphabetical order.
|
||||
for s:test in sort(s:tests)
|
||||
echo 'Executing ' . s:test
|
||||
if exists("*SetUp")
|
||||
call SetUp()
|
||||
endif
|
||||
call RunTheTest(s:test)
|
||||
|
||||
call add(s:messages, 'Executing ' . s:test)
|
||||
let s:done += 1
|
||||
try
|
||||
exe 'call ' . s:test
|
||||
catch
|
||||
call add(v:errors, 'Caught exception in ' . s:test . ': ' . v:exception . ' @ ' . v:throwpoint)
|
||||
endtry
|
||||
if len(v:errors) > 0 && index(s:flaky, s:test) >= 0
|
||||
call add(s:messages, 'Flaky test failed, running it again')
|
||||
let v:errors = []
|
||||
call RunTheTest(s:test)
|
||||
endif
|
||||
|
||||
if len(v:errors) > 0
|
||||
let s:fail += 1
|
||||
@@ -126,9 +142,6 @@ for s:test in sort(s:tests)
|
||||
let v:errors = []
|
||||
endif
|
||||
|
||||
if exists("*TearDown")
|
||||
call TearDown()
|
||||
endif
|
||||
endfor
|
||||
|
||||
if s:fail == 0
|
||||
|
||||
@@ -9,4 +9,4 @@ start:
|
||||
0:not highlighted
|
||||
1:highlighted
|
||||
0:not highlighted
|
||||
Vim(let):E706:
|
||||
Vim(let):E745:
|
||||
|
||||
@@ -59,17 +59,6 @@ STARTTEST
|
||||
: $put =v:exception
|
||||
:endtry
|
||||
:"
|
||||
:" Changing var type should fail
|
||||
:try
|
||||
: let d = []
|
||||
:catch
|
||||
: $put =v:exception[:14] . v:exception[-1:-1]
|
||||
:endtry
|
||||
:try
|
||||
: let l = {}
|
||||
:catch
|
||||
: $put =v:exception[:14] . v:exception[-1:-1]
|
||||
:endtry
|
||||
:"
|
||||
:" removing items with :unlet
|
||||
:unlet l[2]
|
||||
|
||||
@@ -19,8 +19,6 @@ Vim(call):E737: 3
|
||||
{'c': 'ccc', '1': 99, 'b': [1, 2, function('strlen')], '3': 33, '-1': {'a': 1}}
|
||||
{'c': 'ccc', '1': 99, '3': 33, '-1': {'a': 1}}
|
||||
101101
|
||||
Vim(let):E706: d
|
||||
Vim(let):E706: l
|
||||
[1, 'as''d', {'a': 1}]
|
||||
[4]
|
||||
{'1': 99, '3': 33}
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
" A series of tests that can run in one Vim invocation.
|
||||
" This makes testing go faster, since Vim doesn't need to restart.
|
||||
|
||||
source test_assign.vim
|
||||
source test_backspace_opt.vim
|
||||
source test_cursor_func.vim
|
||||
source test_delete.vim
|
||||
source test_expand.vim
|
||||
source test_feedkeys.vim
|
||||
source test_file_perm.vim
|
||||
source test_glob2regpat.vim
|
||||
source test_join.vim
|
||||
source test_lispwords.vim
|
||||
source test_menu.vim
|
||||
source test_reltime.vim
|
||||
source test_searchpos.vim
|
||||
source test_set.vim
|
||||
source test_sort.vim
|
||||
source test_syn_attr.vim
|
||||
source test_undolevels.vim
|
||||
source test_unlet.vim
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
" Test for assignment
|
||||
|
||||
func Test_no_type_checking()
|
||||
let v = 1
|
||||
let v = [1,2,3]
|
||||
let v = {'a': 1, 'b': 2}
|
||||
let v = 3.4
|
||||
let v = 'hello'
|
||||
endfunc
|
||||
@@ -62,6 +62,9 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
|
||||
if decoded[1] == 'hello!':
|
||||
# simply send back a string
|
||||
response = "got it"
|
||||
elif decoded[1].startswith("echo "):
|
||||
# send back the argument
|
||||
response = decoded[1][5:]
|
||||
elif decoded[1] == 'make change':
|
||||
# Send two ex commands at the same time, before
|
||||
# replying to the request.
|
||||
@@ -140,6 +143,11 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
|
||||
print("sending: {}".format(cmd))
|
||||
self.request.sendall(cmd.encode('utf-8'))
|
||||
response = ""
|
||||
elif decoded[1] == 'send zero':
|
||||
cmd = '[0,"zero index"]'
|
||||
print("sending: {}".format(cmd))
|
||||
self.request.sendall(cmd.encode('utf-8'))
|
||||
response = "sent zero"
|
||||
elif decoded[1] == 'close me':
|
||||
print("closing")
|
||||
self.request.close()
|
||||
|
||||
+577
-48
@@ -53,9 +53,8 @@ func s:run_server(testfunc, ...)
|
||||
endif
|
||||
|
||||
" Wait for up to 2 seconds for the port number to be there.
|
||||
let cnt = 20
|
||||
let l = []
|
||||
while cnt > 0
|
||||
for i in range(200)
|
||||
try
|
||||
let l = readfile("Xportnr")
|
||||
catch
|
||||
@@ -63,9 +62,8 @@ func s:run_server(testfunc, ...)
|
||||
if len(l) >= 1
|
||||
break
|
||||
endif
|
||||
sleep 100m
|
||||
let cnt -= 1
|
||||
endwhile
|
||||
sleep 10m
|
||||
endfor
|
||||
call delete("Xportnr")
|
||||
|
||||
if len(l) == 0
|
||||
@@ -102,12 +100,29 @@ func s:RequestHandler(handle, msg)
|
||||
let s:responseMsg = a:msg
|
||||
endfunc
|
||||
|
||||
" Wait for up to a second for "expr" to become true.
|
||||
func s:waitFor(expr)
|
||||
for i in range(100)
|
||||
try
|
||||
if eval(a:expr)
|
||||
return
|
||||
endif
|
||||
catch
|
||||
endtry
|
||||
sleep 10m
|
||||
endfor
|
||||
endfunc
|
||||
|
||||
func s:communicate(port)
|
||||
let handle = ch_open('localhost:' . a:port, s:chopt)
|
||||
if ch_status(handle) == "fail"
|
||||
call assert_false(1, "Can't open channel")
|
||||
return
|
||||
endif
|
||||
if has('job')
|
||||
" check that no job is handled correctly
|
||||
call assert_equal('no process', string(ch_getjob(handle)))
|
||||
endif
|
||||
|
||||
" Simple string request and reply.
|
||||
call assert_equal('got it', ch_evalexpr(handle, 'hello!'))
|
||||
@@ -116,17 +131,17 @@ func s:communicate(port)
|
||||
" handled before getting the response, but it's not guaranteed, thus wait a
|
||||
" tiny bit for the commands to get executed.
|
||||
call assert_equal('ok', ch_evalexpr(handle, 'make change'))
|
||||
sleep 10m
|
||||
call s:waitFor('"added2" == getline("$")')
|
||||
call assert_equal('added1', getline(line('$') - 1))
|
||||
call assert_equal('added2', getline('$'))
|
||||
|
||||
call assert_equal('ok', ch_evalexpr(handle, 'do normal'))
|
||||
sleep 10m
|
||||
call assert_equal('ok', ch_evalexpr(handle, 'do normal', {'timeout': 100}))
|
||||
call s:waitFor('"added more" == getline("$")')
|
||||
call assert_equal('added more', getline('$'))
|
||||
|
||||
" Send a request with a specific handler.
|
||||
call ch_sendexpr(handle, 'hello!', {'callback': 's:RequestHandler'})
|
||||
sleep 10m
|
||||
call s:waitFor('exists("s:responseHandle")')
|
||||
if !exists('s:responseHandle')
|
||||
call assert_false(1, 's:responseHandle was not set')
|
||||
else
|
||||
@@ -137,7 +152,7 @@ func s:communicate(port)
|
||||
|
||||
let s:responseMsg = ''
|
||||
call ch_sendexpr(handle, 'hello!', {'callback': function('s:RequestHandler')})
|
||||
sleep 10m
|
||||
call s:waitFor('exists("s:responseHandle")')
|
||||
if !exists('s:responseHandle')
|
||||
call assert_false(1, 's:responseHandle was not set')
|
||||
else
|
||||
@@ -146,6 +161,9 @@ func s:communicate(port)
|
||||
endif
|
||||
call assert_equal('got it', s:responseMsg)
|
||||
|
||||
" Collect garbage, tests that our handle isn't collected.
|
||||
call garbagecollect()
|
||||
|
||||
" check setting options (without testing the effect)
|
||||
call ch_setoptions(handle, {'callback': 's:NotUsed'})
|
||||
call ch_setoptions(handle, {'timeout': 1111})
|
||||
@@ -175,7 +193,7 @@ func s:communicate(port)
|
||||
|
||||
" Send an expr request
|
||||
call assert_equal('ok', ch_evalexpr(handle, 'an expr'))
|
||||
sleep 10m
|
||||
call s:waitFor('"three" == getline("$")')
|
||||
call assert_equal('one', getline(line('$') - 2))
|
||||
call assert_equal('two', getline(line('$') - 1))
|
||||
call assert_equal('three', getline('$'))
|
||||
@@ -257,6 +275,8 @@ func Test_server_crash()
|
||||
call s:run_server('s:server_crash')
|
||||
endfunc
|
||||
|
||||
"""""""""
|
||||
|
||||
let s:reply = ""
|
||||
func s:Handler(chan, msg)
|
||||
unlet s:reply
|
||||
@@ -272,12 +292,12 @@ func s:channel_handler(port)
|
||||
|
||||
" Test that it works while waiting on a numbered message.
|
||||
call assert_equal('ok', ch_evalexpr(handle, 'call me'))
|
||||
sleep 10m
|
||||
call s:waitFor('"we called you" == s:reply')
|
||||
call assert_equal('we called you', s:reply)
|
||||
|
||||
" Test that it works while not waiting on a numbered message.
|
||||
call ch_sendexpr(handle, 'call me again')
|
||||
sleep 10m
|
||||
call s:waitFor('"we did call you" == s:reply')
|
||||
call assert_equal('we did call you', s:reply)
|
||||
endfunc
|
||||
|
||||
@@ -290,6 +310,115 @@ func Test_channel_handler()
|
||||
unlet s:chopt.callback
|
||||
endfunc
|
||||
|
||||
"""""""""
|
||||
|
||||
let s:ch_reply = ''
|
||||
func s:ChHandler(chan, msg)
|
||||
unlet s:ch_reply
|
||||
let s:ch_reply = a:msg
|
||||
endfunc
|
||||
|
||||
let s:zero_reply = ''
|
||||
func s:OneHandler(chan, msg)
|
||||
unlet s:zero_reply
|
||||
let s:zero_reply = a:msg
|
||||
endfunc
|
||||
|
||||
func s:channel_zero(port)
|
||||
let handle = ch_open('localhost:' . a:port, s:chopt)
|
||||
if ch_status(handle) == "fail"
|
||||
call assert_false(1, "Can't open channel")
|
||||
return
|
||||
endif
|
||||
|
||||
" Check that eval works.
|
||||
call assert_equal('got it', ch_evalexpr(handle, 'hello!'))
|
||||
|
||||
" Check that eval works if a zero id message is sent back.
|
||||
let s:ch_reply = ''
|
||||
call assert_equal('sent zero', ch_evalexpr(handle, 'send zero'))
|
||||
if s:has_handler
|
||||
call s:waitFor('"zero index" == s:ch_reply')
|
||||
call assert_equal('zero index', s:ch_reply)
|
||||
else
|
||||
sleep 20m
|
||||
call assert_equal('', s:ch_reply)
|
||||
endif
|
||||
|
||||
" Check that handler works if a zero id message is sent back.
|
||||
let s:ch_reply = ''
|
||||
let s:zero_reply = ''
|
||||
call ch_sendexpr(handle, 'send zero', {'callback': 's:OneHandler'})
|
||||
call s:waitFor('"sent zero" == s:zero_reply')
|
||||
if s:has_handler
|
||||
call assert_equal('zero index', s:ch_reply)
|
||||
else
|
||||
call assert_equal('', s:ch_reply)
|
||||
endif
|
||||
call assert_equal('sent zero', s:zero_reply)
|
||||
endfunc
|
||||
|
||||
func Test_zero_reply()
|
||||
call ch_log('Test_zero_reply()')
|
||||
" Run with channel handler
|
||||
let s:has_handler = 1
|
||||
let s:chopt.callback = 's:ChHandler'
|
||||
call s:run_server('s:channel_zero')
|
||||
unlet s:chopt.callback
|
||||
|
||||
" Run without channel handler
|
||||
let s:has_handler = 0
|
||||
call s:run_server('s:channel_zero')
|
||||
endfunc
|
||||
|
||||
"""""""""
|
||||
|
||||
let s:reply1 = ""
|
||||
func s:HandleRaw1(chan, msg)
|
||||
unlet s:reply1
|
||||
let s:reply1 = a:msg
|
||||
endfunc
|
||||
|
||||
let s:reply2 = ""
|
||||
func s:HandleRaw2(chan, msg)
|
||||
unlet s:reply2
|
||||
let s:reply2 = a:msg
|
||||
endfunc
|
||||
|
||||
let s:reply3 = ""
|
||||
func s:HandleRaw3(chan, msg)
|
||||
unlet s:reply3
|
||||
let s:reply3 = a:msg
|
||||
endfunc
|
||||
|
||||
func s:raw_one_time_callback(port)
|
||||
let handle = ch_open('localhost:' . a:port, s:chopt)
|
||||
if ch_status(handle) == "fail"
|
||||
call assert_false(1, "Can't open channel")
|
||||
return
|
||||
endif
|
||||
call ch_setoptions(handle, {'mode': 'raw'})
|
||||
|
||||
" The message are sent raw, we do our own JSON strings here.
|
||||
call ch_sendraw(handle, "[1, \"hello!\"]", {'callback': 's:HandleRaw1'})
|
||||
call s:waitFor('s:reply1 != ""')
|
||||
call assert_equal("[1, \"got it\"]", s:reply1)
|
||||
call ch_sendraw(handle, "[2, \"echo something\"]", {'callback': 's:HandleRaw2'})
|
||||
call ch_sendraw(handle, "[3, \"wait a bit\"]", {'callback': 's:HandleRaw3'})
|
||||
call s:waitFor('s:reply2 != ""')
|
||||
call assert_equal("[2, \"something\"]", s:reply2)
|
||||
" wait for the 200 msec delayed reply
|
||||
call s:waitFor('s:reply3 != ""')
|
||||
call assert_equal("[3, \"waited\"]", s:reply3)
|
||||
endfunc
|
||||
|
||||
func Test_raw_one_time_callback()
|
||||
call ch_log('Test_raw_one_time_callback()')
|
||||
call s:run_server('s:raw_one_time_callback')
|
||||
endfunc
|
||||
|
||||
"""""""""
|
||||
|
||||
" Test that trying to connect to a non-existing port fails quickly.
|
||||
func Test_connect_waittime()
|
||||
call ch_log('Test_connect_waittime()')
|
||||
@@ -313,10 +442,11 @@ func Test_connect_waittime()
|
||||
" Oops, port does exists.
|
||||
call ch_close(handle)
|
||||
else
|
||||
" Failed connection should wait about 500 msec.
|
||||
" Failed connection should wait about 500 msec. Can be longer if the
|
||||
" computer is busy with other things.
|
||||
let elapsed = reltime(start)
|
||||
call assert_true(reltimefloat(elapsed) > 0.3)
|
||||
call assert_true(reltimefloat(elapsed) < 1.0)
|
||||
call assert_true(reltimefloat(elapsed) < 1.5)
|
||||
endif
|
||||
catch
|
||||
if v:exception !~ 'Connection reset by peer'
|
||||
@@ -325,6 +455,8 @@ func Test_connect_waittime()
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
"""""""""
|
||||
|
||||
func Test_raw_pipe()
|
||||
if !has('job')
|
||||
return
|
||||
@@ -333,20 +465,26 @@ func Test_raw_pipe()
|
||||
let job = job_start(s:python . " test_channel_pipe.py", {'mode': 'raw'})
|
||||
call assert_equal("run", job_status(job))
|
||||
try
|
||||
let handle = job_getchannel(job)
|
||||
call ch_sendraw(handle, "echo something\n")
|
||||
let msg = ch_readraw(handle)
|
||||
" For a change use the job where a channel is expected.
|
||||
call ch_sendraw(job, "echo something\n")
|
||||
let msg = ch_readraw(job)
|
||||
call assert_equal("something\n", substitute(msg, "\r", "", 'g'))
|
||||
|
||||
call ch_sendraw(handle, "double this\n")
|
||||
let msg = ch_readraw(handle)
|
||||
call ch_sendraw(job, "double this\n")
|
||||
let msg = ch_readraw(job)
|
||||
call assert_equal("this\nAND this\n", substitute(msg, "\r", "", 'g'))
|
||||
|
||||
let reply = ch_evalraw(handle, "quit\n")
|
||||
let reply = ch_evalraw(job, "quit\n", {'timeout': 100})
|
||||
call assert_equal("Goodbye!\n", substitute(reply, "\r", "", 'g'))
|
||||
finally
|
||||
call job_stop(job)
|
||||
endtry
|
||||
|
||||
let s:job = job
|
||||
call s:waitFor('"dead" == job_status(s:job)')
|
||||
let info = job_info(job)
|
||||
call assert_equal("dead", info.status)
|
||||
call assert_equal("term", info.stoponexit)
|
||||
endfunc
|
||||
|
||||
func Test_nl_pipe()
|
||||
@@ -354,13 +492,16 @@ func Test_nl_pipe()
|
||||
return
|
||||
endif
|
||||
call ch_log('Test_nl_pipe()')
|
||||
let job = job_start(s:python . " test_channel_pipe.py")
|
||||
let job = job_start([s:python, "test_channel_pipe.py"])
|
||||
call assert_equal("run", job_status(job))
|
||||
try
|
||||
let handle = job_getchannel(job)
|
||||
call ch_sendraw(handle, "echo something\n")
|
||||
call assert_equal("something", ch_readraw(handle))
|
||||
|
||||
call ch_sendraw(handle, "echoerr wrong\n")
|
||||
call assert_equal("wrong", ch_readraw(handle, {'part': 'err'}))
|
||||
|
||||
call ch_sendraw(handle, "double this\n")
|
||||
call assert_equal("this", ch_readraw(handle))
|
||||
call assert_equal("AND this", ch_readraw(handle))
|
||||
@@ -372,13 +513,153 @@ func Test_nl_pipe()
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
func Test_pipe_to_buffer()
|
||||
func Test_nl_err_to_out_pipe()
|
||||
if !has('job')
|
||||
return
|
||||
endif
|
||||
call ch_logfile('Xlog')
|
||||
call ch_log('Test_nl_err_to_out_pipe()')
|
||||
let job = job_start(s:python . " test_channel_pipe.py", {'err-io': 'out'})
|
||||
call assert_equal("run", job_status(job))
|
||||
try
|
||||
let handle = job_getchannel(job)
|
||||
call ch_sendraw(handle, "echo something\n")
|
||||
call assert_equal("something", ch_readraw(handle))
|
||||
|
||||
call ch_sendraw(handle, "echoerr wrong\n")
|
||||
call assert_equal("wrong", ch_readraw(handle))
|
||||
finally
|
||||
call job_stop(job)
|
||||
call ch_logfile('')
|
||||
let loglines = readfile('Xlog')
|
||||
call assert_true(len(loglines) > 10)
|
||||
let found_test = 0
|
||||
let found_send = 0
|
||||
let found_recv = 0
|
||||
let found_stop = 0
|
||||
for l in loglines
|
||||
if l =~ 'Test_nl_err_to_out_pipe'
|
||||
let found_test = 1
|
||||
endif
|
||||
if l =~ 'SEND on.*echo something'
|
||||
let found_send = 1
|
||||
endif
|
||||
if l =~ 'RECV on.*something'
|
||||
let found_recv = 1
|
||||
endif
|
||||
if l =~ 'Stopping job with'
|
||||
let found_stop = 1
|
||||
endif
|
||||
endfor
|
||||
call assert_equal(1, found_test)
|
||||
call assert_equal(1, found_send)
|
||||
call assert_equal(1, found_recv)
|
||||
call assert_equal(1, found_stop)
|
||||
call delete('Xlog')
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
func Test_nl_read_file()
|
||||
if !has('job')
|
||||
return
|
||||
endif
|
||||
call ch_log('Test_nl_read_file()')
|
||||
call writefile(['echo something', 'echoerr wrong', 'double this'], 'Xinput')
|
||||
let job = job_start(s:python . " test_channel_pipe.py",
|
||||
\ {'in-io': 'file', 'in-name': 'Xinput'})
|
||||
call assert_equal("run", job_status(job))
|
||||
try
|
||||
let handle = job_getchannel(job)
|
||||
call assert_equal("something", ch_readraw(handle))
|
||||
call assert_equal("wrong", ch_readraw(handle, {'part': 'err'}))
|
||||
call assert_equal("this", ch_readraw(handle))
|
||||
call assert_equal("AND this", ch_readraw(handle))
|
||||
finally
|
||||
call job_stop(job)
|
||||
call delete('Xinput')
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
func Test_nl_write_out_file()
|
||||
if !has('job')
|
||||
return
|
||||
endif
|
||||
call ch_log('Test_nl_write_out_file()')
|
||||
let job = job_start(s:python . " test_channel_pipe.py",
|
||||
\ {'out-io': 'file', 'out-name': 'Xoutput'})
|
||||
call assert_equal("run", job_status(job))
|
||||
try
|
||||
let handle = job_getchannel(job)
|
||||
call ch_sendraw(handle, "echo line one\n")
|
||||
call ch_sendraw(handle, "echo line two\n")
|
||||
call ch_sendraw(handle, "double this\n")
|
||||
call s:waitFor('len(readfile("Xoutput")) > 2')
|
||||
call assert_equal(['line one', 'line two', 'this', 'AND this'], readfile('Xoutput'))
|
||||
finally
|
||||
call job_stop(job)
|
||||
call delete('Xoutput')
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
func Test_nl_write_err_file()
|
||||
if !has('job')
|
||||
return
|
||||
endif
|
||||
call ch_log('Test_nl_write_err_file()')
|
||||
let job = job_start(s:python . " test_channel_pipe.py",
|
||||
\ {'err-io': 'file', 'err-name': 'Xoutput'})
|
||||
call assert_equal("run", job_status(job))
|
||||
try
|
||||
let handle = job_getchannel(job)
|
||||
call ch_sendraw(handle, "echoerr line one\n")
|
||||
call ch_sendraw(handle, "echoerr line two\n")
|
||||
call ch_sendraw(handle, "doubleerr this\n")
|
||||
call s:waitFor('len(readfile("Xoutput")) > 2')
|
||||
call assert_equal(['line one', 'line two', 'this', 'AND this'], readfile('Xoutput'))
|
||||
finally
|
||||
call job_stop(job)
|
||||
call delete('Xoutput')
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
func Test_nl_write_both_file()
|
||||
if !has('job')
|
||||
return
|
||||
endif
|
||||
call ch_log('Test_nl_write_both_file()')
|
||||
let job = job_start(s:python . " test_channel_pipe.py",
|
||||
\ {'out-io': 'file', 'out-name': 'Xoutput', 'err-io': 'out'})
|
||||
call assert_equal("run", job_status(job))
|
||||
try
|
||||
let handle = job_getchannel(job)
|
||||
call ch_sendraw(handle, "echoerr line one\n")
|
||||
call ch_sendraw(handle, "echo line two\n")
|
||||
call ch_sendraw(handle, "double this\n")
|
||||
call ch_sendraw(handle, "doubleerr that\n")
|
||||
call s:waitFor('len(readfile("Xoutput")) > 5')
|
||||
call assert_equal(['line one', 'line two', 'this', 'AND this', 'that', 'AND that'], readfile('Xoutput'))
|
||||
finally
|
||||
call job_stop(job)
|
||||
call delete('Xoutput')
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
func Run_test_pipe_to_buffer(use_name)
|
||||
if !has('job')
|
||||
return
|
||||
endif
|
||||
call ch_log('Test_pipe_to_buffer()')
|
||||
let job = job_start(s:python . " test_channel_pipe.py",
|
||||
\ {'out-io': 'buffer', 'out-name': 'pipe-output'})
|
||||
let options = {'out-io': 'buffer'}
|
||||
if a:use_name
|
||||
let options['out-name'] = 'pipe-output'
|
||||
let firstline = 'Reading from channel output...'
|
||||
else
|
||||
sp pipe-output
|
||||
let options['out-buf'] = bufnr('%')
|
||||
quit
|
||||
let firstline = ''
|
||||
endif
|
||||
let job = job_start(s:python . " test_channel_pipe.py", options)
|
||||
call assert_equal("run", job_status(job))
|
||||
try
|
||||
let handle = job_getchannel(job)
|
||||
@@ -387,19 +668,122 @@ func Test_pipe_to_buffer()
|
||||
call ch_sendraw(handle, "double this\n")
|
||||
call ch_sendraw(handle, "quit\n")
|
||||
sp pipe-output
|
||||
for i in range(100)
|
||||
sleep 10m
|
||||
if line('$') >= 6
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
call assert_equal(['Reading from channel output...', 'line one', 'line two', 'this', 'AND this', 'Goodbye!'], getline(1, '$'))
|
||||
call s:waitFor('line("$") >= 6')
|
||||
call assert_equal([firstline, 'line one', 'line two', 'this', 'AND this', 'Goodbye!'], getline(1, '$'))
|
||||
bwipe!
|
||||
finally
|
||||
call job_stop(job)
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
func Test_pipe_to_buffer_name()
|
||||
call Run_test_pipe_to_buffer(1)
|
||||
endfunc
|
||||
|
||||
func Test_pipe_to_buffer_nr()
|
||||
call Run_test_pipe_to_buffer(0)
|
||||
endfunc
|
||||
|
||||
func Run_test_pipe_err_to_buffer(use_name)
|
||||
if !has('job')
|
||||
return
|
||||
endif
|
||||
call ch_log('Test_pipe_err_to_buffer()')
|
||||
let options = {'err-io': 'buffer'}
|
||||
if a:use_name
|
||||
let options['err-name'] = 'pipe-err'
|
||||
let firstline = 'Reading from channel error...'
|
||||
else
|
||||
sp pipe-err
|
||||
let options['err-buf'] = bufnr('%')
|
||||
quit
|
||||
let firstline = ''
|
||||
endif
|
||||
let job = job_start(s:python . " test_channel_pipe.py", options)
|
||||
call assert_equal("run", job_status(job))
|
||||
try
|
||||
let handle = job_getchannel(job)
|
||||
call ch_sendraw(handle, "echoerr line one\n")
|
||||
call ch_sendraw(handle, "echoerr line two\n")
|
||||
call ch_sendraw(handle, "doubleerr this\n")
|
||||
call ch_sendraw(handle, "quit\n")
|
||||
sp pipe-err
|
||||
call s:waitFor('line("$") >= 5')
|
||||
call assert_equal([firstline, 'line one', 'line two', 'this', 'AND this'], getline(1, '$'))
|
||||
bwipe!
|
||||
finally
|
||||
call job_stop(job)
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
func Test_pipe_err_to_buffer_name()
|
||||
call Run_test_pipe_err_to_buffer(1)
|
||||
endfunc
|
||||
|
||||
func Test_pipe_err_to_buffer_nr()
|
||||
call Run_test_pipe_err_to_buffer(0)
|
||||
endfunc
|
||||
|
||||
func Test_pipe_both_to_buffer()
|
||||
if !has('job')
|
||||
return
|
||||
endif
|
||||
call ch_log('Test_pipe_both_to_buffer()')
|
||||
let job = job_start(s:python . " test_channel_pipe.py",
|
||||
\ {'out-io': 'buffer', 'out-name': 'pipe-err', 'err-io': 'out'})
|
||||
call assert_equal("run", job_status(job))
|
||||
try
|
||||
let handle = job_getchannel(job)
|
||||
call ch_sendraw(handle, "echo line one\n")
|
||||
call ch_sendraw(handle, "echoerr line two\n")
|
||||
call ch_sendraw(handle, "double this\n")
|
||||
call ch_sendraw(handle, "doubleerr that\n")
|
||||
call ch_sendraw(handle, "quit\n")
|
||||
sp pipe-err
|
||||
call s:waitFor('line("$") >= 7')
|
||||
call assert_equal(['Reading from channel output...', 'line one', 'line two', 'this', 'AND this', 'that', 'AND that', 'Goodbye!'], getline(1, '$'))
|
||||
bwipe!
|
||||
finally
|
||||
call job_stop(job)
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
func Run_test_pipe_from_buffer(use_name)
|
||||
if !has('job')
|
||||
return
|
||||
endif
|
||||
call ch_log('Test_pipe_from_buffer()')
|
||||
|
||||
sp pipe-input
|
||||
call setline(1, ['echo one', 'echo two', 'echo three'])
|
||||
let options = {'in-io': 'buffer'}
|
||||
if a:use_name
|
||||
let options['in-name'] = 'pipe-input'
|
||||
else
|
||||
let options['in-buf'] = bufnr('%')
|
||||
endif
|
||||
|
||||
let job = job_start(s:python . " test_channel_pipe.py", options)
|
||||
call assert_equal("run", job_status(job))
|
||||
try
|
||||
let handle = job_getchannel(job)
|
||||
call assert_equal('one', ch_read(handle))
|
||||
call assert_equal('two', ch_read(handle))
|
||||
call assert_equal('three', ch_read(handle))
|
||||
bwipe!
|
||||
finally
|
||||
call job_stop(job)
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
func Test_pipe_from_buffer_name()
|
||||
call Run_test_pipe_from_buffer(1)
|
||||
endfunc
|
||||
|
||||
func Test_pipe_from_buffer_nr()
|
||||
call Run_test_pipe_from_buffer(0)
|
||||
endfunc
|
||||
|
||||
func Test_pipe_to_nameless_buffer()
|
||||
if !has('job')
|
||||
return
|
||||
@@ -413,12 +797,7 @@ func Test_pipe_to_nameless_buffer()
|
||||
call ch_sendraw(handle, "echo line one\n")
|
||||
call ch_sendraw(handle, "echo line two\n")
|
||||
exe ch_getbufnr(handle, "out") . 'sbuf'
|
||||
for i in range(100)
|
||||
sleep 10m
|
||||
if line('$') >= 3
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
call s:waitFor('line("$") >= 3')
|
||||
call assert_equal(['Reading from channel output...', 'line one', 'line two'], getline(1, '$'))
|
||||
bwipe!
|
||||
finally
|
||||
@@ -439,12 +818,7 @@ func Test_pipe_to_buffer_json()
|
||||
call ch_sendraw(handle, "echo [0, \"hello\"]\n")
|
||||
call ch_sendraw(handle, "echo [-2, 12.34]\n")
|
||||
exe ch_getbufnr(handle, "out") . 'sbuf'
|
||||
for i in range(100)
|
||||
sleep 10m
|
||||
if line('$') >= 3
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
call s:waitFor('line("$") >= 3')
|
||||
call assert_equal(['Reading from channel output...', '[0,"hello"]', '[-2,12.34]'], getline(1, '$'))
|
||||
bwipe!
|
||||
finally
|
||||
@@ -452,6 +826,158 @@ func Test_pipe_to_buffer_json()
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
" Wait a little while for the last line, minus "offset", to equal "line".
|
||||
func s:wait_for_last_line(line, offset)
|
||||
for i in range(100)
|
||||
if getline(line('$') - a:offset) == a:line
|
||||
break
|
||||
endif
|
||||
sleep 10m
|
||||
endfor
|
||||
endfunc
|
||||
|
||||
func Test_pipe_io_two_buffers()
|
||||
if !has('job')
|
||||
return
|
||||
endif
|
||||
call ch_log('Test_pipe_io_two_buffers()')
|
||||
|
||||
" Create two buffers, one to read from and one to write to.
|
||||
split pipe-output
|
||||
set buftype=nofile
|
||||
split pipe-input
|
||||
set buftype=nofile
|
||||
|
||||
let job = job_start(s:python . " test_channel_pipe.py",
|
||||
\ {'in-io': 'buffer', 'in-name': 'pipe-input', 'in-top': 0,
|
||||
\ 'out-io': 'buffer', 'out-name': 'pipe-output'})
|
||||
call assert_equal("run", job_status(job))
|
||||
try
|
||||
exe "normal Gaecho hello\<CR>"
|
||||
exe bufwinnr('pipe-output') . "wincmd w"
|
||||
call s:wait_for_last_line('hello', 0)
|
||||
call assert_equal('hello', getline('$'))
|
||||
|
||||
exe bufwinnr('pipe-input') . "wincmd w"
|
||||
exe "normal Gadouble this\<CR>"
|
||||
exe bufwinnr('pipe-output') . "wincmd w"
|
||||
call s:wait_for_last_line('AND this', 0)
|
||||
call assert_equal('this', getline(line('$') - 1))
|
||||
call assert_equal('AND this', getline('$'))
|
||||
|
||||
bwipe!
|
||||
exe bufwinnr('pipe-input') . "wincmd w"
|
||||
bwipe!
|
||||
finally
|
||||
call job_stop(job)
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
func Test_pipe_io_one_buffer()
|
||||
if !has('job')
|
||||
return
|
||||
endif
|
||||
call ch_log('Test_pipe_io_one_buffer()')
|
||||
|
||||
" Create one buffer to read from and to write to.
|
||||
split pipe-io
|
||||
set buftype=nofile
|
||||
|
||||
let job = job_start(s:python . " test_channel_pipe.py",
|
||||
\ {'in-io': 'buffer', 'in-name': 'pipe-io', 'in-top': 0,
|
||||
\ 'out-io': 'buffer', 'out-name': 'pipe-io'})
|
||||
call assert_equal("run", job_status(job))
|
||||
try
|
||||
exe "normal Goecho hello\<CR>"
|
||||
call s:wait_for_last_line('hello', 1)
|
||||
call assert_equal('hello', getline(line('$') - 1))
|
||||
|
||||
exe "normal Gadouble this\<CR>"
|
||||
call s:wait_for_last_line('AND this', 1)
|
||||
call assert_equal('this', getline(line('$') - 2))
|
||||
call assert_equal('AND this', getline(line('$') - 1))
|
||||
|
||||
bwipe!
|
||||
finally
|
||||
call job_stop(job)
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
func Test_pipe_null()
|
||||
if !has('job')
|
||||
return
|
||||
endif
|
||||
call ch_log('Test_pipe_null()')
|
||||
|
||||
" We cannot check that no I/O works, we only check that the job starts
|
||||
" properly.
|
||||
let job = job_start(s:python . " test_channel_pipe.py something",
|
||||
\ {'in-io': 'null'})
|
||||
call assert_equal("run", job_status(job))
|
||||
try
|
||||
call assert_equal('something', ch_read(job))
|
||||
finally
|
||||
call job_stop(job)
|
||||
endtry
|
||||
|
||||
let job = job_start(s:python . " test_channel_pipe.py err-out",
|
||||
\ {'out-io': 'null'})
|
||||
call assert_equal("run", job_status(job))
|
||||
try
|
||||
call assert_equal('err-out', ch_read(job, {"part": "err"}))
|
||||
finally
|
||||
call job_stop(job)
|
||||
endtry
|
||||
|
||||
let job = job_start(s:python . " test_channel_pipe.py something",
|
||||
\ {'err-io': 'null'})
|
||||
call assert_equal("run", job_status(job))
|
||||
try
|
||||
call assert_equal('something', ch_read(job))
|
||||
finally
|
||||
call job_stop(job)
|
||||
endtry
|
||||
|
||||
let job = job_start(s:python . " test_channel_pipe.py something",
|
||||
\ {'out-io': 'null', 'err-io': 'out'})
|
||||
call assert_equal("run", job_status(job))
|
||||
call job_stop(job)
|
||||
|
||||
let job = job_start(s:python . " test_channel_pipe.py something",
|
||||
\ {'in-io': 'null', 'out-io': 'null', 'err-io': 'null'})
|
||||
call assert_equal("run", job_status(job))
|
||||
call assert_equal('channel fail', string(job_getchannel(job)))
|
||||
call assert_equal('fail', ch_status(job))
|
||||
call job_stop(job)
|
||||
endfunc
|
||||
|
||||
func Test_reuse_channel()
|
||||
if !has('job')
|
||||
return
|
||||
endif
|
||||
call ch_log('Test_reuse_channel()')
|
||||
|
||||
let job = job_start(s:python . " test_channel_pipe.py")
|
||||
call assert_equal("run", job_status(job))
|
||||
let handle = job_getchannel(job)
|
||||
try
|
||||
call ch_sendraw(handle, "echo something\n")
|
||||
call assert_equal("something", ch_readraw(handle))
|
||||
finally
|
||||
call job_stop(job)
|
||||
endtry
|
||||
|
||||
let job = job_start(s:python . " test_channel_pipe.py", {'channel': handle})
|
||||
call assert_equal("run", job_status(job))
|
||||
let handle = job_getchannel(job)
|
||||
try
|
||||
call ch_sendraw(handle, "echo again\n")
|
||||
call assert_equal("again", ch_readraw(handle))
|
||||
finally
|
||||
call job_stop(job)
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
""""""""""
|
||||
|
||||
let s:unletResponse = ''
|
||||
@@ -464,7 +990,7 @@ endfunc
|
||||
func s:unlet_handle(port)
|
||||
let s:channelfd = ch_open('localhost:' . a:port, s:chopt)
|
||||
call ch_sendexpr(s:channelfd, "test", {'callback': function('s:UnletHandler')})
|
||||
sleep 10m
|
||||
call s:waitFor('"what?" == s:unletResponse')
|
||||
call assert_equal('what?', s:unletResponse)
|
||||
endfunc
|
||||
|
||||
@@ -485,7 +1011,7 @@ endfunc
|
||||
func s:close_handle(port)
|
||||
let s:channelfd = ch_open('localhost:' . a:port, s:chopt)
|
||||
call ch_sendexpr(s:channelfd, "test", {'callback': function('s:CloseHandler')})
|
||||
sleep 10m
|
||||
call s:waitFor('"what?" == s:unletResponse')
|
||||
call assert_equal('what?', s:unletResponse)
|
||||
endfunc
|
||||
|
||||
@@ -537,8 +1063,9 @@ function s:test_call(port)
|
||||
return
|
||||
endif
|
||||
|
||||
let s:call_ret = []
|
||||
call assert_equal('ok', ch_evalexpr(handle, 'call-func'))
|
||||
sleep 20m
|
||||
call s:waitFor('len(s:call_ret) > 0')
|
||||
call assert_equal([1, 2, 3], s:call_ret)
|
||||
endfunc
|
||||
|
||||
@@ -557,6 +1084,7 @@ endfunc
|
||||
function s:test_exit_callback(port)
|
||||
call job_setoptions(s:job, {'exit-cb': 'MyExitCb'})
|
||||
let s:exit_job = s:job
|
||||
call assert_equal('MyExitCb', job_info(s:job)['exit-cb'])
|
||||
endfunc
|
||||
|
||||
func Test_exit_callback()
|
||||
@@ -575,6 +1103,7 @@ func Test_exit_callback()
|
||||
endfor
|
||||
|
||||
call assert_equal('done', s:job_exit_ret)
|
||||
call assert_equal('dead', job_info(s:exit_job).status)
|
||||
unlet s:exit_job
|
||||
endif
|
||||
endfunc
|
||||
@@ -595,7 +1124,7 @@ function s:test_close_callback(port)
|
||||
call ch_setoptions(handle, {'close-cb': 'MyCloseCb'})
|
||||
|
||||
call assert_equal('', ch_evalexpr(handle, 'close me'))
|
||||
sleep 20m
|
||||
call s:waitFor('"closed" == s:ch_close_ret')
|
||||
call assert_equal('closed', s:ch_close_ret)
|
||||
endfunc
|
||||
|
||||
|
||||
@@ -10,7 +10,12 @@ import sys
|
||||
if __name__ == "__main__":
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
print(sys.argv[1])
|
||||
if sys.argv[1].startswith("err"):
|
||||
print(sys.argv[1], file=sys.stderr)
|
||||
sys.stderr.flush()
|
||||
else:
|
||||
print(sys.argv[1])
|
||||
sys.stdout.flush()
|
||||
|
||||
while True:
|
||||
typed = sys.stdin.readline()
|
||||
@@ -18,10 +23,16 @@ if __name__ == "__main__":
|
||||
print("Goodbye!")
|
||||
sys.stdout.flush()
|
||||
break
|
||||
if typed.startswith("echo"):
|
||||
if typed.startswith("echo "):
|
||||
print(typed[5:-1])
|
||||
sys.stdout.flush()
|
||||
if typed.startswith("double"):
|
||||
if typed.startswith("double "):
|
||||
print(typed[7:-1] + "\nAND " + typed[7:-1])
|
||||
sys.stdout.flush()
|
||||
if typed.startswith("echoerr "):
|
||||
print(typed[8:-1], file=sys.stderr)
|
||||
sys.stderr.flush()
|
||||
if typed.startswith("doubleerr "):
|
||||
print(typed[10:-1] + "\nAND " + typed[10:-1], file=sys.stderr)
|
||||
sys.stderr.flush()
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
" Test feedkeys() function.
|
||||
|
||||
func Test_feedkeys_x_with_empty_string()
|
||||
new
|
||||
call feedkeys("ifoo\<Esc>")
|
||||
call assert_equal('', getline('.'))
|
||||
call feedkeys('', 'x')
|
||||
call assert_equal('foo', getline('.'))
|
||||
quit!
|
||||
endfunc
|
||||
@@ -0,0 +1,24 @@
|
||||
" Test getting and setting file permissions.
|
||||
|
||||
func Test_file_perm()
|
||||
call assert_equal('', getfperm('Xtest'))
|
||||
call assert_equal(0, setfperm('Xtest', 'r--------'))
|
||||
|
||||
call writefile(['one'], 'Xtest')
|
||||
call assert_true(len(getfperm('Xtest')) == 9)
|
||||
|
||||
call assert_equal(1, setfperm('Xtest', 'rwx------'))
|
||||
if has('win32')
|
||||
call assert_equal('rw-rw-rw-', getfperm('Xtest'))
|
||||
else
|
||||
call assert_equal('rwx------', getfperm('Xtest'))
|
||||
endif
|
||||
|
||||
call assert_equal(1, setfperm('Xtest', 'r--r--r--'))
|
||||
call assert_equal('r--r--r--', getfperm('Xtest'))
|
||||
|
||||
call assert_fails("setfperm('Xtest', '---')")
|
||||
|
||||
call assert_equal(1, setfperm('Xtest', 'rwx------'))
|
||||
call delete('Xtest')
|
||||
endfunc
|
||||
@@ -0,0 +1,65 @@
|
||||
" Tests for the history functions
|
||||
|
||||
if !has('cmdline_hist')
|
||||
finish
|
||||
endif
|
||||
|
||||
set history=7
|
||||
|
||||
function History_Tests(hist)
|
||||
" First clear the history
|
||||
call histadd(a:hist, 'dummy')
|
||||
call assert_true(histdel(a:hist))
|
||||
call assert_equal(-1, histnr(a:hist))
|
||||
call assert_equal('', histget(a:hist))
|
||||
|
||||
call assert_true(histadd(a:hist, 'ls'))
|
||||
call assert_true(histadd(a:hist, 'buffers'))
|
||||
call assert_equal('buffers', histget(a:hist))
|
||||
call assert_equal('ls', histget(a:hist, -2))
|
||||
call assert_equal('ls', histget(a:hist, 1))
|
||||
call assert_equal('', histget(a:hist, 5))
|
||||
call assert_equal('', histget(a:hist, -5))
|
||||
call assert_equal(2, histnr(a:hist))
|
||||
call assert_true(histdel(a:hist, 2))
|
||||
call assert_false(histdel(a:hist, 7))
|
||||
call assert_equal(1, histnr(a:hist))
|
||||
call assert_equal('ls', histget(a:hist, -1))
|
||||
|
||||
call assert_true(histadd(a:hist, 'buffers'))
|
||||
call assert_true(histadd(a:hist, 'ls'))
|
||||
call assert_equal('ls', histget(a:hist, -1))
|
||||
call assert_equal(4, histnr(a:hist))
|
||||
|
||||
" Test for removing entries matching a pattern
|
||||
for i in range(1, 3)
|
||||
call histadd(a:hist, 'text_' . i)
|
||||
endfor
|
||||
call assert_true(histdel(a:hist, 'text_\d\+'))
|
||||
call assert_equal('ls', histget(a:hist, -1))
|
||||
|
||||
" Test for freeing the entire history list
|
||||
for i in range(1, 7)
|
||||
call histadd(a:hist, 'text_' . i)
|
||||
endfor
|
||||
call histdel(a:hist)
|
||||
for i in range(1, 7)
|
||||
call assert_equal('', histget(a:hist, i))
|
||||
call assert_equal('', histget(a:hist, i - 7 - 1))
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function Test_History()
|
||||
for h in ['cmd', ':', '', 'search', '/', '?', 'expr', '=', 'input', '@', 'debug', '>']
|
||||
call History_Tests(h)
|
||||
endfor
|
||||
|
||||
" Negative tests
|
||||
call assert_false(histdel('abc'))
|
||||
call assert_equal('', histget('abc'))
|
||||
call assert_fails('call histdel([])', 'E730:')
|
||||
call assert_equal('', histget(10))
|
||||
call assert_fails('call histget([])', 'E730:')
|
||||
call assert_equal(-1, histnr('abc'))
|
||||
call assert_fails('call histnr([])', 'E730:')
|
||||
endfunction
|
||||
@@ -0,0 +1,13 @@
|
||||
" Test for joining lines.
|
||||
|
||||
func Test_join_with_count()
|
||||
new
|
||||
call setline(1, ['one', 'two', 'three', 'four'])
|
||||
normal J
|
||||
call assert_equal('one two', getline(1))
|
||||
%del
|
||||
call setline(1, ['one', 'two', 'three', 'four'])
|
||||
normal 10J
|
||||
call assert_equal('one two three four', getline(1))
|
||||
quit!
|
||||
endfunc
|
||||
@@ -0,0 +1,183 @@
|
||||
" Tests for 'packpath' and :packadd
|
||||
|
||||
func SetUp()
|
||||
let s:topdir = expand('%:h') . '/Xdir'
|
||||
exe 'set packpath=' . s:topdir
|
||||
let s:plugdir = s:topdir . '/pack/mine/opt/mytest'
|
||||
endfunc
|
||||
|
||||
func TearDown()
|
||||
call delete(s:topdir, 'rf')
|
||||
endfunc
|
||||
|
||||
func Test_packadd()
|
||||
call mkdir(s:plugdir . '/plugin', 'p')
|
||||
call mkdir(s:plugdir . '/ftdetect', 'p')
|
||||
set rtp&
|
||||
let rtp = &rtp
|
||||
filetype on
|
||||
|
||||
exe 'split ' . s:plugdir . '/plugin/test.vim'
|
||||
call setline(1, 'let g:plugin_works = 42')
|
||||
wq
|
||||
|
||||
exe 'split ' . s:plugdir . '/ftdetect/test.vim'
|
||||
call setline(1, 'let g:ftdetect_works = 17')
|
||||
wq
|
||||
|
||||
packadd mytest
|
||||
|
||||
call assert_equal(42, g:plugin_works)
|
||||
call assert_equal(17, g:ftdetect_works)
|
||||
call assert_true(len(&rtp) > len(rtp))
|
||||
call assert_true(&rtp =~ 'testdir/Xdir/pack/mine/opt/mytest\($\|,\)')
|
||||
|
||||
" Check exception
|
||||
call assert_fails("packadd directorynotfound", 'E919:')
|
||||
call assert_fails("packadd", 'E471:')
|
||||
endfunc
|
||||
|
||||
func Test_packadd_noload()
|
||||
call mkdir(s:plugdir . '/plugin', 'p')
|
||||
call mkdir(s:plugdir . '/syntax', 'p')
|
||||
set rtp&
|
||||
let rtp = &rtp
|
||||
|
||||
exe 'split ' . s:plugdir . '/plugin/test.vim'
|
||||
call setline(1, 'let g:plugin_works = 42')
|
||||
wq
|
||||
let g:plugin_works = 0
|
||||
|
||||
packadd! mytest
|
||||
|
||||
call assert_true(len(&rtp) > len(rtp))
|
||||
call assert_true(&rtp =~ 'testdir/Xdir/pack/mine/opt/mytest\($\|,\)')
|
||||
call assert_equal(0, g:plugin_works)
|
||||
|
||||
" check the path is not added twice
|
||||
let new_rtp = &rtp
|
||||
packadd! mytest
|
||||
call assert_equal(new_rtp, &rtp)
|
||||
endfunc
|
||||
|
||||
" Check command-line completion for 'packadd'
|
||||
func Test_packadd_completion()
|
||||
let optdir1 = &packpath . '/pack/mine/opt'
|
||||
let optdir2 = &packpath . '/pack/candidate/opt'
|
||||
|
||||
call mkdir(optdir1 . '/pluginA', 'p')
|
||||
call mkdir(optdir1 . '/pluginC', 'p')
|
||||
call mkdir(optdir2 . '/pluginB', 'p')
|
||||
call mkdir(optdir2 . '/pluginC', 'p')
|
||||
|
||||
let li = []
|
||||
call feedkeys(":packadd \<Tab>')\<C-B>call add(li, '\<CR>", 't')
|
||||
call feedkeys(":packadd " . repeat("\<Tab>", 2) . "')\<C-B>call add(li, '\<CR>", 't')
|
||||
call feedkeys(":packadd " . repeat("\<Tab>", 3) . "')\<C-B>call add(li, '\<CR>", 't')
|
||||
call feedkeys(":packadd " . repeat("\<Tab>", 4) . "')\<C-B>call add(li, '\<CR>", 'tx')
|
||||
call assert_equal("packadd pluginA", li[0])
|
||||
call assert_equal("packadd pluginB", li[1])
|
||||
call assert_equal("packadd pluginC", li[2])
|
||||
call assert_equal("packadd ", li[3])
|
||||
endfunc
|
||||
|
||||
func Test_packloadall()
|
||||
let plugindir = &packpath . '/pack/mine/start/foo/plugin'
|
||||
call mkdir(plugindir, 'p')
|
||||
call writefile(['let g:plugin_foo_number = 1234'], plugindir . '/bar.vim')
|
||||
packloadall
|
||||
call assert_equal(1234, g:plugin_foo_number)
|
||||
|
||||
" only works once
|
||||
call writefile(['let g:plugin_bar_number = 4321'], plugindir . '/bar2.vim')
|
||||
packloadall
|
||||
call assert_false(exists('g:plugin_bar_number'))
|
||||
|
||||
" works when ! used
|
||||
packloadall!
|
||||
call assert_equal(4321, g:plugin_bar_number)
|
||||
endfunc
|
||||
|
||||
func Test_helptags()
|
||||
let docdir1 = &packpath . '/pack/mine/start/foo/doc'
|
||||
let docdir2 = &packpath . '/pack/mine/start/bar/doc'
|
||||
call mkdir(docdir1, 'p')
|
||||
call mkdir(docdir2, 'p')
|
||||
call writefile(['look here: *look-here*'], docdir1 . '/bar.txt')
|
||||
call writefile(['look away: *look-away*'], docdir2 . '/foo.txt')
|
||||
exe 'set rtp=' . &packpath . '/pack/mine/start/foo,' . &packpath . '/pack/mine/start/bar'
|
||||
|
||||
helptags ALL
|
||||
|
||||
let tags1 = readfile(docdir1 . '/tags')
|
||||
call assert_true(tags1[0] =~ 'look-here')
|
||||
let tags2 = readfile(docdir2 . '/tags')
|
||||
call assert_true(tags2[0] =~ 'look-away')
|
||||
endfunc
|
||||
|
||||
func Test_colorscheme()
|
||||
let colordirrun = &packpath . '/runtime/colors'
|
||||
let colordirstart = &packpath . '/pack/mine/start/foo/colors'
|
||||
let colordiropt = &packpath . '/pack/mine/opt/bar/colors'
|
||||
call mkdir(colordirrun, 'p')
|
||||
call mkdir(colordirstart, 'p')
|
||||
call mkdir(colordiropt, 'p')
|
||||
call writefile(['let g:found_one = 1'], colordirrun . '/one.vim')
|
||||
call writefile(['let g:found_two = 1'], colordirstart . '/two.vim')
|
||||
call writefile(['let g:found_three = 1'], colordiropt . '/three.vim')
|
||||
exe 'set rtp=' . &packpath . '/runtime'
|
||||
|
||||
colorscheme one
|
||||
call assert_equal(1, g:found_one)
|
||||
colorscheme two
|
||||
call assert_equal(1, g:found_two)
|
||||
colorscheme three
|
||||
call assert_equal(1, g:found_three)
|
||||
endfunc
|
||||
|
||||
func Test_runtime()
|
||||
let rundir = &packpath . '/runtime/extra'
|
||||
let startdir = &packpath . '/pack/mine/start/foo/extra'
|
||||
let optdir = &packpath . '/pack/mine/opt/bar/extra'
|
||||
call mkdir(rundir, 'p')
|
||||
call mkdir(startdir, 'p')
|
||||
call mkdir(optdir, 'p')
|
||||
call writefile(['let g:sequence .= "run"'], rundir . '/bar.vim')
|
||||
call writefile(['let g:sequence .= "start"'], startdir . '/bar.vim')
|
||||
call writefile(['let g:sequence .= "foostart"'], startdir . '/foo.vim')
|
||||
call writefile(['let g:sequence .= "opt"'], optdir . '/bar.vim')
|
||||
call writefile(['let g:sequence .= "xxxopt"'], optdir . '/xxx.vim')
|
||||
exe 'set rtp=' . &packpath . '/runtime'
|
||||
|
||||
let g:sequence = ''
|
||||
runtime extra/bar.vim
|
||||
call assert_equal('run', g:sequence)
|
||||
let g:sequence = ''
|
||||
runtime START extra/bar.vim
|
||||
call assert_equal('start', g:sequence)
|
||||
let g:sequence = ''
|
||||
runtime OPT extra/bar.vim
|
||||
call assert_equal('opt', g:sequence)
|
||||
let g:sequence = ''
|
||||
runtime PACK extra/bar.vim
|
||||
call assert_equal('start', g:sequence)
|
||||
let g:sequence = ''
|
||||
runtime! PACK extra/bar.vim
|
||||
call assert_equal('startopt', g:sequence)
|
||||
let g:sequence = ''
|
||||
runtime PACK extra/xxx.vim
|
||||
call assert_equal('xxxopt', g:sequence)
|
||||
|
||||
let g:sequence = ''
|
||||
runtime ALL extra/bar.vim
|
||||
call assert_equal('run', g:sequence)
|
||||
let g:sequence = ''
|
||||
runtime ALL extra/foo.vim
|
||||
call assert_equal('foostart', g:sequence)
|
||||
let g:sequence = ''
|
||||
runtime! ALL extra/xxx.vim
|
||||
call assert_equal('xxxopt', g:sequence)
|
||||
let g:sequence = ''
|
||||
runtime! ALL extra/bar.vim
|
||||
call assert_equal('runstartopt', g:sequence)
|
||||
endfunc
|
||||
@@ -0,0 +1,35 @@
|
||||
" Test syntax highlighting functions.
|
||||
|
||||
func Test_missing_attr()
|
||||
hi Mine term=bold cterm=italic
|
||||
call assert_equal('Mine', synIDattr(hlID("Mine"), "name"))
|
||||
call assert_equal('', synIDattr(hlID("Mine"), "bg", 'term'))
|
||||
call assert_equal('1', synIDattr(hlID("Mine"), "bold", 'term'))
|
||||
call assert_equal('1', synIDattr(hlID("Mine"), "italic", 'cterm'))
|
||||
hi Mine term=reverse cterm=inverse
|
||||
call assert_equal('1', synIDattr(hlID("Mine"), "reverse", 'term'))
|
||||
call assert_equal('1', synIDattr(hlID("Mine"), "inverse", 'cterm'))
|
||||
hi Mine term=underline cterm=standout gui=undercurl
|
||||
call assert_equal('1', synIDattr(hlID("Mine"), "underline", 'term'))
|
||||
call assert_equal('1', synIDattr(hlID("Mine"), "standout", 'cterm'))
|
||||
call assert_equal('1', synIDattr(hlID("Mine"), "undercurl", 'gui'))
|
||||
hi Mine term=NONE cterm=NONE gui=NONE
|
||||
call assert_equal('', synIDattr(hlID("Mine"), "bold", 'term'))
|
||||
call assert_equal('', synIDattr(hlID("Mine"), "italic", 'cterm'))
|
||||
call assert_equal('', synIDattr(hlID("Mine"), "reverse", 'term'))
|
||||
call assert_equal('', synIDattr(hlID("Mine"), "inverse", 'cterm'))
|
||||
call assert_equal('', synIDattr(hlID("Mine"), "underline", 'term'))
|
||||
call assert_equal('', synIDattr(hlID("Mine"), "standout", 'cterm'))
|
||||
call assert_equal('', synIDattr(hlID("Mine"), "undercurl", 'gui'))
|
||||
|
||||
if has('gui')
|
||||
let fontname = getfontname()
|
||||
if fontname == ''
|
||||
let fontname = 'something'
|
||||
endif
|
||||
exe 'hi Mine guifg=blue guibg=red font=' . escape(fontname, ' \')
|
||||
call assert_equal('blue', synIDattr(hlID("Mine"), "fg", 'gui'))
|
||||
call assert_equal('red', synIDattr(hlID("Mine"), "bg", 'gui'))
|
||||
call assert_equal(fontname, synIDattr(hlID("Mine"), "font", 'gui'))
|
||||
endif
|
||||
endfunc
|
||||
@@ -0,0 +1,19 @@
|
||||
" Tests for Visual mode
|
||||
if !has('multi_byte')
|
||||
finish
|
||||
endif
|
||||
set encoding=utf-8
|
||||
scriptencoding utf-8
|
||||
|
||||
if !has('visual')
|
||||
finish
|
||||
endif
|
||||
|
||||
func Test_block_shift_multibyte()
|
||||
split
|
||||
call setline(1, ['xヹxxx', 'ヹxxx'])
|
||||
exe "normal 1G0l\<C-V>jl>"
|
||||
call assert_equal('x ヹxxx', getline(1))
|
||||
call assert_equal(' ヹxxx', getline(2))
|
||||
q!
|
||||
endfunc
|
||||
@@ -1551,7 +1551,7 @@ clip_gen_owner_exists(VimClipboard *cbd UNUSED)
|
||||
* descriptions which would otherwise overflow. The buffer is considered full
|
||||
* when only this extra space (or part of it) remains.
|
||||
*/
|
||||
#if defined(FEAT_SUN_WORKSHOP) || defined(FEAT_CHANNEL) \
|
||||
#if defined(FEAT_SUN_WORKSHOP) || defined(FEAT_JOB_CHANNEL) \
|
||||
|| defined(FEAT_CLIENTSERVER)
|
||||
/*
|
||||
* Sun WorkShop and NetBeans stuff debugger commands into the input buffer.
|
||||
@@ -1706,16 +1706,24 @@ add_to_input_buf_csi(char_u *str, int len)
|
||||
push_raw_key(char_u *s, int len)
|
||||
{
|
||||
char_u *tmpbuf;
|
||||
char_u *inp = s;
|
||||
|
||||
/* use the conversion result if possible */
|
||||
tmpbuf = hangul_string_convert(s, &len);
|
||||
if (tmpbuf != NULL)
|
||||
s = tmpbuf;
|
||||
inp = tmpbuf;
|
||||
|
||||
while (len--)
|
||||
inbuf[inbufcount++] = *s++;
|
||||
|
||||
if (tmpbuf != NULL)
|
||||
vim_free(tmpbuf);
|
||||
for (; len--; inp++)
|
||||
{
|
||||
inbuf[inbufcount++] = *inp;
|
||||
if (*inp == CSI)
|
||||
{
|
||||
/* Turn CSI into K_CSI. */
|
||||
inbuf[inbufcount++] = KS_EXTRA;
|
||||
inbuf[inbufcount++] = (int)KE_CSI;
|
||||
}
|
||||
}
|
||||
vim_free(tmpbuf);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+172
-2
@@ -106,7 +106,7 @@ static char *(features[]) =
|
||||
#else
|
||||
"-byte_offset",
|
||||
#endif
|
||||
#ifdef FEAT_CHANNEL
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
"+channel",
|
||||
#else
|
||||
"-channel",
|
||||
@@ -294,7 +294,7 @@ static char *(features[]) =
|
||||
#else
|
||||
"-insert_expand",
|
||||
#endif
|
||||
#ifdef FEAT_JOB
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
"+job",
|
||||
#else
|
||||
"-job",
|
||||
@@ -758,6 +758,176 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1553,
|
||||
/**/
|
||||
1552,
|
||||
/**/
|
||||
1551,
|
||||
/**/
|
||||
1550,
|
||||
/**/
|
||||
1549,
|
||||
/**/
|
||||
1548,
|
||||
/**/
|
||||
1547,
|
||||
/**/
|
||||
1546,
|
||||
/**/
|
||||
1545,
|
||||
/**/
|
||||
1544,
|
||||
/**/
|
||||
1543,
|
||||
/**/
|
||||
1542,
|
||||
/**/
|
||||
1541,
|
||||
/**/
|
||||
1540,
|
||||
/**/
|
||||
1539,
|
||||
/**/
|
||||
1538,
|
||||
/**/
|
||||
1537,
|
||||
/**/
|
||||
1536,
|
||||
/**/
|
||||
1535,
|
||||
/**/
|
||||
1534,
|
||||
/**/
|
||||
1533,
|
||||
/**/
|
||||
1532,
|
||||
/**/
|
||||
1531,
|
||||
/**/
|
||||
1530,
|
||||
/**/
|
||||
1529,
|
||||
/**/
|
||||
1528,
|
||||
/**/
|
||||
1527,
|
||||
/**/
|
||||
1526,
|
||||
/**/
|
||||
1525,
|
||||
/**/
|
||||
1524,
|
||||
/**/
|
||||
1523,
|
||||
/**/
|
||||
1522,
|
||||
/**/
|
||||
1521,
|
||||
/**/
|
||||
1520,
|
||||
/**/
|
||||
1519,
|
||||
/**/
|
||||
1518,
|
||||
/**/
|
||||
1517,
|
||||
/**/
|
||||
1516,
|
||||
/**/
|
||||
1515,
|
||||
/**/
|
||||
1514,
|
||||
/**/
|
||||
1513,
|
||||
/**/
|
||||
1512,
|
||||
/**/
|
||||
1511,
|
||||
/**/
|
||||
1510,
|
||||
/**/
|
||||
1509,
|
||||
/**/
|
||||
1508,
|
||||
/**/
|
||||
1507,
|
||||
/**/
|
||||
1506,
|
||||
/**/
|
||||
1505,
|
||||
/**/
|
||||
1504,
|
||||
/**/
|
||||
1503,
|
||||
/**/
|
||||
1502,
|
||||
/**/
|
||||
1501,
|
||||
/**/
|
||||
1500,
|
||||
/**/
|
||||
1499,
|
||||
/**/
|
||||
1498,
|
||||
/**/
|
||||
1497,
|
||||
/**/
|
||||
1496,
|
||||
/**/
|
||||
1495,
|
||||
/**/
|
||||
1494,
|
||||
/**/
|
||||
1493,
|
||||
/**/
|
||||
1492,
|
||||
/**/
|
||||
1491,
|
||||
/**/
|
||||
1490,
|
||||
/**/
|
||||
1489,
|
||||
/**/
|
||||
1488,
|
||||
/**/
|
||||
1487,
|
||||
/**/
|
||||
1486,
|
||||
/**/
|
||||
1485,
|
||||
/**/
|
||||
1484,
|
||||
/**/
|
||||
1483,
|
||||
/**/
|
||||
1482,
|
||||
/**/
|
||||
1481,
|
||||
/**/
|
||||
1480,
|
||||
/**/
|
||||
1479,
|
||||
/**/
|
||||
1478,
|
||||
/**/
|
||||
1477,
|
||||
/**/
|
||||
1476,
|
||||
/**/
|
||||
1475,
|
||||
/**/
|
||||
1474,
|
||||
/**/
|
||||
1473,
|
||||
/**/
|
||||
1472,
|
||||
/**/
|
||||
1471,
|
||||
/**/
|
||||
1470,
|
||||
/**/
|
||||
1469,
|
||||
/**/
|
||||
1468,
|
||||
/**/
|
||||
|
||||
@@ -759,7 +759,8 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname);
|
||||
#define EXPAND_USER 42
|
||||
#define EXPAND_SYNTIME 43
|
||||
#define EXPAND_USER_ADDR_TYPE 44
|
||||
#define EXPAND_MACACTION 45
|
||||
#define EXPAND_PACKADD 45
|
||||
#define EXPAND_MACACTION 46
|
||||
|
||||
/* Values for exmode_active (0 is no exmode) */
|
||||
#define EXMODE_NORMAL 1
|
||||
@@ -2275,7 +2276,7 @@ typedef int VimClipboard; /* This is required for the prototypes. */
|
||||
# define SET_NO_HLSEARCH(flag) no_hlsearch = (flag)
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_CHANNEL
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
# define MAX_OPEN_CHANNELS 10
|
||||
#else
|
||||
# define MAX_OPEN_CHANNELS 0
|
||||
@@ -2290,4 +2291,12 @@ typedef int VimClipboard; /* This is required for the prototypes. */
|
||||
int vim_main2(int argc, char **argv);
|
||||
#endif
|
||||
|
||||
/* Used for flags of do_in_path() */
|
||||
#define DIP_ALL 0x01 /* all matches, not just the first one */
|
||||
#define DIP_DIR 0x02 /* find directories instead of files. */
|
||||
#define DIP_ERR 0x04 /* give an error message when none found. */
|
||||
#define DIP_START 0x08 /* also use "start" directory in 'packpath' */
|
||||
#define DIP_OPT 0x10 /* also use "opt" directory in 'packpath' */
|
||||
#define DIP_NORTP 0x20 /* do not use 'runtimepath' */
|
||||
|
||||
#endif /* VIM__H */
|
||||
|
||||
+2
-2
@@ -3901,8 +3901,8 @@ leave_tabpage(
|
||||
enter_tabpage(
|
||||
tabpage_T *tp,
|
||||
buf_T *old_curbuf UNUSED,
|
||||
int trigger_enter_autocmds UNUSED,
|
||||
int trigger_leave_autocmds UNUSED)
|
||||
int trigger_enter_autocmds,
|
||||
int trigger_leave_autocmds)
|
||||
{
|
||||
int old_off = tp->tp_firstwin->w_winrow;
|
||||
win_T *next_prevwin = tp->tp_prevwin;
|
||||
|
||||
Reference in New Issue
Block a user