mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-02 11:19:22 +02:00
Compare commits
64 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 79f8f407af | |||
| 04a4b41111 | |||
| 0921ecff1c | |||
| e185c1efba | |||
| 7c1c6dbb68 | |||
| 3dda7db4e1 | |||
| b50e5f5686 | |||
| 4afc7c5d4a | |||
| f9f22dbe4f | |||
| 22e421549d | |||
| 0e954ac375 | |||
| 71fb0c146b | |||
| 298c65971e | |||
| cb0700844c | |||
| fd773e9e88 | |||
| 8bc189e81a | |||
| f28d871465 | |||
| 8e77bad3c1 | |||
| 864733ad92 | |||
| 9bd547aca4 | |||
| cef9e23dd7 | |||
| b681be175b | |||
| 42356150ba | |||
| 4005cc7a59 | |||
| 758535a1df | |||
| 67c2c058ea | |||
| bdf0bda968 | |||
| e9c0727003 | |||
| 4d59b3cc54 | |||
| 7db8f6f4f8 | |||
| 7fed5c18f8 | |||
| d18cfb7dbf | |||
| e6f9c446ac | |||
| e609ad557c | |||
| 72188e9aae | |||
| ef9d9b94a8 | |||
| 925ccfde79 | |||
| 7d2a5796d3 | |||
| 8b29aba019 | |||
| 0b9e4d1224 | |||
| fead3ac9a3 | |||
| e101204906 | |||
| cf2d8dee51 | |||
| 2946d0236d | |||
| e934e8f5c1 | |||
| 61264d9969 | |||
| a32095fc8f | |||
| 8b877ac38e | |||
| ee1f7b3cb7 | |||
| 84e1d2b21a | |||
| 46c00a6565 | |||
| 1e35e3ee83 | |||
| 8038568722 | |||
| 89c64d557d | |||
| ea6553bec3 | |||
| 312c0326e5 | |||
| 4f3f668c84 | |||
| c4dcd60c76 | |||
| fa8b2e173d | |||
| 819821c5a9 | |||
| e1581307d2 | |||
| 1473551a44 | |||
| 8fdd721047 | |||
| 92e35efaf6 |
@@ -78,6 +78,7 @@ src/testdir/dostmp/*
|
||||
src/testdir/messages
|
||||
src/testdir/viminfo
|
||||
src/memfile_test
|
||||
src/json_test
|
||||
|
||||
# From MacVim
|
||||
.*.swp
|
||||
|
||||
@@ -483,7 +483,6 @@ RT_ALL = \
|
||||
runtime/ftoff.vim \
|
||||
runtime/gvimrc_example.vim \
|
||||
runtime/macros/README.txt \
|
||||
runtime/macros/dvorak \
|
||||
runtime/macros/editexisting.vim \
|
||||
runtime/macros/hanoi/click.me \
|
||||
runtime/macros/hanoi/hanoi.vim \
|
||||
@@ -524,9 +523,16 @@ RT_ALL = \
|
||||
runtime/tutor/tutor \
|
||||
runtime/tutor/tutor.vim \
|
||||
runtime/vimrc_example.vim \
|
||||
runtime/pack/dist/opt/dvorak/plugin/dvorak.vim \
|
||||
runtime/pack/dist/opt/dvorak/dvorak/enable.vim \
|
||||
runtime/pack/dist/opt/dvorak/dvorak/disable.vim \
|
||||
runtime/pack/dist/opt/editexisting/plugin/editexisting.vim \
|
||||
runtime/pack/dist/opt/justify/plugin/justify.vim \
|
||||
runtime/pack/dist/opt/matchit/plugin/matchit.vim \
|
||||
runtime/pack/dist/opt/matchit/doc/matchit.txt \
|
||||
runtime/pack/dist/opt/matchit/doc/tags \
|
||||
runtime/pack/dist/opt/shellmenu/plugin/shellmenu.vim \
|
||||
runtime/pack/dist/opt/swapmouse/plugin/swapmouse.vim \
|
||||
|
||||
# runtime files for all distributions without CR-NL translation
|
||||
RT_ALL_BIN = \
|
||||
|
||||
@@ -7,21 +7,23 @@
|
||||
|
||||
## What is Vim? ##
|
||||
|
||||
Vim is an almost compatible version of the UNIX editor Vi. Many new features
|
||||
have been added: multi-level undo, syntax highlighting, command line history,
|
||||
on-line help, spell checking, filename completion, block operations, etc.
|
||||
There is also a Graphical User Interface (GUI) available. See
|
||||
`runtime/doc/vi_diff.txt` for differences with Vi.
|
||||
Vim is a greatly improved version of the good old UNIX editor Vi. Many new
|
||||
features have been added: multi-level undo, syntax highlighting, command line
|
||||
history, on-line help, spell checking, filename completion, block operations,
|
||||
script language, etc. There is also a Graphical User Interface (GUI)
|
||||
available. Still, Vi compatibility is maintained, those who have Vi "in the
|
||||
fingers" will feel at home. See `runtime/doc/vi_diff.txt` for differences with
|
||||
Vi.
|
||||
|
||||
This editor is very useful for editing programs and other plain text files.
|
||||
All commands are given with normal keyboard characters, so those who can type
|
||||
with ten fingers can work very fast. Additionally, function keys can be
|
||||
defined by the user, and the mouse can be used.
|
||||
mapped to commands by the user, and the mouse can be used.
|
||||
|
||||
Vim runs under MS-DOS, MS-Windows (NT, 2000, XP, Vista, 7, 8, 10), Macintosh,
|
||||
VMS and almost all flavours of UNIX. Porting to other systems should not be
|
||||
very difficult. Older versions of Vim run on MS-Windows 95/98/Me, Amiga DOS,
|
||||
Atari MiNT, BeOS, RISC OS and OS/2. These are no longer maintained.
|
||||
Vim runs under MS-Windows (NT, 2000, XP, Vista, 7, 8, 10), Macintosh, VMS and
|
||||
almost all flavours of UNIX. Porting to other systems should not be very
|
||||
difficult. Older versions of Vim run on MS-DOS, MS-Windows 95/98/Me, Amiga
|
||||
DOS, Atari MiNT, BeOS, RISC OS and OS/2. These are no longer maintained.
|
||||
|
||||
|
||||
## Distribution ##
|
||||
@@ -39,9 +41,31 @@ want or must compile it yourself. Check http://www.vim.org/download.php for
|
||||
an overview of currently available distributions.
|
||||
|
||||
|
||||
## Compiling ##
|
||||
|
||||
If you obtained a binary distribution you don't need to compile Vim. If you
|
||||
obtained a source distribution, all the stuff for compiling Vim is in the
|
||||
`src` directory. See `src/INSTALL` for instructions.
|
||||
|
||||
|
||||
## Installation ##
|
||||
|
||||
See one of these files for system-specific instructions. Either in the
|
||||
READMEdir directory (in the repository) or the top directory (if you unpack an
|
||||
archive):
|
||||
|
||||
README_ami.txt Amiga
|
||||
README_unix.txt Unix
|
||||
README_dos.txt MS-DOS and MS-Windows
|
||||
README_mac.txt Macintosh
|
||||
README_vms.txt VMS
|
||||
|
||||
There are other `README_*.txt` files, depending on the distribution you used.
|
||||
|
||||
|
||||
## Documentation ##
|
||||
|
||||
The vim tutor is a one hour training course for beginners. Mostly it can be
|
||||
The Vim tutor is a one hour training course for beginners. Often it can be
|
||||
started as `vimtutor`. See `:help tutor` for more information.
|
||||
|
||||
The best is to use `:help` in Vim. If you don't have an executable yet, read
|
||||
@@ -77,26 +101,6 @@ For the most recent information about sponsoring look on the Vim web site:
|
||||
http://www.vim.org/sponsor/
|
||||
|
||||
|
||||
## Compiling ##
|
||||
|
||||
If you obtained a binary distribution you don't need to compile Vim. If you
|
||||
obtained a source distribution, all the stuff for compiling Vim is in the
|
||||
`src` directory. See `src/INSTALL` for instructions.
|
||||
|
||||
|
||||
## Installation ##
|
||||
|
||||
See one of these files for system-specific instructions:
|
||||
|
||||
README_ami.txt Amiga
|
||||
README_unix.txt Unix
|
||||
README_dos.txt MS-DOS and MS-Windows
|
||||
README_mac.txt Macintosh
|
||||
README_vms.txt VMS
|
||||
|
||||
There are more `README_*.txt` files, depending on the distribution you used.
|
||||
|
||||
|
||||
## Contributing ##
|
||||
|
||||
If you would like to help making Vim better, see the [CONTRIBUTING.md](https://github.com/vim/vim/blob/master/CONTRIBUTING.md) file.
|
||||
|
||||
+37
-27
@@ -3,21 +3,23 @@ README.txt for version 7.4 of Vim: Vi IMproved.
|
||||
|
||||
WHAT IS VIM?
|
||||
|
||||
Vim is an almost compatible version of the UNIX editor Vi. Many new features
|
||||
have been added: multi-level undo, syntax highlighting, command line history,
|
||||
on-line help, spell checking, filename completion, block operations, etc.
|
||||
There is also a Graphical User Interface (GUI) available. See
|
||||
"runtime/doc/vi_diff.txt" for differences with Vi.
|
||||
Vim is a greatly improved version of the good old UNIX editor Vi. Many new
|
||||
features have been added: multi-level undo, syntax highlighting, command line
|
||||
history, on-line help, spell checking, filename completion, block operations,
|
||||
script language, etc. There is also a Graphical User Interface (GUI)
|
||||
available. Still, Vi compatibility is maintained, those who have Vi "in the
|
||||
fingers" will feel at home. See "runtime/doc/vi_diff.txt" for differences with
|
||||
Vi.
|
||||
|
||||
This editor is very useful for editing programs and other plain text files.
|
||||
All commands are given with normal keyboard characters, so those who can type
|
||||
with ten fingers can work very fast. Additionally, function keys can be
|
||||
defined by the user, and the mouse can be used.
|
||||
mapped to commands by the user, and the mouse can be used.
|
||||
|
||||
Vim runs under MS-DOS, MS-Windows (NT, 2000, XP, Vista, 7, 8, 10), Macintosh,
|
||||
VMS and almost all flavours of UNIX. Porting to other systems should not be
|
||||
very difficult. Older versions of Vim run on MS-Windows 95/98/Me, Amiga DOS,
|
||||
Atari MiNT, BeOS, RISC OS and OS/2. These are no longer maintained.
|
||||
Vim runs under MS-Windows (NT, 2000, XP, Vista, 7, 8, 10), Macintosh, VMS and
|
||||
almost all flavours of UNIX. Porting to other systems should not be very
|
||||
difficult. Older versions of Vim run on MS-DOS, MS-Windows 95/98/Me, Amiga
|
||||
DOS, Atari MiNT, BeOS, RISC OS and OS/2. These are no longer maintained.
|
||||
|
||||
|
||||
DISTRIBUTION
|
||||
@@ -35,9 +37,31 @@ want or must compile it yourself. Check "http://www.vim.org/download.php" for
|
||||
an overview of currently available distributions.
|
||||
|
||||
|
||||
COMPILING
|
||||
|
||||
If you obtained a binary distribution you don't need to compile Vim. If you
|
||||
obtained a source distribution, all the stuff for compiling Vim is in the
|
||||
"src" directory. See src/INSTALL for instructions.
|
||||
|
||||
|
||||
INSTALLATION
|
||||
|
||||
See one of these files for system-specific instructions. Either in the
|
||||
READMEdir directory (in the repository) or the top directory (if you unpack an
|
||||
archive):
|
||||
|
||||
README_ami.txt Amiga
|
||||
README_unix.txt Unix
|
||||
README_dos.txt MS-DOS and MS-Windows
|
||||
README_mac.txt Macintosh
|
||||
README_vms.txt VMS
|
||||
|
||||
There are more README_*.txt files, depending on the distribution you used.
|
||||
|
||||
|
||||
DOCUMENTATION
|
||||
|
||||
The vim tutor is a one hour training course for beginners. Mostly it can be
|
||||
The Vim tutor is a one hour training course for beginners. Often it can be
|
||||
started as "vimtutor". See ":help tutor" for more information.
|
||||
|
||||
The best is to use ":help" in Vim. If you don't have an executable yet, read
|
||||
@@ -74,23 +98,9 @@ For the most recent information about sponsoring look on the Vim web site:
|
||||
http://www.vim.org/sponsor/
|
||||
|
||||
|
||||
COMPILING
|
||||
CONTRIBUTING
|
||||
|
||||
If you obtained a binary distribution you don't need to compile Vim. If you
|
||||
obtained a source distribution, all the stuff for compiling Vim is in the
|
||||
"src" directory. See src/INSTALL for instructions.
|
||||
|
||||
|
||||
INSTALLATION
|
||||
|
||||
See one of these files for system-specific instructions:
|
||||
README_ami.txt Amiga
|
||||
README_unix.txt Unix
|
||||
README_dos.txt MS-DOS and MS-Windows
|
||||
README_mac.txt Macintosh
|
||||
README_vms.txt VMS
|
||||
|
||||
There are more README_*.txt files, depending on the distribution you used.
|
||||
If you would like to help making Vim better, see the CONTRIBUTING.md file.
|
||||
|
||||
|
||||
INFORMATION
|
||||
|
||||
+10
-2
@@ -1,4 +1,4 @@
|
||||
*autocmd.txt* For Vim version 7.4. Last change: 2015 Dec 05
|
||||
*autocmd.txt* For Vim version 7.4. Last change: 2016 Mar 26
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -918,7 +918,15 @@ VimEnter After doing all the startup stuff, including
|
||||
loading .vimrc files, executing the "-c cmd"
|
||||
arguments, creating all windows and loading
|
||||
the buffers in them.
|
||||
*VimLeave*
|
||||
Just before this event is triggered the
|
||||
|v:vim_did_enter| variable is set, so that you
|
||||
can do: >
|
||||
if v:vim_did_enter
|
||||
call s:init()
|
||||
else
|
||||
au VimEnter * call s:init()
|
||||
endif
|
||||
< *VimLeave*
|
||||
VimLeave Before exiting Vim, just after writing the
|
||||
.viminfo file. Executed only once, like
|
||||
VimLeavePre.
|
||||
|
||||
+66
-34
@@ -1,4 +1,4 @@
|
||||
*channel.txt* For Vim version 7.4. Last change: 2016 Mar 15
|
||||
*channel.txt* For Vim version 7.4. Last change: 2016 Mar 28
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -120,24 +120,13 @@ Use |ch_status()| to see if the channel could be opened.
|
||||
|
||||
{address} has the form "hostname:port". E.g., "localhost:8765".
|
||||
|
||||
{options} is a dictionary with optional entries:
|
||||
{options} is a dictionary with optional entries: *channel-open-options*
|
||||
|
||||
"mode" can be: *channel-mode*
|
||||
"json" - Use JSON, see below; most convenient way. Default.
|
||||
"js" - Use JS (JavaScript) encoding, more efficient than JSON.
|
||||
"nl" - Use messages that end in a NL character
|
||||
"raw" - Use raw messages
|
||||
*in_mode* *out_mode* *err_mode*
|
||||
"in_mode" mode specifically for stdin, only when using pipes
|
||||
"out_mode" mode specifically for stdout, only when using pipes
|
||||
"err_mode" mode specifically for stderr, only when using pipes
|
||||
Note: when setting "mode" the part specific mode is
|
||||
overwritten. Therefore set "mode" first and the part specific
|
||||
mode later.
|
||||
|
||||
Note: when writing to a file or buffer and when reading from a
|
||||
buffer NL mode is used by default.
|
||||
|
||||
*channel-callback* *E921*
|
||||
"callback" A function that is called when a message is received that is
|
||||
not handled otherwise. It gets two arguments: the channel
|
||||
@@ -155,16 +144,8 @@ Use |ch_status()| to see if the channel could be opened.
|
||||
as a string.
|
||||
|
||||
For all callbacks: Use |function()| to bind it to arguments
|
||||
and/or a dictionary.
|
||||
*out_cb*
|
||||
"out_cb" A function like "callback" but used for stdout. Only for when
|
||||
the channel uses pipes. When "out_cb" wasn't set the channel
|
||||
callback is used.
|
||||
*err_cb*
|
||||
"err_cb" A function like "callback" but used for stderr. Only for when
|
||||
the channel uses pipes. When "err_cb" wasn't set the channel
|
||||
callback is used.
|
||||
|
||||
and/or a Dictionary. Or use the form "dict.function" to bind
|
||||
the Dictionary.
|
||||
*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: >
|
||||
@@ -178,16 +159,10 @@ Use |ch_status()| to see if the channel could be opened.
|
||||
actually uses a 1 msec timeout, that is required on many
|
||||
systems. Use a larger value for a remote server, e.g. 10
|
||||
msec at least.
|
||||
|
||||
*channel-timeout*
|
||||
"timeout" The time to wait for a request when blocking, E.g. when using
|
||||
ch_evalexpr(). In milliseconds. The default is 2000 (2
|
||||
seconds).
|
||||
*out_timeout* *err_timeout*
|
||||
"out_timeout" Timeout for stdout. Only when using pipes.
|
||||
"err_timeout" Timeout for stderr. Only when using pipes.
|
||||
Note: when setting "timeout" the part specific mode is
|
||||
overwritten. Therefore set "timeout" first and the part
|
||||
specific mode later.
|
||||
|
||||
When "mode" is "json" or "js" the "callback" is optional. When omitted it is
|
||||
only possible to receive a message after sending one.
|
||||
@@ -215,6 +190,13 @@ pipes are used (stdin/stdout/stderr) they are all closed. This might not be
|
||||
what you want! Stopping the job with job_stop() might be better.
|
||||
All readahead is discarded, callbacks will no longer be invoked.
|
||||
|
||||
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".
|
||||
|
||||
When the channel can't be opened you will get an error message. There is a
|
||||
difference between MS-Windows and Unix: On Unix when the port doesn't exist
|
||||
ch_open() fails quickly. On MS-Windows "waittime" applies.
|
||||
@@ -326,6 +308,9 @@ completion or error. You could use functions in an |autoload| script:
|
||||
|
||||
You can also use "call |feedkeys()|" to insert any key sequence.
|
||||
|
||||
When there is an error a message is written to the channel log, if it exists,
|
||||
and v:errmsg is set to the error.
|
||||
|
||||
|
||||
Command "normal" ~
|
||||
|
||||
@@ -428,6 +413,23 @@ To read all output from a RAW channel that is available: >
|
||||
To read the error output: >
|
||||
let output = ch_readraw(channel, {"part": "err"})
|
||||
|
||||
ch_read() and ch_readraw() use the channel timeout. When there is nothing to
|
||||
read within that time an empty string is returned. To specify a different
|
||||
timeout in msec use the "timeout" option:
|
||||
{"timeout": 123} ~
|
||||
To read from the error output use the "part" option:
|
||||
{"part": "err"} ~
|
||||
To read a message with a specific ID, on a JS or JSON channel:
|
||||
{"id": 99} ~
|
||||
When no ID is specified or the ID is -1, the first message is returned. This
|
||||
overrules any callback waiting for this message.
|
||||
|
||||
For a RAW channel this returns whatever is available, since Vim does not know
|
||||
where a message ends.
|
||||
For a NL channel this returns one message.
|
||||
For a JS or JSON channel this returns one decoded message.
|
||||
This includes any sequence number.
|
||||
|
||||
==============================================================================
|
||||
8. Starting a job with a channel *job-start* *job*
|
||||
|
||||
@@ -524,15 +526,31 @@ job_setoptions(job, {options}). Many options can be used with the channel
|
||||
related to the job, using ch_setoptions(channel, {options}).
|
||||
See |job_setoptions()| and |ch_setoptions()|.
|
||||
|
||||
*in_mode* *out_mode* *err_mode*
|
||||
"in_mode" mode specifically for stdin, only when using pipes
|
||||
"out_mode" mode specifically for stdout, only when using pipes
|
||||
"err_mode" mode specifically for stderr, only when using pipes
|
||||
See |channel-mode| for the values.
|
||||
|
||||
Note: when setting "mode" the part specific mode is
|
||||
overwritten. Therefore set "mode" first and the part
|
||||
specific mode later.
|
||||
|
||||
Note: when writing to a file or buffer and when
|
||||
reading from a buffer NL mode is used by default.
|
||||
|
||||
*job-callback*
|
||||
"callback": handler Callback for something to read on any part of the
|
||||
channel.
|
||||
*job-out_cb*
|
||||
*job-out_cb* *out_cb*
|
||||
"out_cb": handler Callback for when there is something to read on
|
||||
stdout.
|
||||
*job-err_cb*
|
||||
stdout. Only for when the channel uses pipes. When
|
||||
"out_cb" wasn't set the channel callback is used.
|
||||
|
||||
*job-err_cb* *err_cb*
|
||||
"err_cb": handler Callback for when there is something to read on
|
||||
stderr.
|
||||
stderr. Only for when the channel uses pipes. When
|
||||
"err_cb" wasn't set the channel callback is used.
|
||||
*job-close_cb*
|
||||
"close_cb": handler Callback for when the channel is closed. Same as
|
||||
"close_cb" on ch_open().
|
||||
@@ -542,6 +560,17 @@ See |job_setoptions()| and |ch_setoptions()|.
|
||||
Vim checks about every 10 seconds for jobs that ended.
|
||||
The callback can also be triggered by calling
|
||||
|job_status()|.
|
||||
*job-timeout*
|
||||
"timeout" The time to wait for a request when blocking, E.g.
|
||||
when using ch_evalexpr(). In milliseconds. The
|
||||
default is 2000 (2 seconds).
|
||||
*out_timeout* *err_timeout*
|
||||
"out_timeout" Timeout for stdout. Only when using pipes.
|
||||
"err_timeout" Timeout for stderr. Only when using pipes.
|
||||
Note: when setting "timeout" the part specific mode is
|
||||
overwritten. Therefore set "timeout" first and the
|
||||
part specific mode later.
|
||||
|
||||
*job-stoponexit*
|
||||
"stoponexit": {signal} Send {signal} to the job when Vim exits. See
|
||||
|job_stop()| for possible values.
|
||||
@@ -587,6 +616,9 @@ See |job_setoptions()| and |ch_setoptions()|.
|
||||
"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
|
||||
|
||||
"block_write": number only for testing: pretend every other write to stdin
|
||||
will block
|
||||
|
||||
|
||||
Writing to a buffer ~
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*editing.txt* For Vim version 7.4. Last change: 2016 Feb 16
|
||||
*editing.txt* For Vim version 7.4. Last change: 2016 Mar 28
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -393,7 +393,7 @@ These are the common ones:
|
||||
To avoid the special meaning of the wildcards prepend a backslash. However,
|
||||
on MS-Windows the backslash is a path separator and "path\[abc]" is still seen
|
||||
as a wildcard when "[" is in the 'isfname' option. A simple way to avoid this
|
||||
is to use "path\[[]abc]". Then the file "path[abc]" literally.
|
||||
is to use "path\[[]abc]", this matches the file "path\[abc]".
|
||||
|
||||
*starstar-wildcard*
|
||||
Expanding "**" is possible on Unix, Win32, Mac OS/X and a few other systems.
|
||||
|
||||
+78
-53
@@ -1,4 +1,4 @@
|
||||
*eval.txt* For Vim version 7.4. Last change: 2016 Mar 20
|
||||
*eval.txt* For Vim version 7.4. Last change: 2016 Mar 29
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -1762,6 +1762,10 @@ v:version Version number of Vim: Major version number times 100 plus
|
||||
version 5.0 and 5.1 may have a patch 123, but these are
|
||||
completely different.
|
||||
|
||||
*v:vim_did_enter* *vim_did_enter-variable*
|
||||
v:vim_did_enter Zero until most of startup is done. It is set to one just
|
||||
before |VimEnter| autocommands are triggered.
|
||||
|
||||
*v:warningmsg* *warningmsg-variable*
|
||||
v:warningmsg Last given warning message. It's allowed to set this variable.
|
||||
|
||||
@@ -1797,10 +1801,13 @@ arglistid( [{winnr} [, {tabnr}]])
|
||||
Number argument list id
|
||||
argv( {nr}) String {nr} entry of the argument list
|
||||
argv() List the argument list
|
||||
assert_equal( {exp}, {act} [, {msg}]) none assert {exp} equals {act}
|
||||
assert_equal( {exp}, {act} [, {msg}]) none assert {exp} is equal to {act}
|
||||
assert_exception( {error} [, {msg}]) none assert {error} is in v:exception
|
||||
assert_fails( {cmd} [, {error}]) none assert {cmd} fails
|
||||
assert_false( {actual} [, {msg}]) none assert {actual} is false
|
||||
assert_match( {pat}, {text} [, {msg}]) none assert {pat} matches {text}
|
||||
assert_notequal( {exp}, {act} [, {msg}]) none assert {exp} is not equal {act}
|
||||
assert_notmatch( {pat}, {text} [, {msg}]) none assert {pat} not matches {text}
|
||||
assert_true( {actual} [, {msg}]) none assert {actual} is true
|
||||
asin( {expr}) Float arc sine of {expr}
|
||||
atan( {expr}) Float arc tangent of {expr}
|
||||
@@ -2015,6 +2022,8 @@ matchlist( {expr}, {pat}[, {start}[, {count}]])
|
||||
List match and submatches of {pat} in {expr}
|
||||
matchstr( {expr}, {pat}[, {start}[, {count}]])
|
||||
String {count}'th match of {pat} in {expr}
|
||||
matchstrpos( {expr}, {pat}[, {start}[, {count}]])
|
||||
List {count}'th match of {pat} in {expr}
|
||||
max( {list}) Number maximum value of items in {list}
|
||||
min( {list}) Number minimum value of items in {list}
|
||||
mkdir( {name} [, {path} [, {prot}]])
|
||||
@@ -2311,6 +2320,36 @@ assert_false({actual} [, {msg}]) *assert_false()*
|
||||
When {msg} is omitted an error in the form "Expected False but
|
||||
got {actual}" is produced.
|
||||
|
||||
*assert_match()*
|
||||
assert_match({pattern}, {actual} [, {msg}])
|
||||
When {pattern} does not match {actual} an error message is
|
||||
added to |v:errors|.
|
||||
|
||||
{pattern} is used as with |=~|: The matching is always done
|
||||
like 'magic' was set and 'cpoptions' is empty, no matter what
|
||||
the actual value of 'magic' or 'cpoptions' is.
|
||||
|
||||
{actual} is used as a string, automatic conversion applies.
|
||||
Use "^" and "$" to match with the start and end of the text.
|
||||
Use both to match the whole text.
|
||||
|
||||
When {msg} is omitted an error in the form "Pattern {pattern}
|
||||
does not match {actual}" is produced.
|
||||
Example: >
|
||||
assert_match('^f.*o$', 'foobar')
|
||||
< Will result in a string to be added to |v:errors|:
|
||||
test.vim line 12: Pattern '^f.*o$' does not match 'foobar' ~
|
||||
|
||||
*assert_notequal()*
|
||||
assert_notequal({expected}, {actual} [, {msg}])
|
||||
The opposite of `assert_equal()`: add an error message to
|
||||
|v:errors| when {expected} and {actual} are equal.
|
||||
|
||||
*assert_notmatch()*
|
||||
assert_notmatch({pattern}, {actual} [, {msg}])
|
||||
The opposite of `assert_match()`: add an error message to
|
||||
|v:errors| when {pattern} matches {actual}.
|
||||
|
||||
assert_true({actual} [, {msg}]) *assert_true()*
|
||||
When {actual} is not true an error message is added to
|
||||
|v:errors|, like with |assert_equal()|.
|
||||
@@ -2712,13 +2751,6 @@ 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({handle}, {expr} [, {options}]) *ch_evalexpr()*
|
||||
@@ -2728,7 +2760,8 @@ ch_evalexpr({handle}, {expr} [, {options}]) *ch_evalexpr()*
|
||||
{handle} can be Channel or a Job that has a Channel.
|
||||
*E917*
|
||||
{options} must be a Dictionary. It must not have a "callback"
|
||||
entry. It can have a "timeout" entry.
|
||||
entry. It can have a "timeout" entry to specify the timeout
|
||||
for this specific request.
|
||||
|
||||
ch_evalexpr() waits for a response and returns the decoded
|
||||
expression. When there is an error or timeout it returns an
|
||||
@@ -2812,65 +2845,34 @@ ch_logfile({fname} [, {mode}]) *ch_logfile()*
|
||||
|
||||
ch_open({address} [, {options}]) *ch_open()*
|
||||
Open a channel to {address}. See |channel|.
|
||||
Returns a Channel. Use |ch_status()| to check for
|
||||
failure.
|
||||
Returns a Channel. Use |ch_status()| to check for failure.
|
||||
|
||||
{address} has the form "hostname:port", e.g.,
|
||||
"localhost:8765".
|
||||
|
||||
If {options} is given it must be a |Dictionary|. The optional
|
||||
items are:
|
||||
mode "raw", "js" or "json".
|
||||
Default "json".
|
||||
callback function to call for requests with a zero
|
||||
sequence number. See |channel-callback|.
|
||||
Default: none.
|
||||
waittime Specify connect timeout as milliseconds.
|
||||
Negative means forever.
|
||||
Default: 0 (don't wait)
|
||||
timeout Specify response read timeout value in
|
||||
milliseconds.
|
||||
Default: 2000.
|
||||
If {options} is given it must be a |Dictionary|.
|
||||
See |channel-open-options|.
|
||||
|
||||
{only available when compiled with the |+channel| feature}
|
||||
|
||||
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
|
||||
different timeout in msec use the "timeout" option:
|
||||
{"timeout": 123} ~
|
||||
To read from the error output use the "part" option:
|
||||
{"part": "err"} ~
|
||||
To read a message with a specific ID, on a JS or JSON channel:
|
||||
{"id": 99} ~
|
||||
When no ID is specified or the ID is -1, the first message is
|
||||
returned. This overrules any callback waiting for this
|
||||
message.
|
||||
|
||||
For a RAW channel this returns whatever is available, since
|
||||
Vim does not know where a message ends.
|
||||
For a NL channel this returns one message.
|
||||
For a JS or JSON channel this returns one decoded message.
|
||||
This includes any sequence number.
|
||||
See |channel-more|.
|
||||
{only available when compiled with the |+channel| feature}
|
||||
|
||||
ch_readraw({handle} [, {options}]) *ch_readraw()*
|
||||
Like ch_read() but for a JS and JSON channel does not decode
|
||||
the message.
|
||||
the message. See |channel-more|.
|
||||
{only available when compiled with the |+channel| feature}
|
||||
|
||||
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*
|
||||
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
|
||||
response is received. See |channel-callback|.
|
||||
Without "callback" the channel handler is invoked, otherwise
|
||||
any received message is dropped.
|
||||
|
||||
{only available when compiled with the |+channel| feature}
|
||||
|
||||
ch_sendraw({handle}, {string} [, {options}]) *ch_sendraw()*
|
||||
@@ -5216,6 +5218,24 @@ matchstr({expr}, {pat}[, {start}[, {count}]]) *matchstr()*
|
||||
:echo matchstr("testing", "ing", 5)
|
||||
< result is "".
|
||||
When {expr} is a |List| then the matching item is returned.
|
||||
The type isn't changed, it's not necessarily a String.
|
||||
|
||||
matchstrpos({expr}, {pat}[, {start}[, {count}]]) *matchstrpos()*
|
||||
Same as |matchstr()|, but return the matched string, the start
|
||||
position and the end position of the match. Example: >
|
||||
:echo matchstrpos("testing", "ing")
|
||||
< results in ["ing", 4, 7].
|
||||
When there is no match ["", -1, -1] is returned.
|
||||
The {start}, if given, has the same meaning as for |match()|. >
|
||||
:echo matchstrpos("testing", "ing", 2)
|
||||
< results in ["ing", 4, 7]. >
|
||||
:echo matchstrpos("testing", "ing", 5)
|
||||
< result is ["", -1, -1].
|
||||
When {expr} is a |List| then the matching item, the index
|
||||
of first item where {pat} matches, the start position and the
|
||||
end position of the match are returned. >
|
||||
:echo matchstrpos([1, '__x'], '\a')
|
||||
< result is ["x", 1, 2, 3].
|
||||
The type isn't changed, it's not necessarily a String.
|
||||
|
||||
*max()*
|
||||
@@ -6671,13 +6691,17 @@ string({expr}) Return {expr} converted to a String. If {expr} is a Number,
|
||||
Float, String or a composition of them, then the result can be
|
||||
parsed back with |eval()|.
|
||||
{expr} type result ~
|
||||
String 'string'
|
||||
String 'string' (single quotes are doubled)
|
||||
Number 123
|
||||
Float 123.123456 or 1.123456e8
|
||||
Funcref function('name')
|
||||
List [item, item]
|
||||
Dictionary {key: value, key: value}
|
||||
Note that in String values the ' character is doubled.
|
||||
|
||||
When a List or Dictionary has a recursive reference it is
|
||||
replaced by "[...]" or "{...}". Using eval() on the result
|
||||
will then fail.
|
||||
|
||||
Also see |strtrans()|.
|
||||
|
||||
*strlen()*
|
||||
@@ -7665,6 +7689,7 @@ unix Unix version of Vim.
|
||||
user_commands User-defined commands.
|
||||
vertsplit Compiled with vertically split windows |:vsplit|.
|
||||
vim_starting True while initial source'ing takes place. |startup|
|
||||
*vim_starting*
|
||||
viminfo Compiled with viminfo support.
|
||||
virtualedit Compiled with 'virtualedit' option.
|
||||
visual Compiled with Visual mode.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*helphelp.txt* For Vim version 7.4. Last change: 2016 Mar 12
|
||||
*helphelp.txt* For Vim version 7.4. Last change: 2016 Mar 28
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -208,9 +208,11 @@ command: >
|
||||
sorted.
|
||||
When there are duplicates an error message is given.
|
||||
An existing tags file is silently overwritten.
|
||||
|
||||
The optional "++t" argument forces adding the
|
||||
"help-tags" tag. This is also done when the {dir} is
|
||||
equal to $VIMRUNTIME/doc.
|
||||
|
||||
To rebuild the help tags in the runtime directory
|
||||
(requires write permission there): >
|
||||
:helptags $VIMRUNTIME/doc
|
||||
@@ -261,7 +263,9 @@ The second one finds the English user manual, even when 'helplang' is set to
|
||||
|
||||
When using command-line completion for the ":help" command, the "@en"
|
||||
extension is only shown when a tag exists for multiple languages. When the
|
||||
tag only exists for English "@en" is omitted.
|
||||
tag only exists for English "@en" is omitted. When the first candidate has an
|
||||
"@ab" extension and it matches the first language in 'helplang' "@ab" is also
|
||||
omitted.
|
||||
|
||||
When using |CTRL-]| or ":help!" in a non-English help file Vim will try to
|
||||
find the tag in the same language. If not found then 'helplang' will be used
|
||||
|
||||
+12
-5
@@ -1,4 +1,4 @@
|
||||
*options.txt* For Vim version 7.4. Last change: 2016 Mar 19
|
||||
*options.txt* For Vim version 7.4. Last change: 2016 Apr 03
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -1075,7 +1075,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
|
||||
Note that environment variables are not expanded. If you want to use
|
||||
$HOME you must expand it explicitly, e.g.: >
|
||||
:let backupskip = escape(expand('$HOME'), '\') . '/tmp/*'
|
||||
:let &backupskip = escape(expand('$HOME'), '\') . '/tmp/*'
|
||||
|
||||
< Note that the default also makes sure that "crontab -e" works (when a
|
||||
backup would be made by renaming the original file crontab won't see
|
||||
@@ -1258,7 +1258,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
break if 'linebreak' is on. Only works for ASCII and also for 8-bit
|
||||
characters when 'encoding' is an 8-bit encoding.
|
||||
|
||||
*'breakindent'* *'bri'* *'nobreakindent'* *'nobri'*
|
||||
*'breakindent'* *'bri'* *'nobreakindent'* *'nobri'*
|
||||
'breakindent' 'bri' boolean (default off)
|
||||
local to window
|
||||
{not in Vi}
|
||||
@@ -2305,6 +2305,8 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
different. The whole undo file is encrypted, not just
|
||||
the pieces of text.
|
||||
|
||||
You should use "blowfish2", also to re-encrypt older files.
|
||||
|
||||
When reading an encrypted file 'cryptmethod' will be set automatically
|
||||
to the detected method of the file being read. Thus if you write it
|
||||
without changing 'cryptmethod' the same method will be used.
|
||||
@@ -3043,8 +3045,8 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
file only, the option is not changed.
|
||||
When 'binary' is set, the value of 'fileformats' is not used.
|
||||
|
||||
Note that when Vim starts up with an empty buffer this option is not
|
||||
used. Set 'fileformat' in your .vimrc instead.
|
||||
When Vim starts up with an empty buffer the first item is used. You
|
||||
can overrule this by setting 'fileformat' in your .vimrc.
|
||||
|
||||
For systems with a Dos-like <EOL> (<CR><NL>), when reading files that
|
||||
are ":source"ed and for vimrc files, automatic <EOL> detection may be
|
||||
@@ -3733,6 +3735,10 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
HANGEUL, HEBREW, JOHAB, MAC, OEM, RUSSIAN, SHIFTJIS,
|
||||
SYMBOL, THAI, TURKISH, VIETNAMESE ANSI and BALTIC.
|
||||
Normally you would use "cDEFAULT".
|
||||
qXX - quality XX. Valid charsets are: PROOF, DRAFT,
|
||||
ANTIALIASED, UNANTIALIASED, CLEARTYPE, DEFAULT.
|
||||
Normally you would use "qDEFAULT".
|
||||
Some quality values isn't supported in legacy OSs.
|
||||
|
||||
Use a ':' to separate the options.
|
||||
- A '_' can be used in the place of a space, so you don't need to use
|
||||
@@ -5251,6 +5257,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
written. A ":set nomodified" command also resets the original
|
||||
values to the current values and the 'modified' option will be
|
||||
reset.
|
||||
Similarly for 'eol' and 'bomb'.
|
||||
This option is not set when a change is made to the buffer as the
|
||||
result of a BufNewFile, BufRead/BufReadPost, BufWritePost,
|
||||
FileAppendPost or VimLeave autocommand event. See |gzip-example| for
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*os_beos.txt* For Vim version 7.4. Last change: 2010 Aug 14
|
||||
*os_beos.txt* For Vim version 7.4. Last change: 2016 Mar 28
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -248,8 +248,9 @@ reality. Vim uses this mapping:
|
||||
Button 3 -> MiddleMouse.
|
||||
|
||||
If your mouse has fewer than 3 buttons you can provide your own mapping from
|
||||
mouse clicks with modifier(s) to other mouse buttons. See the file
|
||||
vim-5.x/macros/swapmous.vim for an example. |gui-mouse-mapping|
|
||||
mouse clicks with modifier(s) to other mouse buttons. See the swapmouse
|
||||
package for an example: |gui-mouse-mapping|
|
||||
$VIMRUNTIME/pack/dist/opt/swapmouse/plugin/swapmouse.vim
|
||||
|
||||
|
||||
12. Color names *beos-colors*
|
||||
|
||||
+91
-14
@@ -1,4 +1,4 @@
|
||||
*repeat.txt* For Vim version 7.4. Last change: 2016 Mar 15
|
||||
*repeat.txt* For Vim version 7.4. Last change: 2016 Mar 27
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -8,13 +8,14 @@ Repeating commands, Vim scripts and debugging *repeating*
|
||||
|
||||
Chapter 26 of the user manual introduces repeating |usr_26.txt|.
|
||||
|
||||
1. Single repeats |single-repeat|
|
||||
2. Multiple repeats |multi-repeat|
|
||||
3. Complex repeats |complex-repeat|
|
||||
4. Using Vim scripts |using-scripts|
|
||||
5. Using Vim packages |packages|
|
||||
6. Debugging scripts |debug-scripts|
|
||||
7. Profiling |profiling|
|
||||
1. Single repeats |single-repeat|
|
||||
2. Multiple repeats |multi-repeat|
|
||||
3. Complex repeats |complex-repeat|
|
||||
4. Using Vim scripts |using-scripts|
|
||||
5. Using Vim packages |packages|
|
||||
6. Creating Vim packages |package-create|
|
||||
7. Debugging scripts |debug-scripts|
|
||||
8. Profiling |profiling|
|
||||
|
||||
==============================================================================
|
||||
1. Single repeats *single-repeat*
|
||||
@@ -259,7 +260,7 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
|
||||
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.
|
||||
An Error only causes sourcing the script where it
|
||||
An error only causes sourcing the script where it
|
||||
happens to be aborted, further plugins will be loaded.
|
||||
See |packages|.
|
||||
|
||||
@@ -481,7 +482,7 @@ find the syntax/some.vim file, because its directory is in 'runtimepath'.
|
||||
|
||||
Vim will also load ftdetect files, if there are any.
|
||||
|
||||
Note that the files under "pack/foo/opt" or not loaded automatically, only the
|
||||
Note that the files under "pack/foo/opt" are not loaded automatically, only the
|
||||
ones under "pack/foo/start". See |pack-add| below for how the "opt" directory
|
||||
is used.
|
||||
|
||||
@@ -516,14 +517,90 @@ To load an optional plugin from a pack use the `:packadd` command: >
|
||||
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|.
|
||||
This could be done if some conditions are met. For example, depending on
|
||||
whether Vim supports a feature or a dependency is missing.
|
||||
|
||||
You can also load an optional plugin at startup, by putting this command in
|
||||
your |.vimrc|: >
|
||||
:packadd! foodebug
|
||||
The extra "!" is so that the plugin isn't loaded with Vim was started with
|
||||
|--noplugin|.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
Where to put what ~
|
||||
|
||||
Since color schemes, loaded with `:colorscheme`, are found below
|
||||
"pack/*/start" and "pack/*/opt", you could put them anywhere. We recommend
|
||||
you put them below "pack/*/opt", for example
|
||||
".vim/pack/mycolors/opt/dark/colors/very_dark.vim".
|
||||
|
||||
Filetype plugins should go under "pack/*/start", so that they are always
|
||||
found. Unless you have more than one plugin for a file type and want to
|
||||
select which one to load with `:packadd`. E.g. depending on the compiler
|
||||
version: >
|
||||
if foo_compiler_version > 34
|
||||
packadd foo_new
|
||||
else
|
||||
packadd foo_old
|
||||
endif
|
||||
|
||||
The "after" directory is most likely not useful in a package. It's not
|
||||
disallowed though.
|
||||
|
||||
==============================================================================
|
||||
6. Debugging scripts *debug-scripts*
|
||||
6. Creating Vim packages *package-create*
|
||||
|
||||
This assumes you write one or more plugins that you distribute as a package.
|
||||
|
||||
If you have two unrelated plugins you would use two packages, so that Vim
|
||||
users can chose what they include or not. Or you can decide to use one
|
||||
package with optional plugins, and tell the user to add the ones he wants with
|
||||
`:packadd`.
|
||||
|
||||
Decide how you want to distribute the package. You can create an archive or
|
||||
you could use a repository. An archive can be used by more users, but is a
|
||||
bit harder to update to a new version. A repository can usually be kept
|
||||
up-to-date easily, but it requires a program like "git" to be available.
|
||||
You can do both, github can automatically create an archive for a release.
|
||||
|
||||
Your directory layout would be like this:
|
||||
start/foobar/plugin/foo.vim " always loaded, defines commands
|
||||
start/foobar/plugin/bar.vim " always loaded, defines commands
|
||||
start/foobar/autoload/foo.vim " loaded when foo command used
|
||||
start/foobar/doc/foo.txt " help for foo.vim
|
||||
start/foobar/doc/tags " help tags
|
||||
opt/fooextra/plugin/extra.vim " optional plugin, defines commands
|
||||
opt/fooextra/autoload/extra.vim " loaded when extra command used
|
||||
opt/fooextra/doc/extra.txt " help for extra.vim
|
||||
opt/fooextra/doc/tags " help tags
|
||||
|
||||
This allows for the user to do: >
|
||||
mkdir ~/.vim/pack/myfoobar
|
||||
cd ~/.vim/pack/myfoobar
|
||||
git clone https://github.com/you/foobar.git
|
||||
|
||||
Here "myfoobar" is a name that the user can choose, the only condition is that
|
||||
it differs from other packages.
|
||||
|
||||
In your documentation you explain what the plugins do, and tell the user how
|
||||
to load the optional plugin: >
|
||||
:packadd! fooextra
|
||||
|
||||
You could add this packadd command in one of your plugins, to be executed when
|
||||
the optional plugin is needed.
|
||||
|
||||
Run the `:helptags` command to generate the doc/tags file. Including this
|
||||
generated file in the package means that the user can drop the package in his
|
||||
pack directory and the help command works right away. Don't forget to re-run
|
||||
the command after changing the plugin help: >
|
||||
:helptags path/start/foobar/doc
|
||||
:helptags path/opt/fooextra/doc
|
||||
|
||||
==============================================================================
|
||||
7. Debugging scripts *debug-scripts*
|
||||
|
||||
Besides the obvious messages that you can add to your scripts to find out what
|
||||
they are doing, Vim offers a debug mode. This allows you to step through a
|
||||
@@ -748,7 +825,7 @@ OBSCURE
|
||||
user, don't use typeahead for debug commands.
|
||||
|
||||
==============================================================================
|
||||
7. Profiling *profile* *profiling*
|
||||
8. Profiling *profile* *profiling*
|
||||
|
||||
Profiling means that Vim measures the time that is spent on executing
|
||||
functions and/or scripts. The |+profile| feature is required for this.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*starting.txt* For Vim version 7.4. Last change: 2016 Mar 05
|
||||
*starting.txt* For Vim version 7.4. Last change: 2016 Mar 26
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -867,8 +867,8 @@ accordingly. Vim proceeds in this order:
|
||||
use "--cmd 'set noloadplugins'" |--cmd|.
|
||||
|
||||
Plugin packs are loaded. These are plugins, as above, but found in
|
||||
'packpath' directories. Every plugin directory found is added in
|
||||
'runtimepath'. See |packages|.
|
||||
'packpath' "start" directories. Every plugin directory found is added
|
||||
in 'runtimepath'. See |packages|.
|
||||
|
||||
5. Set 'shellpipe' and 'shellredir'
|
||||
The 'shellpipe' and 'shellredir' options are set according to the
|
||||
@@ -906,8 +906,9 @@ accordingly. Vim proceeds in this order:
|
||||
12. Execute startup commands
|
||||
If a "-t" flag was given to Vim, the tag is jumped to.
|
||||
The commands given with the |-c| and |+cmd| arguments are executed.
|
||||
The starting flag is reset, has("vim_starting") will now return zero.
|
||||
If the 'insertmode' option is set, Insert mode is entered.
|
||||
The starting flag is reset, has("vim_starting") will now return zero.
|
||||
The |v:vim_did_enter| variable is set to 1.
|
||||
The |VimEnter| autocommands are executed.
|
||||
|
||||
Some hints on using initializations:
|
||||
|
||||
@@ -1656,6 +1656,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
|
||||
05.5 usr_05.txt /*05.5*
|
||||
05.6 usr_05.txt /*05.6*
|
||||
05.7 usr_05.txt /*05.7*
|
||||
05.8 usr_05.txt /*05.8*
|
||||
06.1 usr_06.txt /*06.1*
|
||||
06.2 usr_06.txt /*06.2*
|
||||
06.3 usr_06.txt /*06.3*
|
||||
@@ -4502,6 +4503,8 @@ E921 channel.txt /*E921*
|
||||
E922 eval.txt /*E922*
|
||||
E923 eval.txt /*E923*
|
||||
E924 quickfix.txt /*E924*
|
||||
E925 quickfix.txt /*E925*
|
||||
E926 quickfix.txt /*E926*
|
||||
E93 windows.txt /*E93*
|
||||
E94 windows.txt /*E94*
|
||||
E95 message.txt /*E95*
|
||||
@@ -4937,6 +4940,7 @@ add-filetype-plugin usr_05.txt /*add-filetype-plugin*
|
||||
add-global-plugin usr_05.txt /*add-global-plugin*
|
||||
add-local-help usr_05.txt /*add-local-help*
|
||||
add-option-flags options.txt /*add-option-flags*
|
||||
add-package usr_05.txt /*add-package*
|
||||
add-plugin usr_05.txt /*add-plugin*
|
||||
added-5.1 version5.txt /*added-5.1*
|
||||
added-5.2 version5.txt /*added-5.2*
|
||||
@@ -4999,6 +5003,7 @@ assert_equal() eval.txt /*assert_equal()*
|
||||
assert_exception() eval.txt /*assert_exception()*
|
||||
assert_fails() eval.txt /*assert_fails()*
|
||||
assert_false() eval.txt /*assert_false()*
|
||||
assert_match() eval.txt /*assert_match()*
|
||||
assert_true() eval.txt /*assert_true()*
|
||||
at motion.txt /*at*
|
||||
atan() eval.txt /*atan()*
|
||||
@@ -5274,7 +5279,9 @@ channel-demo channel.txt /*channel-demo*
|
||||
channel-mode channel.txt /*channel-mode*
|
||||
channel-more channel.txt /*channel-more*
|
||||
channel-open channel.txt /*channel-open*
|
||||
channel-open-options channel.txt /*channel-open-options*
|
||||
channel-raw channel.txt /*channel-raw*
|
||||
channel-timeout channel.txt /*channel-timeout*
|
||||
channel-use channel.txt /*channel-use*
|
||||
channel.txt channel.txt /*channel.txt*
|
||||
char-variable eval.txt /*char-variable*
|
||||
@@ -6931,6 +6938,7 @@ 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*
|
||||
job-timeout channel.txt /*job-timeout*
|
||||
job_getchannel() eval.txt /*job_getchannel()*
|
||||
job_info() eval.txt /*job_info()*
|
||||
job_setoptions() eval.txt /*job_setoptions()*
|
||||
@@ -7188,6 +7196,7 @@ matchit-install usr_05.txt /*matchit-install*
|
||||
matchlist() eval.txt /*matchlist()*
|
||||
matchparen pi_paren.txt /*matchparen*
|
||||
matchstr() eval.txt /*matchstr()*
|
||||
matchstrpos() eval.txt /*matchstrpos()*
|
||||
max() eval.txt /*max()*
|
||||
mbyte-IME mbyte.txt /*mbyte-IME*
|
||||
mbyte-XIM mbyte.txt /*mbyte-XIM*
|
||||
@@ -7694,6 +7703,7 @@ out_name channel.txt /*out_name*
|
||||
out_timeout channel.txt /*out_timeout*
|
||||
p change.txt /*p*
|
||||
pack-add repeat.txt /*pack-add*
|
||||
package-create repeat.txt /*package-create*
|
||||
packages repeat.txt /*packages*
|
||||
page-down intro.txt /*page-down*
|
||||
page-up intro.txt /*page-up*
|
||||
@@ -8861,6 +8871,7 @@ v:true eval.txt /*v:true*
|
||||
v:val eval.txt /*v:val*
|
||||
v:var eval.txt /*v:var*
|
||||
v:version eval.txt /*v:version*
|
||||
v:vim_did_enter eval.txt /*v:vim_did_enter*
|
||||
v:warningmsg eval.txt /*v:warningmsg*
|
||||
v:windowid eval.txt /*v:windowid*
|
||||
v_! change.txt /*v_!*
|
||||
@@ -9034,7 +9045,9 @@ vim-variable eval.txt /*vim-variable*
|
||||
vim.vim syntax.txt /*vim.vim*
|
||||
vim7 version7.txt /*vim7*
|
||||
vim: options.txt /*vim:*
|
||||
vim_did_enter-variable eval.txt /*vim_did_enter-variable*
|
||||
vim_mac gui_mac.txt /*vim_mac*
|
||||
vim_starting eval.txt /*vim_starting*
|
||||
vimball pi_vimball.txt /*vimball*
|
||||
vimball-contents pi_vimball.txt /*vimball-contents*
|
||||
vimball-extract pi_vimball.txt /*vimball-extract*
|
||||
|
||||
+35
-26
@@ -1,4 +1,4 @@
|
||||
*todo.txt* For Vim version 7.4. Last change: 2016 Mar 20
|
||||
*todo.txt* For Vim version 7.4. Last change: 2016 Mar 29
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -34,41 +34,32 @@ not be repeated below, unless there is extra information.
|
||||
*known-bugs*
|
||||
-------------------- Known bugs and current work -----------------------
|
||||
|
||||
Using free memory. (Dominique, 2016 Mar 27)
|
||||
|
||||
+channel:
|
||||
- add test for out-cb and err-cb.
|
||||
- Move more details from eval.txt to channel.txt. Add tags in eval.txt.
|
||||
- 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. 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"]
|
||||
- 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}.
|
||||
|
||||
Packages: how about "after" directory?
|
||||
Partial:
|
||||
- Maybe we also need VAR_PARTIAL support in if_mzsch.
|
||||
|
||||
Make it so that the window ID can be used where currently a window nr is used
|
||||
|
||||
Fix to support --nofork for Windows batch files. (Kevin Cantú, 2016 Feb 23,
|
||||
#658, #659) Also add "setlocal" at top of batch file?
|
||||
Patch to add "q" item to guifont. #720, Kim Brouer, 2016 Mar 29
|
||||
Better patch from Yasuhiro Matsumoto, 2016 Jan 4.
|
||||
|
||||
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").
|
||||
Patch to make tag jump work on function({expr}). (Hirohito Higashi, 2016 Mar
|
||||
25)
|
||||
|
||||
Allow for an empty dictionary key?
|
||||
|
||||
@@ -119,6 +110,10 @@ Regexp problems:
|
||||
matches the empty string. (Dominique Pelle, 2015 Oct 2, Nov 24)
|
||||
- Search for \\~ causes error E874.
|
||||
|
||||
Using freed memory in quickfix code. (Dominique, 2016 Mar 21)
|
||||
|
||||
Patch 7.4.1401 caused autochdir not to work on startup. (Rob Hoelz, #704)
|
||||
|
||||
Patch to fix that folds close with autocomplete. #643
|
||||
Christian Brabandt, 2016 Feb 18.
|
||||
|
||||
@@ -137,6 +132,7 @@ 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.
|
||||
Also see patch from Hirohito Higash, Feb 25.
|
||||
Updated patch, 2016 Mar 25.
|
||||
|
||||
Patch to update the GTK icon cache when installing. (Kazunobu Kuriyama, 2016
|
||||
Feb 3)
|
||||
@@ -147,19 +143,28 @@ Cannot delete a file with square brackets with delete(). (#696)
|
||||
|
||||
Patch to add 'topbot' to 'belloff' option. (Coot, 2016 Mar 18, #695)
|
||||
|
||||
Patch to make matchit work better, respect 'matchpairs'. (Ken Takata, 2016 Mar
|
||||
25)
|
||||
|
||||
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?
|
||||
|
||||
It's possible to add ",," to 'wildignore', an empty entry. Causes problems.
|
||||
Reject the value? #710.
|
||||
|
||||
Win32: patch to use 64 bit stat() if possible. (Ken Takata, 2014 May 12)
|
||||
More tests May 14. Update May 29. Update Aug 10.
|
||||
Now part of large file patches. (Ken Takata, 2016 Feb 1)
|
||||
Two patches now? New update Feb 24.
|
||||
Win64: Seek error in swap file for a very big file (3 Gbyte). Check storing
|
||||
pointer in long and seek offset in 64 bit var.
|
||||
Patches from Ken Takata might help (2014 Apr 17)
|
||||
Update 2016 Mar 28. Can include all parts into one dist patch.
|
||||
|
||||
Patch to support 64 bit ints for Number. (Ken Takata, 2016 Jan 21)
|
||||
Also in update of Feb 24?
|
||||
Update 2016 Mar 28.
|
||||
|
||||
After 7.5 is released:
|
||||
- Drop support for older MS-Windows systems, before XP.
|
||||
@@ -202,6 +207,10 @@ Patch to make "%:h:h" return "." instead of the full path.
|
||||
|
||||
Remove SPACE_IN_FILENAME ? What could possibly go wrong?
|
||||
|
||||
Patch to change GUI behavior: instead of changing the window size change the
|
||||
lines/columns when menu/toolbar/etc. is added/removed. (Ychin, 2016 Mar 20,
|
||||
#703)
|
||||
|
||||
Installation of .desktop files does not work everywhere.
|
||||
It's now fixed, but the target directory probably isn't right.
|
||||
Add configure check?
|
||||
@@ -220,6 +229,8 @@ Patch to avoid redrawing tabline when the popup menu is visible.
|
||||
|
||||
Patch to add {skip} argument to search(). (Christian Brabandt, 2016 Feb 24)
|
||||
|
||||
Add value "smart" to 'tagcase': ignore case when tag is all lower case.
|
||||
|
||||
7 Add a watchpoint in the debug mode: An expression that breaks execution
|
||||
when evaluating to non-zero. Add the "watchadd expr" command, stop when
|
||||
the value of the expression changes. ":watchdel" deletes an item,
|
||||
@@ -247,6 +258,8 @@ https://gist.github.com/presuku/d3d6b230b9b6dcfc0477
|
||||
Patch to make the behavior of "w" more straightforward, but not Vi compatible.
|
||||
With a 'cpo' flag. (Christian Brabandt, 2016 Feb 8)
|
||||
|
||||
Patch to add optionproperties(). (Anton Lindqvist, 2016 Mar 27)
|
||||
|
||||
Patch to add TagNotFound autocommand. (Anton Lindqvist, 2016 Feb 3)
|
||||
|
||||
Patch to add Error autocommand. (Anton Lindqvist, 2016 Feb 17)
|
||||
@@ -298,7 +311,7 @@ Value returned by virtcol() changes depending on how lines wrap. This is
|
||||
inconsistent with the documentation.
|
||||
|
||||
Patch to add filtering of the quickfix list. (Yegappan Lakshmanan, 2016 Mar
|
||||
13, last version)
|
||||
13, last version) Update Mar 21.
|
||||
|
||||
Can we cache the syntax attributes, so that updates for 'relativenumber' and
|
||||
'cursorline'/'cursorcolumn' are a lot faster?
|
||||
@@ -1904,10 +1917,6 @@ Win32: using "gvim --remote-tab-silent fname" sometimes gives an empty screen
|
||||
with the more prompt. Caused by setting the guitablabel? (Thomas Michael
|
||||
Engelke, 2007 Dec 20 - 2008 Jan 17)
|
||||
|
||||
Win64: Seek error in swap file for a very big file (3 Gbyte). Check storing
|
||||
pointer in long and seek offset in 64 bit var.
|
||||
Patches from Ken Takata might help (2014 Apr 17)
|
||||
|
||||
Win32: patch for fullscreen mode. (Liushaolin, 2008 April 17)
|
||||
|
||||
Win32: When 'shell' is bash shellescape() doesn't always do the right thing.
|
||||
@@ -4841,7 +4850,7 @@ Searching:
|
||||
lines 23 to 45? Or does this conflict with Ex range syntax?
|
||||
8 Allow identical pairs in 'matchpairs'. Restrict the search to the current
|
||||
line.
|
||||
7 Allow longer pairs in 'matchpairs'. Use ~/vim/macros/matchit.vim as an
|
||||
7 Allow longer pairs in 'matchpairs'. Use matchit.vim as an
|
||||
example.
|
||||
8 Make it possible to define the character that "%" checks for in
|
||||
#if/#endif. For nmake it's !if/!endif.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*usr_05.txt* For Vim version 7.4. Last change: 2016 Mar 25
|
||||
*usr_05.txt* For Vim version 7.4. Last change: 2016 Mar 28
|
||||
|
||||
VIM USER MANUAL - by Bram Moolenaar
|
||||
|
||||
@@ -275,10 +275,9 @@ matching HTML tags, if/else/endif in Vim scripts, etc. Very useful, although
|
||||
it's not backwards compatible (that's why it is not enabled by default).
|
||||
|
||||
To start using the matchit plugin, add one line to your vimrc file: >
|
||||
packadd matchit
|
||||
packadd! matchit
|
||||
|
||||
That's all! You can also type the command to try it out. Now you can find
|
||||
help about this plugin: >
|
||||
That's all! After restarting Vim you can find help about this plugin: >
|
||||
:help matchit
|
||||
|
||||
This works, because when `:packadd` loaded the plugin it also added the
|
||||
@@ -364,10 +363,9 @@ Example for Unix (assuming you didn't have a plugin directory yet): >
|
||||
|
||||
mkdir ~/.vim
|
||||
mkdir ~/.vim/plugin
|
||||
cp /usr/local/share/vim/vim60/macros/justify.vim ~/.vim/plugin
|
||||
cp /tmp/yourplugin.vim ~/.vim/plugin
|
||||
|
||||
That's all! Now you can use the commands defined in this plugin to justify
|
||||
text.
|
||||
That's all! Now you can use the commands defined in this plugin.
|
||||
|
||||
Instead of putting plugins directly into the plugin/ directory, you may
|
||||
better organize them by putting them into subdirectories under plugin/.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*usr_25.txt* For Vim version 7.4. Last change: 2014 Oct 29
|
||||
*usr_25.txt* For Vim version 7.4. Last change: 2016 Mar 28
|
||||
|
||||
VIM USER MANUAL - by Bram Moolenaar
|
||||
|
||||
@@ -196,12 +196,16 @@ Vim has no built-in way of justifying text. However, there is a neat macro
|
||||
package that does the job. To use this package, execute the following
|
||||
command: >
|
||||
|
||||
:runtime macros/justify.vim
|
||||
:packadd justify
|
||||
|
||||
Or put this line in your |vimrc|: >
|
||||
|
||||
packadd! justify
|
||||
|
||||
This Vim script file defines a new visual command "_j". To justify a block of
|
||||
text, highlight the text in Visual mode and then execute "_j".
|
||||
Look in the file for more explanations. To go there, do "gf" on this name:
|
||||
$VIMRUNTIME/macros/justify.vim.
|
||||
$VIMRUNTIME/pack/dist/opt/justify/plugin/justify.vim.
|
||||
|
||||
An alternative is to filter the text through an external program. Example: >
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*usr_41.txt* For Vim version 7.4. Last change: 2016 Mar 15
|
||||
*usr_41.txt* For Vim version 7.4. Last change: 2016 Mar 27
|
||||
|
||||
VIM USER MANUAL - by Bram Moolenaar
|
||||
|
||||
@@ -592,6 +592,7 @@ String manipulation: *string-functions*
|
||||
match() position where a pattern matches in a string
|
||||
matchend() position where a pattern match ends in a string
|
||||
matchstr() match of a pattern in a string
|
||||
matchstrpos() match and postions of a pattern in a string
|
||||
matchlist() like matchstr() and also return submatches
|
||||
stridx() first index of a short string in a long string
|
||||
strridx() last index of a short string in a long string
|
||||
@@ -890,6 +891,7 @@ Mappings: *mapping-functions*
|
||||
|
||||
Testing: *test-functions*
|
||||
assert_equal() assert that two expressions values are equal
|
||||
assert_match() assert that a pattern matches the value
|
||||
assert_false() assert that an expression is false
|
||||
assert_true() assert that an expression is true
|
||||
assert_exception() assert that a command throws an exception
|
||||
|
||||
+14
-13
@@ -8,25 +8,26 @@ maze Macros that solve a maze (amazing!).
|
||||
urm Macros that simulate a simple computer: "Universal Register Machine"
|
||||
|
||||
|
||||
|
||||
The other files contain some handy utilities. They also serve as examples for
|
||||
how to use Vi and Vim functionality.
|
||||
|
||||
dvorak for when you use a Dvorak keyboard
|
||||
|
||||
justify.vim user function for justifying text
|
||||
|
||||
less.sh + less.vim make Vim work like less (or more)
|
||||
|
||||
shellmenu.vim menus for editing shell scripts in the GUI version
|
||||
|
||||
swapmous.vim swap left and right mouse buttons
|
||||
|
||||
editexisting.vim when editing a file that is already edited with
|
||||
another Vim instance
|
||||
The following have been moved to an optional package. Add the command to your
|
||||
vimrc file to use the package:
|
||||
|
||||
This one is only for Unix.
|
||||
file_select.vim macros that make a handy file selector
|
||||
packadd! dvorak " Dvorak keyboard support; adds mappings
|
||||
|
||||
The matchit plugin has been moved to an optional package. To load it put this
|
||||
line in your vimrc file:
|
||||
:packadd matchit
|
||||
packadd! editexisting " when editing a file that is already edited with
|
||||
" another Vim instance, go to that Vim instance
|
||||
|
||||
packadd! justify " justifying text.
|
||||
|
||||
packadd! matchit " makes the % command work better
|
||||
|
||||
packadd! shellmenu " menus for editing shell scripts in the GUI version
|
||||
|
||||
packadd! swapmouse " swap left and right mouse buttons
|
||||
|
||||
@@ -1,164 +0,0 @@
|
||||
When using a dvorak keyboard this file may be of help to you.
|
||||
These mappings have been made by Lawrence Kesteloot <kesteloo@cs.unc.edu>.
|
||||
What they do is that the most often used keys, like hjkl, are put in a more
|
||||
easy to use position.
|
||||
It may take some time to learn using this.
|
||||
|
||||
Put these lines in your .vimrc:
|
||||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
" Key to go into dvorak mode:
|
||||
map ,d :source ~/.dvorak
|
||||
" Key to get out of dvorak mode:
|
||||
map ,q :source ~/.qwerty
|
||||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
|
||||
write these lines into the file ~/.dvorak:
|
||||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
" Dvorak keyboard, only in insert mode and ex mode.
|
||||
" You may want to add a list of map's too.
|
||||
imap! a a
|
||||
imap! b x
|
||||
imap! c j
|
||||
imap! d e
|
||||
imap! e .
|
||||
imap! f u
|
||||
imap! g i
|
||||
imap! h d
|
||||
imap! i c
|
||||
imap! j h
|
||||
imap! k t
|
||||
imap! l n
|
||||
imap! m m
|
||||
imap! n b
|
||||
imap! o r
|
||||
imap! p l
|
||||
imap! q '
|
||||
imap! r p
|
||||
imap! s o
|
||||
imap! t y
|
||||
imap! u g
|
||||
imap! v k
|
||||
imap! w ,
|
||||
imap! x q
|
||||
imap! y f
|
||||
imap! z ;
|
||||
imap! ; s
|
||||
imap! ' -
|
||||
imap! " _
|
||||
imap! , w
|
||||
imap! . v
|
||||
imap! / z
|
||||
imap! A A
|
||||
imap! B X
|
||||
imap! C J
|
||||
imap! D E
|
||||
imap! E >
|
||||
imap! F U
|
||||
imap! G I
|
||||
imap! H D
|
||||
imap! I C
|
||||
imap! J H
|
||||
imap! K T
|
||||
imap! L N
|
||||
imap! M M
|
||||
imap! N B
|
||||
imap! O R
|
||||
imap! P L
|
||||
imap! Q "
|
||||
imap! R P
|
||||
imap! S O
|
||||
imap! T Y
|
||||
imap! U G
|
||||
imap! V K
|
||||
imap! W <
|
||||
imap! X Q
|
||||
imap! Y F
|
||||
imap! Z :
|
||||
imap! < W
|
||||
imap! > V
|
||||
imap! ? Z
|
||||
imap! : S
|
||||
imap! [ /
|
||||
imap! ] =
|
||||
imap! { ?
|
||||
imap! } +
|
||||
imap! - [
|
||||
imap! _ {
|
||||
imap! = ]
|
||||
imap! + }
|
||||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
|
||||
write these lines into the file ~/.qwerty
|
||||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
" Qwerty keyboard
|
||||
unmap! a
|
||||
unmap! b
|
||||
unmap! c
|
||||
unmap! d
|
||||
unmap! e
|
||||
unmap! f
|
||||
unmap! g
|
||||
unmap! h
|
||||
unmap! i
|
||||
unmap! j
|
||||
unmap! k
|
||||
unmap! l
|
||||
unmap! m
|
||||
unmap! n
|
||||
unmap! o
|
||||
unmap! p
|
||||
unmap! q
|
||||
unmap! r
|
||||
unmap! s
|
||||
unmap! t
|
||||
unmap! u
|
||||
unmap! v
|
||||
unmap! w
|
||||
unmap! x
|
||||
unmap! y
|
||||
unmap! z
|
||||
unmap! ;
|
||||
unmap! '
|
||||
unmap! \"
|
||||
unmap! ,
|
||||
unmap! .
|
||||
unmap! /
|
||||
unmap! A
|
||||
unmap! B
|
||||
unmap! C
|
||||
unmap! D
|
||||
unmap! E
|
||||
unmap! F
|
||||
unmap! G
|
||||
unmap! H
|
||||
unmap! I
|
||||
unmap! J
|
||||
unmap! K
|
||||
unmap! L
|
||||
unmap! M
|
||||
unmap! N
|
||||
unmap! O
|
||||
unmap! P
|
||||
unmap! Q
|
||||
unmap! R
|
||||
unmap! S
|
||||
unmap! T
|
||||
unmap! U
|
||||
unmap! V
|
||||
unmap! W
|
||||
unmap! X
|
||||
unmap! Y
|
||||
unmap! Z
|
||||
unmap! <
|
||||
unmap! >
|
||||
unmap! ?
|
||||
unmap! :
|
||||
unmap! [
|
||||
unmap! ]
|
||||
unmap! {
|
||||
unmap! }
|
||||
unmap! -
|
||||
unmap! _
|
||||
unmap! =
|
||||
unmap! +
|
||||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
@@ -1,119 +1,3 @@
|
||||
" Vim Plugin: Edit the file with an existing Vim if possible
|
||||
" Maintainer: Bram Moolenaar
|
||||
" Last Change: 2014 Dec 06
|
||||
|
||||
" This is a plugin, drop it in your (Unix) ~/.vim/plugin or (Win32)
|
||||
" $VIM/vimfiles/plugin directory. Or make a symbolic link, so that you
|
||||
" automatically use the latest version.
|
||||
|
||||
" This plugin serves two purposes:
|
||||
" 1. On startup, if we were invoked with one file name argument and the file
|
||||
" is not modified then try to find another Vim instance that is editing
|
||||
" this file. If there is one then bring it to the foreground and exit.
|
||||
" 2. When a file is edited and a swap file exists for it, try finding that
|
||||
" other Vim and bring it to the foreground. Requires Vim 7, because it
|
||||
" uses the SwapExists autocommand event.
|
||||
if v:version < 700
|
||||
finish
|
||||
endif
|
||||
|
||||
" Function that finds the Vim instance that is editing "filename" and brings
|
||||
" it to the foreground.
|
||||
func s:EditElsewhere(filename)
|
||||
let fname_esc = substitute(a:filename, "'", "''", "g")
|
||||
|
||||
let servers = serverlist()
|
||||
while servers != ''
|
||||
" Get next server name in "servername"; remove it from "servers".
|
||||
let i = match(servers, "\n")
|
||||
if i == -1
|
||||
let servername = servers
|
||||
let servers = ''
|
||||
else
|
||||
let servername = strpart(servers, 0, i)
|
||||
let servers = strpart(servers, i + 1)
|
||||
endif
|
||||
|
||||
" Skip ourselves.
|
||||
if servername ==? v:servername
|
||||
continue
|
||||
endif
|
||||
|
||||
" Check if this server is editing our file.
|
||||
if remote_expr(servername, "bufloaded('" . fname_esc . "')")
|
||||
" Yes, bring it to the foreground.
|
||||
if has("win32")
|
||||
call remote_foreground(servername)
|
||||
endif
|
||||
call remote_expr(servername, "foreground()")
|
||||
|
||||
if remote_expr(servername, "exists('*EditExisting')")
|
||||
" Make sure the file is visible in a window (not hidden).
|
||||
" If v:swapcommand exists and is set, send it to the server.
|
||||
if exists("v:swapcommand")
|
||||
let c = substitute(v:swapcommand, "'", "''", "g")
|
||||
call remote_expr(servername, "EditExisting('" . fname_esc . "', '" . c . "')")
|
||||
else
|
||||
call remote_expr(servername, "EditExisting('" . fname_esc . "', '')")
|
||||
endif
|
||||
endif
|
||||
|
||||
if !(has('vim_starting') && has('gui_running') && has('gui_win32'))
|
||||
" Tell the user what is happening. Not when the GUI is starting
|
||||
" though, it would result in a message box.
|
||||
echomsg "File is being edited by " . servername
|
||||
sleep 2
|
||||
endif
|
||||
return 'q'
|
||||
endif
|
||||
endwhile
|
||||
return ''
|
||||
endfunc
|
||||
|
||||
" When the plugin is loaded and there is one file name argument: Find another
|
||||
" Vim server that is editing this file right now.
|
||||
if argc() == 1 && !&modified
|
||||
if s:EditElsewhere(expand("%:p")) == 'q'
|
||||
quit
|
||||
endif
|
||||
endif
|
||||
|
||||
" Setup for handling the situation that an existing swap file is found.
|
||||
try
|
||||
au! SwapExists * let v:swapchoice = s:EditElsewhere(expand("<afile>:p"))
|
||||
catch
|
||||
" Without SwapExists we don't do anything for ":edit" commands
|
||||
endtry
|
||||
|
||||
" Function used on the server to make the file visible and possibly execute a
|
||||
" command.
|
||||
func! EditExisting(fname, command)
|
||||
" Get the window number of the file in the current tab page.
|
||||
let winnr = bufwinnr(a:fname)
|
||||
if winnr <= 0
|
||||
" Not found, look in other tab pages.
|
||||
let bufnr = bufnr(a:fname)
|
||||
for i in range(tabpagenr('$'))
|
||||
if index(tabpagebuflist(i + 1), bufnr) >= 0
|
||||
" Make this tab page the current one and find the window number.
|
||||
exe 'tabnext ' . (i + 1)
|
||||
let winnr = bufwinnr(a:fname)
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
if winnr > 0
|
||||
exe winnr . "wincmd w"
|
||||
elseif exists('*fnameescape')
|
||||
exe "split " . fnameescape(a:fname)
|
||||
else
|
||||
exe "split " . escape(a:fname, " \t\n*?[{`$\\%#'\"|!<")
|
||||
endif
|
||||
|
||||
if a:command != ''
|
||||
exe "normal! " . a:command
|
||||
endif
|
||||
|
||||
redraw
|
||||
endfunc
|
||||
" Load the editexisting package.
|
||||
" For those users who were loading the editexisting plugin from here.
|
||||
packadd editexisting
|
||||
|
||||
+3
-316
@@ -1,316 +1,3 @@
|
||||
" Function to left and right align text.
|
||||
"
|
||||
" Written by: Preben "Peppe" Guldberg <c928400@student.dtu.dk>
|
||||
" Created: 980806 14:13 (or around that time anyway)
|
||||
" Revised: 001103 00:36 (See "Revisions" below)
|
||||
|
||||
|
||||
" function Justify( [ textwidth [, maxspaces [, indent] ] ] )
|
||||
"
|
||||
" Justify() will left and right align a line by filling in an
|
||||
" appropriate amount of spaces. Extra spaces are added to existing
|
||||
" spaces starting from the right side of the line. As an example, the
|
||||
" following documentation has been justified.
|
||||
"
|
||||
" The function takes the following arguments:
|
||||
|
||||
" textwidth argument
|
||||
" ------------------
|
||||
" If not specified, the value of the 'textwidth' option is used. If
|
||||
" 'textwidth' is zero a value of 80 is used.
|
||||
"
|
||||
" Additionally the arguments 'tw' and '' are accepted. The value of
|
||||
" 'textwidth' will be used. These are handy, if you just want to specify
|
||||
" the maxspaces argument.
|
||||
|
||||
" maxspaces argument
|
||||
" ------------------
|
||||
" If specified, alignment will only be done, if the longest space run
|
||||
" after alignment is no longer than maxspaces.
|
||||
"
|
||||
" An argument of '' is accepted, should the user like to specify all
|
||||
" arguments.
|
||||
"
|
||||
" To aid user defined commands, negative values are accepted aswell.
|
||||
" Using a negative value specifies the default behaviour: any length of
|
||||
" space runs will be used to justify the text.
|
||||
|
||||
" indent argument
|
||||
" ---------------
|
||||
" This argument specifies how a line should be indented. The default is
|
||||
" to keep the current indentation.
|
||||
"
|
||||
" Negative values: Keep current amount of leading whitespace.
|
||||
" Positive values: Indent all lines with leading whitespace using this
|
||||
" amount of whitespace.
|
||||
"
|
||||
" Note that the value 0, needs to be quoted as a string. This value
|
||||
" leads to a left flushed text.
|
||||
"
|
||||
" Additionally units of 'shiftwidth'/'sw' and 'tabstop'/'ts' may be
|
||||
" added. In this case, if the value of indent is positive, the amount of
|
||||
" whitespace to be added will be multiplied by the value of the
|
||||
" 'shiftwidth' and 'tabstop' settings. If these units are used, the
|
||||
" argument must be given as a string, eg. Justify('','','2sw').
|
||||
"
|
||||
" If the values of 'sw' or 'tw' are negative, they are treated as if
|
||||
" they were 0, which means that the text is flushed left. There is no
|
||||
" check if a negative number prefix is used to change the sign of a
|
||||
" negative 'sw' or 'ts' value.
|
||||
"
|
||||
" As with the other arguments, '' may be used to get the default
|
||||
" behaviour.
|
||||
|
||||
|
||||
" Notes:
|
||||
"
|
||||
" If the line, adjusted for space runs and leading/trailing whitespace,
|
||||
" is wider than the used textwidth, the line will be left untouched (no
|
||||
" whitespace removed). This should be equivalent to the behaviour of
|
||||
" :left, :right and :center.
|
||||
"
|
||||
" If the resulting line is shorter than the used textwidth it is left
|
||||
" untouched.
|
||||
"
|
||||
" All space runs in the line are truncated before the alignment is
|
||||
" carried out.
|
||||
"
|
||||
" If you have set 'noexpandtab', :retab! is used to replace space runs
|
||||
" with whitespace using the value of 'tabstop'. This should be
|
||||
" conformant with :left, :right and :center.
|
||||
"
|
||||
" If joinspaces is set, an extra space is added after '.', '?' and '!'.
|
||||
" If 'cpooptions' include 'j', extra space is only added after '.'.
|
||||
" (This may on occasion conflict with maxspaces.)
|
||||
|
||||
|
||||
" Related mappings:
|
||||
"
|
||||
" Mappings that will align text using the current text width, using at
|
||||
" most four spaces in a space run and keeping current indentation.
|
||||
nmap _j :%call Justify('tw',4)<CR>
|
||||
vmap _j :call Justify('tw',4)<CR>
|
||||
"
|
||||
" Mappings that will remove space runs and format lines (might be useful
|
||||
" prior to aligning the text).
|
||||
nmap ,gq :%s/\s\+/ /g<CR>gq1G
|
||||
vmap ,gq :s/\s\+/ /g<CR>gvgq
|
||||
|
||||
|
||||
" User defined command:
|
||||
"
|
||||
" The following is an ex command that works as a shortcut to the Justify
|
||||
" function. Arguments to Justify() can be added after the command.
|
||||
com! -range -nargs=* Justify <line1>,<line2>call Justify(<f-args>)
|
||||
"
|
||||
" The following commands are all equivalent:
|
||||
"
|
||||
" 1. Simplest use of Justify():
|
||||
" :call Justify()
|
||||
" :Justify
|
||||
"
|
||||
" 2. The _j mapping above via the ex command:
|
||||
" :%Justify tw 4
|
||||
"
|
||||
" 3. Justify visualised text at 72nd column while indenting all
|
||||
" previously indented text two shiftwidths
|
||||
" :'<,'>call Justify(72,'','2sw')
|
||||
" :'<,'>Justify 72 -1 2sw
|
||||
"
|
||||
" This documentation has been justified using the following command:
|
||||
":se et|kz|1;/^" function Justify(/+,'z-g/^" /s/^" //|call Justify(70,3)|s/^/" /
|
||||
|
||||
" Revisions:
|
||||
" 001103: If 'joinspaces' was set, calculations could be wrong.
|
||||
" Tabs at start of line could also lead to errors.
|
||||
" Use setline() instead of "exec 's/foo/bar/' - safer.
|
||||
" Cleaned up the code a bit.
|
||||
"
|
||||
" Todo: Convert maps to the new script specific form
|
||||
|
||||
" Error function
|
||||
function! Justify_error(message)
|
||||
echohl Error
|
||||
echo "Justify([tw, [maxspaces [, indent]]]): " . a:message
|
||||
echohl None
|
||||
endfunction
|
||||
|
||||
|
||||
" Now for the real thing
|
||||
function! Justify(...) range
|
||||
|
||||
if a:0 > 3
|
||||
call Justify_error("Too many arguments (max 3)")
|
||||
return 1
|
||||
endif
|
||||
|
||||
" Set textwidth (accept 'tw' and '' as arguments)
|
||||
if a:0 >= 1
|
||||
if a:1 =~ '^\(tw\)\=$'
|
||||
let tw = &tw
|
||||
elseif a:1 =~ '^\d\+$'
|
||||
let tw = a:1
|
||||
else
|
||||
call Justify_error("tw must be a number (>0), '' or 'tw'")
|
||||
return 2
|
||||
endif
|
||||
else
|
||||
let tw = &tw
|
||||
endif
|
||||
if tw == 0
|
||||
let tw = 80
|
||||
endif
|
||||
|
||||
" Set maximum number of spaces between WORDs
|
||||
if a:0 >= 2
|
||||
if a:2 == ''
|
||||
let maxspaces = tw
|
||||
elseif a:2 =~ '^-\d\+$'
|
||||
let maxspaces = tw
|
||||
elseif a:2 =~ '^\d\+$'
|
||||
let maxspaces = a:2
|
||||
else
|
||||
call Justify_error("maxspaces must be a number or ''")
|
||||
return 3
|
||||
endif
|
||||
else
|
||||
let maxspaces = tw
|
||||
endif
|
||||
if maxspaces <= 1
|
||||
call Justify_error("maxspaces should be larger than 1")
|
||||
return 4
|
||||
endif
|
||||
|
||||
" Set the indentation style (accept sw and ts units)
|
||||
let indent_fix = ''
|
||||
if a:0 >= 3
|
||||
if (a:3 == '') || a:3 =~ '^-[1-9]\d*\(shiftwidth\|sw\|tabstop\|ts\)\=$'
|
||||
let indent = -1
|
||||
elseif a:3 =~ '^-\=0\(shiftwidth\|sw\|tabstop\|ts\)\=$'
|
||||
let indent = 0
|
||||
elseif a:3 =~ '^\d\+\(shiftwidth\|sw\|tabstop\|ts\)\=$'
|
||||
let indent = substitute(a:3, '\D', '', 'g')
|
||||
elseif a:3 =~ '^\(shiftwidth\|sw\|tabstop\|ts\)$'
|
||||
let indent = 1
|
||||
else
|
||||
call Justify_error("indent: a number with 'sw'/'ts' unit")
|
||||
return 5
|
||||
endif
|
||||
if indent >= 0
|
||||
while indent > 0
|
||||
let indent_fix = indent_fix . ' '
|
||||
let indent = indent - 1
|
||||
endwhile
|
||||
let indent_sw = 0
|
||||
if a:3 =~ '\(shiftwidth\|sw\)'
|
||||
let indent_sw = &sw
|
||||
elseif a:3 =~ '\(tabstop\|ts\)'
|
||||
let indent_sw = &ts
|
||||
endif
|
||||
let indent_fix2 = ''
|
||||
while indent_sw > 0
|
||||
let indent_fix2 = indent_fix2 . indent_fix
|
||||
let indent_sw = indent_sw - 1
|
||||
endwhile
|
||||
let indent_fix = indent_fix2
|
||||
endif
|
||||
else
|
||||
let indent = -1
|
||||
endif
|
||||
|
||||
" Avoid substitution reports
|
||||
let save_report = &report
|
||||
set report=1000000
|
||||
|
||||
" Check 'joinspaces' and 'cpo'
|
||||
if &js == 1
|
||||
if &cpo =~ 'j'
|
||||
let join_str = '\(\. \)'
|
||||
else
|
||||
let join_str = '\([.!?!] \)'
|
||||
endif
|
||||
endif
|
||||
|
||||
let cur = a:firstline
|
||||
while cur <= a:lastline
|
||||
|
||||
let str_orig = getline(cur)
|
||||
let save_et = &et
|
||||
set et
|
||||
exec cur . "retab"
|
||||
let &et = save_et
|
||||
let str = getline(cur)
|
||||
|
||||
let indent_str = indent_fix
|
||||
let indent_n = strlen(indent_str)
|
||||
" Shall we remember the current indentation
|
||||
if indent < 0
|
||||
let indent_orig = matchstr(str_orig, '^\s*')
|
||||
if strlen(indent_orig) > 0
|
||||
let indent_str = indent_orig
|
||||
let indent_n = strlen(matchstr(str, '^\s*'))
|
||||
endif
|
||||
endif
|
||||
|
||||
" Trim trailing, leading and running whitespace
|
||||
let str = substitute(str, '\s\+$', '', '')
|
||||
let str = substitute(str, '^\s\+', '', '')
|
||||
let str = substitute(str, '\s\+', ' ', 'g')
|
||||
let str_n = strdisplaywidth(str)
|
||||
|
||||
" Possible addition of space after punctuation
|
||||
if exists("join_str")
|
||||
let str = substitute(str, join_str, '\1 ', 'g')
|
||||
endif
|
||||
let join_n = strdisplaywidth(str) - str_n
|
||||
|
||||
" Can extraspaces be added?
|
||||
" Note that str_n may be less than strlen(str) [joinspaces above]
|
||||
if strdisplaywidth(str) <= tw - indent_n && str_n > 0
|
||||
" How many spaces should be added
|
||||
let s_add = tw - str_n - indent_n - join_n
|
||||
let s_nr = strlen(substitute(str, '\S', '', 'g') ) - join_n
|
||||
let s_dup = s_add / s_nr
|
||||
let s_mod = s_add % s_nr
|
||||
|
||||
" Test if the changed line fits with tw
|
||||
if 0 <= (str_n + (maxspaces - 1)*s_nr + indent_n) - tw
|
||||
|
||||
" Duplicate spaces
|
||||
while s_dup > 0
|
||||
let str = substitute(str, '\( \+\)', ' \1', 'g')
|
||||
let s_dup = s_dup - 1
|
||||
endwhile
|
||||
|
||||
" Add extra spaces from the end
|
||||
while s_mod > 0
|
||||
let str = substitute(str, '\(\(\s\+\S\+\)\{' . s_mod . '}\)$', ' \1', '')
|
||||
let s_mod = s_mod - 1
|
||||
endwhile
|
||||
|
||||
" Indent the line
|
||||
if indent_n > 0
|
||||
let str = substitute(str, '^', indent_str, '' )
|
||||
endif
|
||||
|
||||
" Replace the line
|
||||
call setline(cur, str)
|
||||
|
||||
" Convert to whitespace
|
||||
if &et == 0
|
||||
exec cur . 'retab!'
|
||||
endif
|
||||
|
||||
endif " Change of line
|
||||
endif " Possible change
|
||||
|
||||
let cur = cur + 1
|
||||
endwhile
|
||||
|
||||
norm ^
|
||||
|
||||
let &report = save_report
|
||||
|
||||
endfunction
|
||||
|
||||
" EOF vim: tw=78 ts=8 sw=4 sts=4 noet ai
|
||||
" Load the justify package.
|
||||
" For those users who were loading the justify plugin from here.
|
||||
packadd justify
|
||||
|
||||
@@ -1,94 +1,3 @@
|
||||
" When you're writing shell scripts and you are in doubt which test to use,
|
||||
" which shell environment variables are defined, what the syntax of the case
|
||||
" statement is, and you need to invoke 'man sh'?
|
||||
"
|
||||
" Your problems are over now!
|
||||
"
|
||||
" Attached is a Vim script file for turning gvim into a shell script editor.
|
||||
" It may also be used as an example how to use menus in Vim.
|
||||
"
|
||||
" Written by: Lennart Schultz <les@dmi.min.dk>
|
||||
|
||||
imenu Stmts.for for in
|
||||
do
|
||||
|
||||
doneki kk0elli
|
||||
imenu Stmts.case case in
|
||||
) ;;
|
||||
esacbki k0elli
|
||||
imenu Stmts.if if
|
||||
then
|
||||
|
||||
fiki kk0elli
|
||||
imenu Stmts.if-else if
|
||||
then
|
||||
|
||||
else
|
||||
|
||||
fiki kki kk0elli
|
||||
imenu Stmts.elif elif
|
||||
then
|
||||
|
||||
ki kk0elli
|
||||
imenu Stmts.while while
|
||||
do
|
||||
|
||||
doneki kk0elli
|
||||
imenu Stmts.break break
|
||||
imenu Stmts.continue continue
|
||||
imenu Stmts.function () {
|
||||
|
||||
}ki k0i
|
||||
imenu Stmts.return return
|
||||
imenu Stmts.return-true return 0
|
||||
imenu Stmts.return-false return 1
|
||||
imenu Stmts.exit exit
|
||||
imenu Stmts.shift shift
|
||||
imenu Stmts.trap trap
|
||||
imenu Test.existence [ -e ]hi
|
||||
imenu Test.existence - file [ -f ]hi
|
||||
imenu Test.existence - file (not empty) [ -s ]hi
|
||||
imenu Test.existence - directory [ -d ]hi
|
||||
imenu Test.existence - executable [ -x ]hi
|
||||
imenu Test.existence - readable [ -r ]hi
|
||||
imenu Test.existence - writable [ -w ]hi
|
||||
imenu Test.String is empty [ x = "x$" ]hhi
|
||||
imenu Test.String is not empty [ x != "x$" ]hhi
|
||||
imenu Test.Strings is equal [ "" = "" ]hhhhhhhi
|
||||
imenu Test.Strings is not equal [ "" != "" ]hhhhhhhhi
|
||||
imenu Test.Values is greater than [ -gt ]hhhhhhi
|
||||
imenu Test.Values is greater equal [ -ge ]hhhhhhi
|
||||
imenu Test.Values is equal [ -eq ]hhhhhhi
|
||||
imenu Test.Values is not equal [ -ne ]hhhhhhi
|
||||
imenu Test.Values is less than [ -lt ]hhhhhhi
|
||||
imenu Test.Values is less equal [ -le ]hhhhhhi
|
||||
imenu ParmSub.Substitute word if parm not set ${:-}hhi
|
||||
imenu ParmSub.Set parm to word if not set ${:=}hhi
|
||||
imenu ParmSub.Substitute word if parm set else nothing ${:+}hhi
|
||||
imenu ParmSub.If parm not set print word and exit ${:?}hhi
|
||||
imenu SpShVars.Number of positional parameters ${#}
|
||||
imenu SpShVars.All positional parameters (quoted spaces) ${*}
|
||||
imenu SpShVars.All positional parameters (unquoted spaces) ${@}
|
||||
imenu SpShVars.Flags set ${-}
|
||||
imenu SpShVars.Return code of last command ${?}
|
||||
imenu SpShVars.Process number of this shell ${$}
|
||||
imenu SpShVars.Process number of last background command ${!}
|
||||
imenu Environ.HOME ${HOME}
|
||||
imenu Environ.PATH ${PATH}
|
||||
imenu Environ.CDPATH ${CDPATH}
|
||||
imenu Environ.MAIL ${MAIL}
|
||||
imenu Environ.MAILCHECK ${MAILCHECK}
|
||||
imenu Environ.PS1 ${PS1}
|
||||
imenu Environ.PS2 ${PS2}
|
||||
imenu Environ.IFS ${IFS}
|
||||
imenu Environ.SHACCT ${SHACCT}
|
||||
imenu Environ.SHELL ${SHELL}
|
||||
imenu Environ.LC_CTYPE ${LC_CTYPE}
|
||||
imenu Environ.LC_MESSAGES ${LC_MESSAGES}
|
||||
imenu Builtins.cd cd
|
||||
imenu Builtins.echo echo
|
||||
imenu Builtins.eval eval
|
||||
imenu Builtins.exec exec
|
||||
imenu Builtins.export export
|
||||
imenu Builtins.getopts getopts
|
||||
imenu Builtins.hash hash
|
||||
" Load the shellmenu package.
|
||||
" For those users who were loading the shellmenu plugin from here.
|
||||
packadd shellmenu
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
" These macros swap the left and right mouse buttons (for left handed)
|
||||
" Don't forget to do ":set mouse=a" or the mouse won't work at all
|
||||
noremap <LeftMouse> <RightMouse>
|
||||
noremap <2-LeftMouse> <2-RightMouse>
|
||||
noremap <3-LeftMouse> <3-RightMouse>
|
||||
noremap <4-LeftMouse> <4-RightMouse>
|
||||
noremap <LeftDrag> <RightDrag>
|
||||
noremap <LeftRelease> <RightRelease>
|
||||
noremap <RightMouse> <LeftMouse>
|
||||
noremap <2-RightMouse> <2-LeftMouse>
|
||||
noremap <3-RightMouse> <3-LeftMouse>
|
||||
noremap <4-RightMouse> <4-LeftMouse>
|
||||
noremap <RightDrag> <LeftDrag>
|
||||
noremap <RightRelease> <LeftRelease>
|
||||
noremap g<LeftMouse> <C-RightMouse>
|
||||
noremap g<RightMouse> <C-LeftMouse>
|
||||
noremap! <LeftMouse> <RightMouse>
|
||||
noremap! <LeftDrag> <RightDrag>
|
||||
noremap! <LeftRelease> <RightRelease>
|
||||
noremap! <RightMouse> <LeftMouse>
|
||||
noremap! <RightDrag> <LeftDrag>
|
||||
noremap! <RightRelease> <LeftRelease>
|
||||
" Load the swapmouse package.
|
||||
" For those users who were loading the swapmous plugin from here.
|
||||
packadd swapmouse
|
||||
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
" Back to Qwerty keyboard after using Dvorak.
|
||||
|
||||
iunmap a
|
||||
iunmap b
|
||||
iunmap c
|
||||
iunmap d
|
||||
iunmap e
|
||||
iunmap f
|
||||
iunmap g
|
||||
iunmap h
|
||||
iunmap i
|
||||
iunmap j
|
||||
iunmap k
|
||||
iunmap l
|
||||
iunmap m
|
||||
iunmap n
|
||||
iunmap o
|
||||
iunmap p
|
||||
iunmap q
|
||||
iunmap r
|
||||
iunmap s
|
||||
iunmap t
|
||||
iunmap u
|
||||
iunmap v
|
||||
iunmap w
|
||||
iunmap x
|
||||
iunmap y
|
||||
iunmap z
|
||||
iunmap ;
|
||||
iunmap '
|
||||
iunmap "
|
||||
iunmap ,
|
||||
iunmap .
|
||||
iunmap /
|
||||
iunmap A
|
||||
iunmap B
|
||||
iunmap C
|
||||
iunmap D
|
||||
iunmap E
|
||||
iunmap F
|
||||
iunmap G
|
||||
iunmap H
|
||||
iunmap I
|
||||
iunmap J
|
||||
iunmap K
|
||||
iunmap L
|
||||
iunmap M
|
||||
iunmap N
|
||||
iunmap O
|
||||
iunmap P
|
||||
iunmap Q
|
||||
iunmap R
|
||||
iunmap S
|
||||
iunmap T
|
||||
iunmap U
|
||||
iunmap V
|
||||
iunmap W
|
||||
iunmap X
|
||||
iunmap Y
|
||||
iunmap Z
|
||||
iunmap <
|
||||
iunmap >
|
||||
iunmap ?
|
||||
iunmap :
|
||||
iunmap [
|
||||
iunmap ]
|
||||
iunmap {
|
||||
iunmap }
|
||||
iunmap -
|
||||
iunmap _
|
||||
iunmap =
|
||||
iunmap +
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
" Dvorak keyboard, only in Insert mode.
|
||||
"
|
||||
" Change "inoremap" to "map!" to also use in Ex mode.
|
||||
" Also change disable.vim then: "iunmap" to "unmap!".
|
||||
"
|
||||
" You may want to add a list of map's too.
|
||||
|
||||
inoremap a a
|
||||
inoremap b x
|
||||
inoremap c j
|
||||
inoremap d e
|
||||
inoremap e .
|
||||
inoremap f u
|
||||
inoremap g i
|
||||
inoremap h d
|
||||
inoremap i c
|
||||
inoremap j h
|
||||
inoremap k t
|
||||
inoremap l n
|
||||
inoremap m m
|
||||
inoremap n b
|
||||
inoremap o r
|
||||
inoremap p l
|
||||
inoremap q '
|
||||
inoremap r p
|
||||
inoremap s o
|
||||
inoremap t y
|
||||
inoremap u g
|
||||
inoremap v k
|
||||
inoremap w ,
|
||||
inoremap x q
|
||||
inoremap y f
|
||||
inoremap z ;
|
||||
inoremap ; s
|
||||
inoremap ' -
|
||||
inoremap " _
|
||||
inoremap , w
|
||||
inoremap . v
|
||||
inoremap / z
|
||||
inoremap A A
|
||||
inoremap B X
|
||||
inoremap C J
|
||||
inoremap D E
|
||||
inoremap E >
|
||||
inoremap F U
|
||||
inoremap G I
|
||||
inoremap H D
|
||||
inoremap I C
|
||||
inoremap J H
|
||||
inoremap K T
|
||||
inoremap L N
|
||||
inoremap M M
|
||||
inoremap N B
|
||||
inoremap O R
|
||||
inoremap P L
|
||||
inoremap Q "
|
||||
inoremap R P
|
||||
inoremap S O
|
||||
inoremap T Y
|
||||
inoremap U G
|
||||
inoremap V K
|
||||
inoremap W <
|
||||
inoremap X Q
|
||||
inoremap Y F
|
||||
inoremap Z :
|
||||
inoremap < W
|
||||
inoremap > V
|
||||
inoremap ? Z
|
||||
inoremap : S
|
||||
inoremap [ /
|
||||
inoremap ] =
|
||||
inoremap { ?
|
||||
inoremap } +
|
||||
inoremap - [
|
||||
inoremap _ {
|
||||
inoremap = ]
|
||||
inoremap + }
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
" When using a dvorak keyboard this file may be of help to you.
|
||||
" These mappings have been made by Lawrence Kesteloot <kesteloo@cs.unc.edu>.
|
||||
" What they do is that the most often used keys, like hjkl, are put in a more
|
||||
" easy to use position.
|
||||
" It may take some time to learn using this.
|
||||
|
||||
if exists("g:loaded_dvorak_plugin")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_dvorak_plugin = 1
|
||||
|
||||
" Key to go into dvorak mode:
|
||||
map ,d :runtime dvorak/enable.vim<CR>
|
||||
|
||||
" Key to get out of dvorak mode:
|
||||
map ,q :runtime dvorak/disable.vim<CR>
|
||||
@@ -0,0 +1,114 @@
|
||||
" Vim Plugin: Edit the file with an existing Vim if possible
|
||||
" Maintainer: Bram Moolenaar
|
||||
" Last Change: 2016 Mar 28
|
||||
|
||||
" To use add ":packadd! editexisting" in your vimrc file.
|
||||
|
||||
" This plugin serves two purposes:
|
||||
" 1. On startup, if we were invoked with one file name argument and the file
|
||||
" is not modified then try to find another Vim instance that is editing
|
||||
" this file. If there is one then bring it to the foreground and exit.
|
||||
" 2. When a file is edited and a swap file exists for it, try finding that
|
||||
" other Vim and bring it to the foreground. Requires Vim 7, because it
|
||||
" uses the SwapExists autocommand event.
|
||||
|
||||
" Function that finds the Vim instance that is editing "filename" and brings
|
||||
" it to the foreground.
|
||||
func s:EditElsewhere(filename)
|
||||
let fname_esc = substitute(a:filename, "'", "''", "g")
|
||||
|
||||
let servers = serverlist()
|
||||
while servers != ''
|
||||
" Get next server name in "servername"; remove it from "servers".
|
||||
let i = match(servers, "\n")
|
||||
if i == -1
|
||||
let servername = servers
|
||||
let servers = ''
|
||||
else
|
||||
let servername = strpart(servers, 0, i)
|
||||
let servers = strpart(servers, i + 1)
|
||||
endif
|
||||
|
||||
" Skip ourselves.
|
||||
if servername ==? v:servername
|
||||
continue
|
||||
endif
|
||||
|
||||
" Check if this server is editing our file.
|
||||
if remote_expr(servername, "bufloaded('" . fname_esc . "')")
|
||||
" Yes, bring it to the foreground.
|
||||
if has("win32")
|
||||
call remote_foreground(servername)
|
||||
endif
|
||||
call remote_expr(servername, "foreground()")
|
||||
|
||||
if remote_expr(servername, "exists('*EditExisting')")
|
||||
" Make sure the file is visible in a window (not hidden).
|
||||
" If v:swapcommand exists and is set, send it to the server.
|
||||
if exists("v:swapcommand")
|
||||
let c = substitute(v:swapcommand, "'", "''", "g")
|
||||
call remote_expr(servername, "EditExisting('" . fname_esc . "', '" . c . "')")
|
||||
else
|
||||
call remote_expr(servername, "EditExisting('" . fname_esc . "', '')")
|
||||
endif
|
||||
endif
|
||||
|
||||
if !(has('vim_starting') && has('gui_running') && has('gui_win32'))
|
||||
" Tell the user what is happening. Not when the GUI is starting
|
||||
" though, it would result in a message box.
|
||||
echomsg "File is being edited by " . servername
|
||||
sleep 2
|
||||
endif
|
||||
return 'q'
|
||||
endif
|
||||
endwhile
|
||||
return ''
|
||||
endfunc
|
||||
|
||||
" When the plugin is loaded and there is one file name argument: Find another
|
||||
" Vim server that is editing this file right now.
|
||||
if argc() == 1 && !&modified
|
||||
if s:EditElsewhere(expand("%:p")) == 'q'
|
||||
quit
|
||||
endif
|
||||
endif
|
||||
|
||||
" Setup for handling the situation that an existing swap file is found.
|
||||
try
|
||||
au! SwapExists * let v:swapchoice = s:EditElsewhere(expand("<afile>:p"))
|
||||
catch
|
||||
" Without SwapExists we don't do anything for ":edit" commands
|
||||
endtry
|
||||
|
||||
" Function used on the server to make the file visible and possibly execute a
|
||||
" command.
|
||||
func! EditExisting(fname, command)
|
||||
" Get the window number of the file in the current tab page.
|
||||
let winnr = bufwinnr(a:fname)
|
||||
if winnr <= 0
|
||||
" Not found, look in other tab pages.
|
||||
let bufnr = bufnr(a:fname)
|
||||
for i in range(tabpagenr('$'))
|
||||
if index(tabpagebuflist(i + 1), bufnr) >= 0
|
||||
" Make this tab page the current one and find the window number.
|
||||
exe 'tabnext ' . (i + 1)
|
||||
let winnr = bufwinnr(a:fname)
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
if winnr > 0
|
||||
exe winnr . "wincmd w"
|
||||
elseif exists('*fnameescape')
|
||||
exe "split " . fnameescape(a:fname)
|
||||
else
|
||||
exe "split " . escape(a:fname, " \t\n*?[{`$\\%#'\"|!<")
|
||||
endif
|
||||
|
||||
if a:command != ''
|
||||
exe "normal! " . a:command
|
||||
endif
|
||||
|
||||
redraw
|
||||
endfunc
|
||||
+316
@@ -0,0 +1,316 @@
|
||||
" Function to left and right align text.
|
||||
"
|
||||
" Written by: Preben "Peppe" Guldberg <c928400@student.dtu.dk>
|
||||
" Created: 980806 14:13 (or around that time anyway)
|
||||
" Revised: 001103 00:36 (See "Revisions" below)
|
||||
|
||||
|
||||
" function Justify( [ textwidth [, maxspaces [, indent] ] ] )
|
||||
"
|
||||
" Justify() will left and right align a line by filling in an
|
||||
" appropriate amount of spaces. Extra spaces are added to existing
|
||||
" spaces starting from the right side of the line. As an example, the
|
||||
" following documentation has been justified.
|
||||
"
|
||||
" The function takes the following arguments:
|
||||
|
||||
" textwidth argument
|
||||
" ------------------
|
||||
" If not specified, the value of the 'textwidth' option is used. If
|
||||
" 'textwidth' is zero a value of 80 is used.
|
||||
"
|
||||
" Additionally the arguments 'tw' and '' are accepted. The value of
|
||||
" 'textwidth' will be used. These are handy, if you just want to specify
|
||||
" the maxspaces argument.
|
||||
|
||||
" maxspaces argument
|
||||
" ------------------
|
||||
" If specified, alignment will only be done, if the longest space run
|
||||
" after alignment is no longer than maxspaces.
|
||||
"
|
||||
" An argument of '' is accepted, should the user like to specify all
|
||||
" arguments.
|
||||
"
|
||||
" To aid user defined commands, negative values are accepted aswell.
|
||||
" Using a negative value specifies the default behaviour: any length of
|
||||
" space runs will be used to justify the text.
|
||||
|
||||
" indent argument
|
||||
" ---------------
|
||||
" This argument specifies how a line should be indented. The default is
|
||||
" to keep the current indentation.
|
||||
"
|
||||
" Negative values: Keep current amount of leading whitespace.
|
||||
" Positive values: Indent all lines with leading whitespace using this
|
||||
" amount of whitespace.
|
||||
"
|
||||
" Note that the value 0, needs to be quoted as a string. This value
|
||||
" leads to a left flushed text.
|
||||
"
|
||||
" Additionally units of 'shiftwidth'/'sw' and 'tabstop'/'ts' may be
|
||||
" added. In this case, if the value of indent is positive, the amount of
|
||||
" whitespace to be added will be multiplied by the value of the
|
||||
" 'shiftwidth' and 'tabstop' settings. If these units are used, the
|
||||
" argument must be given as a string, eg. Justify('','','2sw').
|
||||
"
|
||||
" If the values of 'sw' or 'tw' are negative, they are treated as if
|
||||
" they were 0, which means that the text is flushed left. There is no
|
||||
" check if a negative number prefix is used to change the sign of a
|
||||
" negative 'sw' or 'ts' value.
|
||||
"
|
||||
" As with the other arguments, '' may be used to get the default
|
||||
" behaviour.
|
||||
|
||||
|
||||
" Notes:
|
||||
"
|
||||
" If the line, adjusted for space runs and leading/trailing whitespace,
|
||||
" is wider than the used textwidth, the line will be left untouched (no
|
||||
" whitespace removed). This should be equivalent to the behaviour of
|
||||
" :left, :right and :center.
|
||||
"
|
||||
" If the resulting line is shorter than the used textwidth it is left
|
||||
" untouched.
|
||||
"
|
||||
" All space runs in the line are truncated before the alignment is
|
||||
" carried out.
|
||||
"
|
||||
" If you have set 'noexpandtab', :retab! is used to replace space runs
|
||||
" with whitespace using the value of 'tabstop'. This should be
|
||||
" conformant with :left, :right and :center.
|
||||
"
|
||||
" If joinspaces is set, an extra space is added after '.', '?' and '!'.
|
||||
" If 'cpooptions' include 'j', extra space is only added after '.'.
|
||||
" (This may on occasion conflict with maxspaces.)
|
||||
|
||||
|
||||
" Related mappings:
|
||||
"
|
||||
" Mappings that will align text using the current text width, using at
|
||||
" most four spaces in a space run and keeping current indentation.
|
||||
nmap _j :%call Justify('tw',4)<CR>
|
||||
vmap _j :call Justify('tw',4)<CR>
|
||||
"
|
||||
" Mappings that will remove space runs and format lines (might be useful
|
||||
" prior to aligning the text).
|
||||
nmap ,gq :%s/\s\+/ /g<CR>gq1G
|
||||
vmap ,gq :s/\s\+/ /g<CR>gvgq
|
||||
|
||||
|
||||
" User defined command:
|
||||
"
|
||||
" The following is an ex command that works as a shortcut to the Justify
|
||||
" function. Arguments to Justify() can be added after the command.
|
||||
com! -range -nargs=* Justify <line1>,<line2>call Justify(<f-args>)
|
||||
"
|
||||
" The following commands are all equivalent:
|
||||
"
|
||||
" 1. Simplest use of Justify():
|
||||
" :call Justify()
|
||||
" :Justify
|
||||
"
|
||||
" 2. The _j mapping above via the ex command:
|
||||
" :%Justify tw 4
|
||||
"
|
||||
" 3. Justify visualised text at 72nd column while indenting all
|
||||
" previously indented text two shiftwidths
|
||||
" :'<,'>call Justify(72,'','2sw')
|
||||
" :'<,'>Justify 72 -1 2sw
|
||||
"
|
||||
" This documentation has been justified using the following command:
|
||||
":se et|kz|1;/^" function Justify(/+,'z-g/^" /s/^" //|call Justify(70,3)|s/^/" /
|
||||
|
||||
" Revisions:
|
||||
" 001103: If 'joinspaces' was set, calculations could be wrong.
|
||||
" Tabs at start of line could also lead to errors.
|
||||
" Use setline() instead of "exec 's/foo/bar/' - safer.
|
||||
" Cleaned up the code a bit.
|
||||
"
|
||||
" Todo: Convert maps to the new script specific form
|
||||
|
||||
" Error function
|
||||
function! Justify_error(message)
|
||||
echohl Error
|
||||
echo "Justify([tw, [maxspaces [, indent]]]): " . a:message
|
||||
echohl None
|
||||
endfunction
|
||||
|
||||
|
||||
" Now for the real thing
|
||||
function! Justify(...) range
|
||||
|
||||
if a:0 > 3
|
||||
call Justify_error("Too many arguments (max 3)")
|
||||
return 1
|
||||
endif
|
||||
|
||||
" Set textwidth (accept 'tw' and '' as arguments)
|
||||
if a:0 >= 1
|
||||
if a:1 =~ '^\(tw\)\=$'
|
||||
let tw = &tw
|
||||
elseif a:1 =~ '^\d\+$'
|
||||
let tw = a:1
|
||||
else
|
||||
call Justify_error("tw must be a number (>0), '' or 'tw'")
|
||||
return 2
|
||||
endif
|
||||
else
|
||||
let tw = &tw
|
||||
endif
|
||||
if tw == 0
|
||||
let tw = 80
|
||||
endif
|
||||
|
||||
" Set maximum number of spaces between WORDs
|
||||
if a:0 >= 2
|
||||
if a:2 == ''
|
||||
let maxspaces = tw
|
||||
elseif a:2 =~ '^-\d\+$'
|
||||
let maxspaces = tw
|
||||
elseif a:2 =~ '^\d\+$'
|
||||
let maxspaces = a:2
|
||||
else
|
||||
call Justify_error("maxspaces must be a number or ''")
|
||||
return 3
|
||||
endif
|
||||
else
|
||||
let maxspaces = tw
|
||||
endif
|
||||
if maxspaces <= 1
|
||||
call Justify_error("maxspaces should be larger than 1")
|
||||
return 4
|
||||
endif
|
||||
|
||||
" Set the indentation style (accept sw and ts units)
|
||||
let indent_fix = ''
|
||||
if a:0 >= 3
|
||||
if (a:3 == '') || a:3 =~ '^-[1-9]\d*\(shiftwidth\|sw\|tabstop\|ts\)\=$'
|
||||
let indent = -1
|
||||
elseif a:3 =~ '^-\=0\(shiftwidth\|sw\|tabstop\|ts\)\=$'
|
||||
let indent = 0
|
||||
elseif a:3 =~ '^\d\+\(shiftwidth\|sw\|tabstop\|ts\)\=$'
|
||||
let indent = substitute(a:3, '\D', '', 'g')
|
||||
elseif a:3 =~ '^\(shiftwidth\|sw\|tabstop\|ts\)$'
|
||||
let indent = 1
|
||||
else
|
||||
call Justify_error("indent: a number with 'sw'/'ts' unit")
|
||||
return 5
|
||||
endif
|
||||
if indent >= 0
|
||||
while indent > 0
|
||||
let indent_fix = indent_fix . ' '
|
||||
let indent = indent - 1
|
||||
endwhile
|
||||
let indent_sw = 0
|
||||
if a:3 =~ '\(shiftwidth\|sw\)'
|
||||
let indent_sw = &sw
|
||||
elseif a:3 =~ '\(tabstop\|ts\)'
|
||||
let indent_sw = &ts
|
||||
endif
|
||||
let indent_fix2 = ''
|
||||
while indent_sw > 0
|
||||
let indent_fix2 = indent_fix2 . indent_fix
|
||||
let indent_sw = indent_sw - 1
|
||||
endwhile
|
||||
let indent_fix = indent_fix2
|
||||
endif
|
||||
else
|
||||
let indent = -1
|
||||
endif
|
||||
|
||||
" Avoid substitution reports
|
||||
let save_report = &report
|
||||
set report=1000000
|
||||
|
||||
" Check 'joinspaces' and 'cpo'
|
||||
if &js == 1
|
||||
if &cpo =~ 'j'
|
||||
let join_str = '\(\. \)'
|
||||
else
|
||||
let join_str = '\([.!?!] \)'
|
||||
endif
|
||||
endif
|
||||
|
||||
let cur = a:firstline
|
||||
while cur <= a:lastline
|
||||
|
||||
let str_orig = getline(cur)
|
||||
let save_et = &et
|
||||
set et
|
||||
exec cur . "retab"
|
||||
let &et = save_et
|
||||
let str = getline(cur)
|
||||
|
||||
let indent_str = indent_fix
|
||||
let indent_n = strlen(indent_str)
|
||||
" Shall we remember the current indentation
|
||||
if indent < 0
|
||||
let indent_orig = matchstr(str_orig, '^\s*')
|
||||
if strlen(indent_orig) > 0
|
||||
let indent_str = indent_orig
|
||||
let indent_n = strlen(matchstr(str, '^\s*'))
|
||||
endif
|
||||
endif
|
||||
|
||||
" Trim trailing, leading and running whitespace
|
||||
let str = substitute(str, '\s\+$', '', '')
|
||||
let str = substitute(str, '^\s\+', '', '')
|
||||
let str = substitute(str, '\s\+', ' ', 'g')
|
||||
let str_n = strdisplaywidth(str)
|
||||
|
||||
" Possible addition of space after punctuation
|
||||
if exists("join_str")
|
||||
let str = substitute(str, join_str, '\1 ', 'g')
|
||||
endif
|
||||
let join_n = strdisplaywidth(str) - str_n
|
||||
|
||||
" Can extraspaces be added?
|
||||
" Note that str_n may be less than strlen(str) [joinspaces above]
|
||||
if strdisplaywidth(str) <= tw - indent_n && str_n > 0
|
||||
" How many spaces should be added
|
||||
let s_add = tw - str_n - indent_n - join_n
|
||||
let s_nr = strlen(substitute(str, '\S', '', 'g') ) - join_n
|
||||
let s_dup = s_add / s_nr
|
||||
let s_mod = s_add % s_nr
|
||||
|
||||
" Test if the changed line fits with tw
|
||||
if 0 <= (str_n + (maxspaces - 1)*s_nr + indent_n) - tw
|
||||
|
||||
" Duplicate spaces
|
||||
while s_dup > 0
|
||||
let str = substitute(str, '\( \+\)', ' \1', 'g')
|
||||
let s_dup = s_dup - 1
|
||||
endwhile
|
||||
|
||||
" Add extra spaces from the end
|
||||
while s_mod > 0
|
||||
let str = substitute(str, '\(\(\s\+\S\+\)\{' . s_mod . '}\)$', ' \1', '')
|
||||
let s_mod = s_mod - 1
|
||||
endwhile
|
||||
|
||||
" Indent the line
|
||||
if indent_n > 0
|
||||
let str = substitute(str, '^', indent_str, '' )
|
||||
endif
|
||||
|
||||
" Replace the line
|
||||
call setline(cur, str)
|
||||
|
||||
" Convert to whitespace
|
||||
if &et == 0
|
||||
exec cur . 'retab!'
|
||||
endif
|
||||
|
||||
endif " Change of line
|
||||
endif " Possible change
|
||||
|
||||
let cur = cur + 1
|
||||
endwhile
|
||||
|
||||
norm ^
|
||||
|
||||
let &report = save_report
|
||||
|
||||
endfunction
|
||||
|
||||
" EOF vim: tw=78 ts=8 sw=4 sts=4 noet ai
|
||||
+5
-8
@@ -4,7 +4,7 @@ For instructions on installing this file, type
|
||||
:help matchit-install
|
||||
inside Vim.
|
||||
|
||||
For Vim version 6.3. Last change: 2007 Aug 29
|
||||
For Vim version 6.3. Last change: 2016 Mar 28
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Benji Fisher
|
||||
@@ -152,13 +152,10 @@ setting |b:match_skip|.
|
||||
==============================================================================
|
||||
2. Activation *matchit-activate*
|
||||
|
||||
You can use this script as a plugin, by copying it to your plugin directory.
|
||||
See |add-global-plugin| for instructions. You can also add a line to your
|
||||
|vimrc| file, such as >
|
||||
:source $VIMRUNTIME/macros/matchit.vim
|
||||
or >
|
||||
:runtime macros/matchit.vim
|
||||
Either way, the script should start working the next time you start up Vim.
|
||||
To use the matchit plugin add this line to your |vimrc|: >
|
||||
packadd! matchit
|
||||
|
||||
The script should start working the next time you start Vim.
|
||||
|
||||
(Earlier versions of the script did nothing unless a |buffer-variable| named
|
||||
|b:match_words| was defined. Even earlier versions contained autocommands
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
" When you're writing shell scripts and you are in doubt which test to use,
|
||||
" which shell environment variables are defined, what the syntax of the case
|
||||
" statement is, and you need to invoke 'man sh'?
|
||||
"
|
||||
" Your problems are over now!
|
||||
"
|
||||
" Attached is a Vim script file for turning gvim into a shell script editor.
|
||||
" It may also be used as an example how to use menus in Vim.
|
||||
"
|
||||
" Written by: Lennart Schultz <les@dmi.min.dk>
|
||||
|
||||
imenu Stmts.for for in
|
||||
do
|
||||
|
||||
doneki kk0elli
|
||||
imenu Stmts.case case in
|
||||
) ;;
|
||||
esacbki k0elli
|
||||
imenu Stmts.if if
|
||||
then
|
||||
|
||||
fiki kk0elli
|
||||
imenu Stmts.if-else if
|
||||
then
|
||||
|
||||
else
|
||||
|
||||
fiki kki kk0elli
|
||||
imenu Stmts.elif elif
|
||||
then
|
||||
|
||||
ki kk0elli
|
||||
imenu Stmts.while while
|
||||
do
|
||||
|
||||
doneki kk0elli
|
||||
imenu Stmts.break break
|
||||
imenu Stmts.continue continue
|
||||
imenu Stmts.function () {
|
||||
|
||||
}ki k0i
|
||||
imenu Stmts.return return
|
||||
imenu Stmts.return-true return 0
|
||||
imenu Stmts.return-false return 1
|
||||
imenu Stmts.exit exit
|
||||
imenu Stmts.shift shift
|
||||
imenu Stmts.trap trap
|
||||
imenu Test.existence [ -e ]hi
|
||||
imenu Test.existence - file [ -f ]hi
|
||||
imenu Test.existence - file (not empty) [ -s ]hi
|
||||
imenu Test.existence - directory [ -d ]hi
|
||||
imenu Test.existence - executable [ -x ]hi
|
||||
imenu Test.existence - readable [ -r ]hi
|
||||
imenu Test.existence - writable [ -w ]hi
|
||||
imenu Test.String is empty [ x = "x$" ]hhi
|
||||
imenu Test.String is not empty [ x != "x$" ]hhi
|
||||
imenu Test.Strings is equal [ "" = "" ]hhhhhhhi
|
||||
imenu Test.Strings is not equal [ "" != "" ]hhhhhhhhi
|
||||
imenu Test.Values is greater than [ -gt ]hhhhhhi
|
||||
imenu Test.Values is greater equal [ -ge ]hhhhhhi
|
||||
imenu Test.Values is equal [ -eq ]hhhhhhi
|
||||
imenu Test.Values is not equal [ -ne ]hhhhhhi
|
||||
imenu Test.Values is less than [ -lt ]hhhhhhi
|
||||
imenu Test.Values is less equal [ -le ]hhhhhhi
|
||||
imenu ParmSub.Substitute word if parm not set ${:-}hhi
|
||||
imenu ParmSub.Set parm to word if not set ${:=}hhi
|
||||
imenu ParmSub.Substitute word if parm set else nothing ${:+}hhi
|
||||
imenu ParmSub.If parm not set print word and exit ${:?}hhi
|
||||
imenu SpShVars.Number of positional parameters ${#}
|
||||
imenu SpShVars.All positional parameters (quoted spaces) ${*}
|
||||
imenu SpShVars.All positional parameters (unquoted spaces) ${@}
|
||||
imenu SpShVars.Flags set ${-}
|
||||
imenu SpShVars.Return code of last command ${?}
|
||||
imenu SpShVars.Process number of this shell ${$}
|
||||
imenu SpShVars.Process number of last background command ${!}
|
||||
imenu Environ.HOME ${HOME}
|
||||
imenu Environ.PATH ${PATH}
|
||||
imenu Environ.CDPATH ${CDPATH}
|
||||
imenu Environ.MAIL ${MAIL}
|
||||
imenu Environ.MAILCHECK ${MAILCHECK}
|
||||
imenu Environ.PS1 ${PS1}
|
||||
imenu Environ.PS2 ${PS2}
|
||||
imenu Environ.IFS ${IFS}
|
||||
imenu Environ.SHACCT ${SHACCT}
|
||||
imenu Environ.SHELL ${SHELL}
|
||||
imenu Environ.LC_CTYPE ${LC_CTYPE}
|
||||
imenu Environ.LC_MESSAGES ${LC_MESSAGES}
|
||||
imenu Builtins.cd cd
|
||||
imenu Builtins.echo echo
|
||||
imenu Builtins.eval eval
|
||||
imenu Builtins.exec exec
|
||||
imenu Builtins.export export
|
||||
imenu Builtins.getopts getopts
|
||||
imenu Builtins.hash hash
|
||||
@@ -0,0 +1,22 @@
|
||||
" These macros swap the left and right mouse buttons (for left handed)
|
||||
" Don't forget to do ":set mouse=a" or the mouse won't work at all
|
||||
noremap <LeftMouse> <RightMouse>
|
||||
noremap <2-LeftMouse> <2-RightMouse>
|
||||
noremap <3-LeftMouse> <3-RightMouse>
|
||||
noremap <4-LeftMouse> <4-RightMouse>
|
||||
noremap <LeftDrag> <RightDrag>
|
||||
noremap <LeftRelease> <RightRelease>
|
||||
noremap <RightMouse> <LeftMouse>
|
||||
noremap <2-RightMouse> <2-LeftMouse>
|
||||
noremap <3-RightMouse> <3-LeftMouse>
|
||||
noremap <4-RightMouse> <4-LeftMouse>
|
||||
noremap <RightDrag> <LeftDrag>
|
||||
noremap <RightRelease> <LeftRelease>
|
||||
noremap g<LeftMouse> <C-RightMouse>
|
||||
noremap g<RightMouse> <C-LeftMouse>
|
||||
noremap! <LeftMouse> <RightMouse>
|
||||
noremap! <LeftDrag> <RightDrag>
|
||||
noremap! <LeftRelease> <RightRelease>
|
||||
noremap! <RightMouse> <LeftMouse>
|
||||
noremap! <RightDrag> <LeftDrag>
|
||||
noremap! <RightRelease> <LeftRelease>
|
||||
@@ -2,8 +2,8 @@
|
||||
" Language: shell (sh) Korn shell (ksh) bash (sh)
|
||||
" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz>
|
||||
" Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int>
|
||||
" Last Change: Feb 18, 2016
|
||||
" Version: 145
|
||||
" Last Change: Mar 12, 2016
|
||||
" Version: 146
|
||||
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH
|
||||
" For options and settings, please use: :help ft-sh-syntax
|
||||
" This file includes many ideas from Eric Brunet (eric.brunet@ens.fr)
|
||||
@@ -185,7 +185,7 @@ endif
|
||||
|
||||
" Options: {{{1
|
||||
" ====================
|
||||
syn match shOption "\s\zs[-+][-_a-zA-Z0-9#]\+"
|
||||
syn match shOption "\s\zs[-+][-_a-zA-Z#@]\+"
|
||||
syn match shOption "\s\zs--[^ \t$`'"|);]\+"
|
||||
|
||||
" File Redirection Highlighted As Operators: {{{1
|
||||
@@ -317,7 +317,8 @@ syn match shColon '^\s*\zs:'
|
||||
|
||||
" String And Character Constants: {{{1
|
||||
"================================
|
||||
syn match shNumber "-\=\<\d\+\>#\="
|
||||
syn match shNumber "\<\d\+\>#\="
|
||||
syn match shNumber "-\=\.\=\d\+\>#\="
|
||||
syn match shCtrlSeq "\\\d\d\d\|\\[abcfnrtv0]" contained
|
||||
if exists("b:is_bash")
|
||||
syn match shSpecial "\\\o\o\o\|\\x\x\x\|\\c[^"]\|\\[abefnrtv]" contained
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
" Vim syntax file
|
||||
" Language: TeX
|
||||
" Maintainer: Charles E. Campbell <NdrchipO@ScampbellPfamily.AbizM>
|
||||
" Last Change: Feb 18, 2016
|
||||
" Version: 92
|
||||
" Last Change: Mar 07, 2016
|
||||
" Version: 93
|
||||
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX
|
||||
"
|
||||
" Notes: {{{1
|
||||
@@ -296,7 +296,7 @@ syn match texTypeStyle "\\sc\>"
|
||||
syn match texTypeStyle "\\tt\>"
|
||||
|
||||
" Type Styles: attributes, commands, families, etc (LaTeX2E): {{{1
|
||||
if s:tex_conceal !~ 'b'
|
||||
if s:tex_conceal !~# 'b'
|
||||
syn match texTypeStyle "\\textbf\>"
|
||||
syn match texTypeStyle "\\textit\>"
|
||||
endif
|
||||
@@ -541,7 +541,7 @@ if !exists("g:tex_no_math")
|
||||
syn match texOnlyMath "[_^]"
|
||||
endif
|
||||
syn match texSpecialChar "\^\^[0-9a-f]\{2}\|\^\^\S"
|
||||
if s:tex_conceal !~ 'S'
|
||||
if s:tex_conceal !~# 'S'
|
||||
syn match texSpecialChar '\\glq\>' contained conceal cchar=‚
|
||||
syn match texSpecialChar '\\grq\>' contained conceal cchar=‘
|
||||
syn match texSpecialChar '\\glqq\>' contained conceal cchar=„
|
||||
|
||||
@@ -1255,7 +1255,7 @@
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>100</string>
|
||||
<string>101</string>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
|
||||
+389
-67
@@ -437,7 +437,6 @@ channel_read_fd(int fd)
|
||||
|
||||
/*
|
||||
* Read a command from netbeans.
|
||||
* TODO: instead of channel ID use the FD.
|
||||
*/
|
||||
#ifdef FEAT_GUI_X11
|
||||
static void
|
||||
@@ -993,6 +992,7 @@ channel_set_job(channel_T *channel, job_T *job, jobopt_T *options)
|
||||
/* Special mode: send last-but-one line when appending a line
|
||||
* to the buffer. */
|
||||
in_part->ch_buffer->b_write_to_channel = TRUE;
|
||||
in_part->ch_buf_append = TRUE;
|
||||
in_part->ch_buf_top =
|
||||
in_part->ch_buffer->b_ml.ml_line_count + 1;
|
||||
}
|
||||
@@ -1067,6 +1067,8 @@ channel_set_options(channel_T *channel, jobopt_T *opt)
|
||||
channel->ch_part[PART_OUT].ch_timeout = opt->jo_out_timeout;
|
||||
if (opt->jo_set & JO_ERR_TIMEOUT)
|
||||
channel->ch_part[PART_ERR].ch_timeout = opt->jo_err_timeout;
|
||||
if (opt->jo_set & JO_BLOCK_WRITE)
|
||||
channel->ch_part[PART_IN].ch_block_write = 1;
|
||||
|
||||
if (opt->jo_set & JO_CALLBACK)
|
||||
{
|
||||
@@ -1120,7 +1122,7 @@ channel_set_options(channel_T *channel, jobopt_T *opt)
|
||||
*cbp = vim_strsave(opt->jo_close_cb);
|
||||
else
|
||||
*cbp = NULL;
|
||||
*pp = opt->jo_err_partial;
|
||||
*pp = opt->jo_close_partial;
|
||||
if (*pp != NULL)
|
||||
++(*pp)->pt_refcount;
|
||||
}
|
||||
@@ -1203,7 +1205,6 @@ write_buf_line(buf_T *buf, linenr_T lnum, channel_T *channel)
|
||||
int len = (int)STRLEN(line);
|
||||
char_u *p;
|
||||
|
||||
/* TODO: check if channel can be written to, do not block on write */
|
||||
if ((p = alloc(len + 2)) == NULL)
|
||||
return;
|
||||
STRCPY(p, line);
|
||||
@@ -1213,10 +1214,79 @@ write_buf_line(buf_T *buf, linenr_T lnum, channel_T *channel)
|
||||
vim_free(p);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return TRUE if "channel" can be written to.
|
||||
* Returns FALSE if the input is closed or the write would block.
|
||||
*/
|
||||
static int
|
||||
can_write_buf_line(channel_T *channel)
|
||||
{
|
||||
chanpart_T *in_part = &channel->ch_part[PART_IN];
|
||||
|
||||
if (in_part->ch_fd == INVALID_FD)
|
||||
return FALSE; /* pipe was closed */
|
||||
|
||||
/* for testing: block every other attempt to write */
|
||||
if (in_part->ch_block_write == 1)
|
||||
in_part->ch_block_write = -1;
|
||||
else if (in_part->ch_block_write == -1)
|
||||
in_part->ch_block_write = 1;
|
||||
|
||||
/* TODO: Win32 implementation, probably using WaitForMultipleObjects() */
|
||||
#ifndef WIN32
|
||||
{
|
||||
# if defined(HAVE_SELECT)
|
||||
struct timeval tval;
|
||||
fd_set wfds;
|
||||
int ret;
|
||||
|
||||
FD_ZERO(&wfds);
|
||||
FD_SET((int)in_part->ch_fd, &wfds);
|
||||
tval.tv_sec = 0;
|
||||
tval.tv_usec = 0;
|
||||
for (;;)
|
||||
{
|
||||
ret = select((int)in_part->ch_fd + 1, NULL, &wfds, NULL, &tval);
|
||||
# ifdef EINTR
|
||||
SOCK_ERRNO;
|
||||
if (ret == -1 && errno == EINTR)
|
||||
continue;
|
||||
# endif
|
||||
if (ret <= 0 || in_part->ch_block_write == 1)
|
||||
{
|
||||
if (ret > 0)
|
||||
ch_log(channel, "FAKED Input not ready for writing");
|
||||
else
|
||||
ch_log(channel, "Input not ready for writing");
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
# else
|
||||
struct pollfd fds;
|
||||
|
||||
fds.fd = in_part->ch_fd;
|
||||
fds.events = POLLOUT;
|
||||
if (poll(&fds, 1, 0) <= 0)
|
||||
{
|
||||
ch_log(channel, "Input not ready for writing");
|
||||
return FALSE;
|
||||
}
|
||||
if (in_part->ch_block_write == 1)
|
||||
{
|
||||
ch_log(channel, "FAKED Input not ready for writing");
|
||||
return FALSE;
|
||||
}
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write any lines to the input channel.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
channel_write_in(channel_T *channel)
|
||||
{
|
||||
chanpart_T *in_part = &channel->ch_part[PART_IN];
|
||||
@@ -1224,21 +1294,20 @@ channel_write_in(channel_T *channel)
|
||||
buf_T *buf = in_part->ch_buffer;
|
||||
int written = 0;
|
||||
|
||||
if (buf == NULL)
|
||||
return;
|
||||
if (buf == NULL || in_part->ch_buf_append)
|
||||
return; /* no buffer or using appending */
|
||||
if (!buf_valid(buf) || buf->b_ml.ml_mfp == NULL)
|
||||
{
|
||||
/* buffer was wiped out or unloaded */
|
||||
in_part->ch_buffer = NULL;
|
||||
return;
|
||||
}
|
||||
if (in_part->ch_fd == INVALID_FD)
|
||||
/* pipe was closed */
|
||||
return;
|
||||
|
||||
for (lnum = in_part->ch_buf_top; lnum <= in_part->ch_buf_bot
|
||||
&& lnum <= buf->b_ml.ml_line_count; ++lnum)
|
||||
{
|
||||
if (!can_write_buf_line(channel))
|
||||
break;
|
||||
write_buf_line(buf, lnum, channel);
|
||||
++written;
|
||||
}
|
||||
@@ -1249,6 +1318,37 @@ channel_write_in(channel_T *channel)
|
||||
ch_logn(channel, "written %d lines to channel", written);
|
||||
|
||||
in_part->ch_buf_top = lnum;
|
||||
if (lnum > buf->b_ml.ml_line_count)
|
||||
{
|
||||
/* Writing is done, no longer need the buffer. */
|
||||
in_part->ch_buffer = NULL;
|
||||
ch_log(channel, "Finished writing all lines to channel");
|
||||
}
|
||||
else
|
||||
ch_logn(channel, "Still %d more lines to write",
|
||||
buf->b_ml.ml_line_count - lnum + 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Write any lines waiting to be written to a channel.
|
||||
*/
|
||||
void
|
||||
channel_write_any_lines()
|
||||
{
|
||||
channel_T *channel;
|
||||
|
||||
for (channel = first_channel; channel != NULL; channel = channel->ch_next)
|
||||
{
|
||||
chanpart_T *in_part = &channel->ch_part[PART_IN];
|
||||
|
||||
if (in_part->ch_buffer != NULL)
|
||||
{
|
||||
if (in_part->ch_buf_append)
|
||||
channel_write_new_lines(in_part->ch_buffer);
|
||||
else
|
||||
channel_write_in(channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1268,15 +1368,16 @@ channel_write_new_lines(buf_T *buf)
|
||||
linenr_T lnum;
|
||||
int written = 0;
|
||||
|
||||
if (in_part->ch_buffer == buf)
|
||||
if (in_part->ch_buffer == buf && in_part->ch_buf_append)
|
||||
{
|
||||
if (in_part->ch_fd == INVALID_FD)
|
||||
/* pipe was closed */
|
||||
continue;
|
||||
continue; /* pipe was closed */
|
||||
found_one = TRUE;
|
||||
for (lnum = in_part->ch_buf_bot; lnum < buf->b_ml.ml_line_count;
|
||||
++lnum)
|
||||
{
|
||||
if (!can_write_buf_line(channel))
|
||||
break;
|
||||
write_buf_line(buf, lnum, channel);
|
||||
++written;
|
||||
}
|
||||
@@ -1285,6 +1386,9 @@ channel_write_new_lines(buf_T *buf)
|
||||
ch_logn(channel, "written line %d to channel", (int)lnum - 1);
|
||||
else if (written > 1)
|
||||
ch_logn(channel, "written %d lines to channel", written);
|
||||
if (lnum < buf->b_ml.ml_line_count)
|
||||
ch_logn(channel, "Still %d more lines to write",
|
||||
buf->b_ml.ml_line_count - lnum);
|
||||
|
||||
in_part->ch_buf_bot = lnum;
|
||||
}
|
||||
@@ -1344,11 +1448,34 @@ channel_get(channel_T *channel, int part)
|
||||
static char_u *
|
||||
channel_get_all(channel_T *channel, int part)
|
||||
{
|
||||
/* Concatenate everything into one buffer.
|
||||
* TODO: avoid multiple allocations. */
|
||||
while (channel_collapse(channel, part) == OK)
|
||||
;
|
||||
return channel_get(channel, part);
|
||||
readq_T *head = &channel->ch_part[part].ch_head;
|
||||
readq_T *node = head->rq_next;
|
||||
long_u len = 1;
|
||||
char_u *res;
|
||||
char_u *p;
|
||||
|
||||
/* If there is only one buffer just get that one. */
|
||||
if (head->rq_next == NULL || head->rq_next->rq_next == NULL)
|
||||
return channel_get(channel, part);
|
||||
|
||||
/* Concatenate everything into one buffer. */
|
||||
for (node = head->rq_next; node != NULL; node = node->rq_next)
|
||||
len += (long_u)STRLEN(node->rq_buffer);
|
||||
res = lalloc(len, TRUE);
|
||||
if (res == NULL)
|
||||
return NULL;
|
||||
*res = NUL;
|
||||
for (node = head->rq_next; node != NULL; node = node->rq_next)
|
||||
STRCAT(res, node->rq_buffer);
|
||||
|
||||
/* Free all buffers */
|
||||
do
|
||||
{
|
||||
p = channel_get(channel, part);
|
||||
vim_free(p);
|
||||
} while (p != NULL);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1384,10 +1511,12 @@ channel_collapse(channel_T *channel, int part)
|
||||
|
||||
/*
|
||||
* Store "buf[len]" on "channel"/"part".
|
||||
* When "prepend" is TRUE put in front, otherwise append at the end.
|
||||
* Returns OK or FAIL.
|
||||
*/
|
||||
static int
|
||||
channel_save(channel_T *channel, int part, char_u *buf, int len, char *lead)
|
||||
channel_save(channel_T *channel, int part, char_u *buf, int len,
|
||||
int prepend, char *lead)
|
||||
{
|
||||
readq_T *node;
|
||||
readq_T *head = &channel->ch_part[part].ch_head;
|
||||
@@ -1419,14 +1548,28 @@ channel_save(channel_T *channel, int part, char_u *buf, int len, char *lead)
|
||||
node->rq_buffer[len] = NUL;
|
||||
}
|
||||
|
||||
/* append node to the tail of the queue */
|
||||
node->rq_next = NULL;
|
||||
node->rq_prev = head->rq_prev;
|
||||
if (head->rq_prev == NULL)
|
||||
if (prepend)
|
||||
{
|
||||
/* preend node to the head of the queue */
|
||||
node->rq_next = head->rq_next;
|
||||
node->rq_prev = NULL;
|
||||
if (head->rq_next == NULL)
|
||||
head->rq_prev = node;
|
||||
else
|
||||
head->rq_next->rq_prev = node;
|
||||
head->rq_next = node;
|
||||
}
|
||||
else
|
||||
head->rq_prev->rq_next = node;
|
||||
head->rq_prev = node;
|
||||
{
|
||||
/* append node to the tail of the queue */
|
||||
node->rq_next = NULL;
|
||||
node->rq_prev = head->rq_prev;
|
||||
if (head->rq_prev == NULL)
|
||||
head->rq_next = node;
|
||||
else
|
||||
head->rq_prev->rq_next = node;
|
||||
head->rq_prev = node;
|
||||
}
|
||||
|
||||
if (log_fd != NULL && lead != NULL)
|
||||
{
|
||||
@@ -1439,6 +1582,42 @@ channel_save(channel_T *channel, int part, char_u *buf, int len, char *lead)
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int
|
||||
channel_fill(js_read_T *reader)
|
||||
{
|
||||
channel_T *channel = (channel_T *)reader->js_cookie;
|
||||
int part = reader->js_cookie_arg;
|
||||
char_u *next = channel_get(channel, part);
|
||||
int unused;
|
||||
int len;
|
||||
char_u *p;
|
||||
|
||||
if (next == NULL)
|
||||
return FALSE;
|
||||
|
||||
unused = reader->js_end - reader->js_buf - reader->js_used;
|
||||
if (unused > 0)
|
||||
{
|
||||
/* Prepend unused text. */
|
||||
len = (int)STRLEN(next);
|
||||
p = alloc(unused + len + 1);
|
||||
if (p == NULL)
|
||||
{
|
||||
vim_free(next);
|
||||
return FALSE;
|
||||
}
|
||||
mch_memmove(p, reader->js_buf + reader->js_used, unused);
|
||||
mch_memmove(p + unused, next, len + 1);
|
||||
vim_free(next);
|
||||
next = p;
|
||||
}
|
||||
|
||||
vim_free(reader->js_buf);
|
||||
reader->js_buf = next;
|
||||
reader->js_used = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Use the read buffer of "channel"/"part" and parse a JSON message that is
|
||||
* complete. The messages are added to the queue.
|
||||
@@ -1458,19 +1637,17 @@ channel_parse_json(channel_T *channel, int part)
|
||||
if (channel_peek(channel, part) == NULL)
|
||||
return FALSE;
|
||||
|
||||
/* TODO: make reader work properly */
|
||||
/* reader.js_buf = channel_peek(channel, part); */
|
||||
reader.js_buf = channel_get_all(channel, part);
|
||||
reader.js_buf = channel_get(channel, part);
|
||||
reader.js_used = 0;
|
||||
reader.js_fill = NULL;
|
||||
/* reader.js_fill = channel_fill; */
|
||||
reader.js_fill = channel_fill;
|
||||
reader.js_cookie = channel;
|
||||
reader.js_cookie_arg = part;
|
||||
|
||||
/* When a message is incomplete we wait for a short while for more to
|
||||
* arrive. After the delay drop the input, otherwise a truncated string
|
||||
* or list will make us hang. */
|
||||
status = json_decode(&reader, &listtv,
|
||||
chanpart->ch_mode == MODE_JS ? JSON_JS : 0);
|
||||
chanpart->ch_mode == MODE_JS ? JSON_JS : 0);
|
||||
if (status == OK)
|
||||
{
|
||||
/* Only accept the response when it is a list with at least two
|
||||
@@ -1571,10 +1748,10 @@ channel_parse_json(channel_T *channel, int part)
|
||||
}
|
||||
else if (reader.js_buf[reader.js_used] != NUL)
|
||||
{
|
||||
/* Put the unread part back into the channel.
|
||||
* TODO: insert in front */
|
||||
/* Put the unread part back into the channel. */
|
||||
channel_save(channel, part, reader.js_buf + reader.js_used,
|
||||
(int)(reader.js_end - reader.js_buf) - reader.js_used, NULL);
|
||||
(int)(reader.js_end - reader.js_buf) - reader.js_used,
|
||||
TRUE, NULL);
|
||||
ret = status == MAYBE ? FALSE: TRUE;
|
||||
}
|
||||
else
|
||||
@@ -1680,8 +1857,17 @@ channel_exe_cmd(channel_T *channel, int part, typval_T *argv)
|
||||
|
||||
if (STRCMP(cmd, "ex") == 0)
|
||||
{
|
||||
int save_called_emsg = called_emsg;
|
||||
|
||||
called_emsg = FALSE;
|
||||
ch_logs(channel, "Executing ex command '%s'", (char *)arg);
|
||||
++emsg_silent;
|
||||
do_cmdline_cmd(arg);
|
||||
--emsg_silent;
|
||||
if (called_emsg)
|
||||
ch_logs(channel, "Ex command error: '%s'",
|
||||
(char *)get_vim_var_str(VV_ERRMSG));
|
||||
called_emsg = save_called_emsg;
|
||||
}
|
||||
else if (STRCMP(cmd, "normal") == 0)
|
||||
{
|
||||
@@ -2117,11 +2303,11 @@ channel_status(channel_T *channel)
|
||||
channel_part_info(channel_T *channel, dict_T *dict, char *name, int part)
|
||||
{
|
||||
chanpart_T *chanpart = &channel->ch_part[part];
|
||||
char namebuf[20];
|
||||
char namebuf[20]; /* longest is "sock_timeout" */
|
||||
size_t tail;
|
||||
char *s = "";
|
||||
|
||||
STRCPY(namebuf, name);
|
||||
vim_strncpy((char_u *)namebuf, (char_u *)name, 4);
|
||||
STRCAT(namebuf, "_");
|
||||
tail = STRLEN(namebuf);
|
||||
|
||||
@@ -2317,6 +2503,57 @@ channel_free_all(void)
|
||||
/* Buffer size for reading incoming messages. */
|
||||
#define MAXMSGSIZE 4096
|
||||
|
||||
#if defined(HAVE_SELECT)
|
||||
/*
|
||||
* Add write fds where we are waiting for writing to be possible.
|
||||
*/
|
||||
static int
|
||||
channel_fill_wfds(int maxfd_arg, fd_set *wfds)
|
||||
{
|
||||
int maxfd = maxfd_arg;
|
||||
channel_T *ch;
|
||||
|
||||
for (ch = first_channel; ch != NULL; ch = ch->ch_next)
|
||||
{
|
||||
chanpart_T *in_part = &ch->ch_part[PART_IN];
|
||||
|
||||
if (in_part->ch_fd != INVALID_FD && in_part->ch_buffer != NULL)
|
||||
{
|
||||
FD_SET((int)in_part->ch_fd, wfds);
|
||||
if ((int)in_part->ch_fd >= maxfd)
|
||||
maxfd = (int)in_part->ch_fd + 1;
|
||||
}
|
||||
}
|
||||
return maxfd;
|
||||
}
|
||||
#else
|
||||
/*
|
||||
* Add write fds where we are waiting for writing to be possible.
|
||||
*/
|
||||
static int
|
||||
channel_fill_poll_write(int nfd_in, struct pollfd *fds)
|
||||
{
|
||||
int nfd = nfd_in;
|
||||
channel_T *ch;
|
||||
|
||||
for (ch = first_channel; ch != NULL; ch = ch->ch_next)
|
||||
{
|
||||
chanpart_T *in_part = &ch->ch_part[PART_IN];
|
||||
|
||||
if (in_part->ch_fd != INVALID_FD && in_part->ch_buffer != NULL)
|
||||
{
|
||||
in_part->ch_poll_idx = nfd;
|
||||
fds[nfd].fd = in_part->ch_fd;
|
||||
fds[nfd].events = POLLOUT;
|
||||
++nfd;
|
||||
}
|
||||
else
|
||||
in_part->ch_poll_idx = -1;
|
||||
}
|
||||
return nfd;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Check for reading from "fd" with "timeout" msec.
|
||||
* Return FAIL when there is nothing to read.
|
||||
@@ -2331,8 +2568,9 @@ channel_wait(channel_T *channel, sock_T fd, int timeout)
|
||||
if (fd != channel->CH_SOCK_FD)
|
||||
{
|
||||
DWORD nread;
|
||||
int diff;
|
||||
int sleep_time;
|
||||
DWORD deadline = GetTickCount() + timeout;
|
||||
int delay = 1;
|
||||
|
||||
/* reading from a pipe, not a socket */
|
||||
while (TRUE)
|
||||
@@ -2340,12 +2578,21 @@ channel_wait(channel_T *channel, sock_T fd, int timeout)
|
||||
if (PeekNamedPipe((HANDLE)fd, NULL, 0, NULL, &nread, NULL)
|
||||
&& nread > 0)
|
||||
return OK;
|
||||
diff = deadline - GetTickCount();
|
||||
if (diff <= 0)
|
||||
|
||||
/* perhaps write some buffer lines */
|
||||
channel_write_any_lines();
|
||||
|
||||
sleep_time = deadline - GetTickCount();
|
||||
if (sleep_time <= 0)
|
||||
break;
|
||||
/* Wait for 5 msec.
|
||||
* TODO: increase the sleep time when looping more often */
|
||||
Sleep(5);
|
||||
/* Wait for a little while. Very short at first, up to 10 msec
|
||||
* after looping a few times. */
|
||||
if (sleep_time > delay)
|
||||
sleep_time = delay;
|
||||
Sleep(sleep_time);
|
||||
delay = delay * 2;
|
||||
if (delay > 10)
|
||||
delay = 10;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2354,31 +2601,56 @@ channel_wait(channel_T *channel, sock_T fd, int timeout)
|
||||
#if defined(HAVE_SELECT)
|
||||
struct timeval tval;
|
||||
fd_set rfds;
|
||||
int ret;
|
||||
fd_set wfds;
|
||||
int ret;
|
||||
int maxfd;
|
||||
|
||||
FD_ZERO(&rfds);
|
||||
FD_SET((int)fd, &rfds);
|
||||
tval.tv_sec = timeout / 1000;
|
||||
tval.tv_usec = (timeout % 1000) * 1000;
|
||||
for (;;)
|
||||
{
|
||||
ret = select((int)fd + 1, &rfds, NULL, NULL, &tval);
|
||||
FD_ZERO(&rfds);
|
||||
FD_SET((int)fd, &rfds);
|
||||
|
||||
/* Write lines to a pipe when a pipe can be written to. Need to
|
||||
* set this every time, some buffers may be done. */
|
||||
maxfd = (int)fd + 1;
|
||||
FD_ZERO(&wfds);
|
||||
maxfd = channel_fill_wfds(maxfd, &wfds);
|
||||
|
||||
ret = select(maxfd, &rfds, &wfds, NULL, &tval);
|
||||
# ifdef EINTR
|
||||
SOCK_ERRNO;
|
||||
if (ret == -1 && errno == EINTR)
|
||||
continue;
|
||||
# endif
|
||||
if (ret > 0)
|
||||
return OK;
|
||||
{
|
||||
if (FD_ISSET(fd, &rfds))
|
||||
return OK;
|
||||
channel_write_any_lines();
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
#else
|
||||
struct pollfd fds;
|
||||
for (;;)
|
||||
{
|
||||
struct pollfd fds[MAX_OPEN_CHANNELS + 1];
|
||||
int nfd = 1;
|
||||
|
||||
fds.fd = fd;
|
||||
fds.events = POLLIN;
|
||||
if (poll(&fds, 1, timeout) > 0)
|
||||
return OK;
|
||||
fds[0].fd = fd;
|
||||
fds[0].events = POLLIN;
|
||||
nfd = channel_fill_poll_write(nfd, fds);
|
||||
if (poll(fds, nfd, timeout) > 0)
|
||||
{
|
||||
if (fds[0].revents & POLLIN)
|
||||
return OK;
|
||||
channel_write_any_lines();
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return FAIL;
|
||||
@@ -2429,7 +2701,7 @@ channel_read(channel_T *channel, int part, char *func)
|
||||
break; /* error or nothing more to read */
|
||||
|
||||
/* Store the read message in the queue. */
|
||||
channel_save(channel, part, buf, len, "RECV ");
|
||||
channel_save(channel, part, buf, len, FALSE, "RECV ");
|
||||
readlen += len;
|
||||
if (len < MAXMSGSIZE)
|
||||
break; /* did read everything that's available */
|
||||
@@ -2456,11 +2728,10 @@ channel_read(channel_T *channel, int part, char *func)
|
||||
if (channel->ch_part[part].ch_mode == MODE_RAW
|
||||
|| channel->ch_part[part].ch_mode == MODE_NL)
|
||||
channel_save(channel, part, (char_u *)DETACH_MSG_RAW,
|
||||
(int)STRLEN(DETACH_MSG_RAW), "PUT ");
|
||||
(int)STRLEN(DETACH_MSG_RAW), FALSE, "PUT ");
|
||||
|
||||
/* TODO: When reading from stdout is not possible, should we try to
|
||||
* keep stdin and stderr open? Probably not, assume the other side
|
||||
* has died. */
|
||||
/* When reading from stdout is not possible, assume the other side has
|
||||
* died. */
|
||||
channel_close(channel, TRUE);
|
||||
if (channel->ch_nb_close_cb != NULL)
|
||||
(*channel->ch_nb_close_cb)();
|
||||
@@ -2943,10 +3214,12 @@ channel_poll_setup(int nfd_in, void *fds_in)
|
||||
{
|
||||
for (part = PART_SOCK; part < PART_IN; ++part)
|
||||
{
|
||||
if (channel->ch_part[part].ch_fd != INVALID_FD)
|
||||
chanpart_T *ch_part = &channel->ch_part[part];
|
||||
|
||||
if (ch_part->ch_fd != INVALID_FD)
|
||||
{
|
||||
channel->ch_part[part].ch_poll_idx = nfd;
|
||||
fds[nfd].fd = channel->ch_part[part].ch_fd;
|
||||
ch_part->ch_poll_idx = nfd;
|
||||
fds[nfd].fd = ch_part->ch_fd;
|
||||
fds[nfd].events = POLLIN;
|
||||
nfd++;
|
||||
}
|
||||
@@ -2955,6 +3228,8 @@ channel_poll_setup(int nfd_in, void *fds_in)
|
||||
}
|
||||
}
|
||||
|
||||
nfd = channel_fill_poll_write(nfd, fds);
|
||||
|
||||
return nfd;
|
||||
}
|
||||
|
||||
@@ -2968,19 +3243,35 @@ channel_poll_check(int ret_in, void *fds_in)
|
||||
channel_T *channel;
|
||||
struct pollfd *fds = fds_in;
|
||||
int part;
|
||||
int idx;
|
||||
chanpart_T *in_part;
|
||||
|
||||
for (channel = first_channel; channel != NULL; channel = channel->ch_next)
|
||||
{
|
||||
for (part = PART_SOCK; part < PART_IN; ++part)
|
||||
{
|
||||
int idx = channel->ch_part[part].ch_poll_idx;
|
||||
idx = channel->ch_part[part].ch_poll_idx;
|
||||
|
||||
if (ret > 0 && idx != -1 && fds[idx].revents & POLLIN)
|
||||
if (ret > 0 && idx != -1 && (fds[idx].revents & POLLIN))
|
||||
{
|
||||
channel_read(channel, part, "channel_poll_check");
|
||||
--ret;
|
||||
}
|
||||
}
|
||||
|
||||
in_part = &channel->ch_part[PART_IN];
|
||||
idx = in_part->ch_poll_idx;
|
||||
if (ret > 0 && idx != -1 && (fds[idx].revents & POLLOUT))
|
||||
{
|
||||
if (in_part->ch_buf_append)
|
||||
{
|
||||
if (in_part->ch_buffer != NULL)
|
||||
channel_write_new_lines(in_part->ch_buffer);
|
||||
}
|
||||
else
|
||||
channel_write_in(channel);
|
||||
--ret;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -2989,14 +3280,15 @@ channel_poll_check(int ret_in, void *fds_in)
|
||||
|
||||
# if (!defined(WIN32) && defined(HAVE_SELECT)) || defined(PROTO)
|
||||
/*
|
||||
* The type of "rfds" is hidden to avoid problems with the function proto.
|
||||
* The "fd_set" type is hidden to avoid problems with the function proto.
|
||||
*/
|
||||
int
|
||||
channel_select_setup(int maxfd_in, void *rfds_in)
|
||||
channel_select_setup(int maxfd_in, void *rfds_in, void *wfds_in)
|
||||
{
|
||||
int maxfd = maxfd_in;
|
||||
channel_T *channel;
|
||||
fd_set *rfds = rfds_in;
|
||||
fd_set *wfds = wfds_in;
|
||||
int part;
|
||||
|
||||
for (channel = first_channel; channel != NULL; channel = channel->ch_next)
|
||||
@@ -3014,19 +3306,23 @@ channel_select_setup(int maxfd_in, void *rfds_in)
|
||||
}
|
||||
}
|
||||
|
||||
maxfd = channel_fill_wfds(maxfd, wfds);
|
||||
|
||||
return maxfd;
|
||||
}
|
||||
|
||||
/*
|
||||
* The type of "rfds" is hidden to avoid problems with the function proto.
|
||||
* The "fd_set" type is hidden to avoid problems with the function proto.
|
||||
*/
|
||||
int
|
||||
channel_select_check(int ret_in, void *rfds_in)
|
||||
channel_select_check(int ret_in, void *rfds_in, void *wfds_in)
|
||||
{
|
||||
int ret = ret_in;
|
||||
channel_T *channel;
|
||||
fd_set *rfds = rfds_in;
|
||||
fd_set *wfds = wfds_in;
|
||||
int part;
|
||||
chanpart_T *in_part;
|
||||
|
||||
for (channel = first_channel; channel != NULL; channel = channel->ch_next)
|
||||
{
|
||||
@@ -3040,6 +3336,20 @@ channel_select_check(int ret_in, void *rfds_in)
|
||||
--ret;
|
||||
}
|
||||
}
|
||||
|
||||
in_part = &channel->ch_part[PART_IN];
|
||||
if (ret > 0 && in_part->ch_fd != INVALID_FD
|
||||
&& FD_ISSET(in_part->ch_fd, wfds))
|
||||
{
|
||||
if (in_part->ch_buf_append)
|
||||
{
|
||||
if (in_part->ch_buffer != NULL)
|
||||
channel_write_new_lines(in_part->ch_buffer);
|
||||
}
|
||||
else
|
||||
channel_write_in(channel);
|
||||
--ret;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -3541,6 +3851,13 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported)
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
else if (STRCMP(hi->hi_key, "block_write") == 0)
|
||||
{
|
||||
if (!(supported & JO_BLOCK_WRITE))
|
||||
break;
|
||||
opt->jo_set |= JO_BLOCK_WRITE;
|
||||
opt->jo_block_write = get_tv_number(item);
|
||||
}
|
||||
else
|
||||
break;
|
||||
--todo;
|
||||
@@ -3760,8 +4077,8 @@ job_start(typval_T *argvars)
|
||||
clear_job_options(&opt);
|
||||
opt.jo_mode = MODE_NL;
|
||||
if (get_job_options(&argvars[1], &opt,
|
||||
JO_MODE_ALL + JO_CB_ALL + JO_TIMEOUT_ALL
|
||||
+ JO_STOPONEXIT + JO_EXIT_CB + JO_OUT_IO) == FAIL)
|
||||
JO_MODE_ALL + JO_CB_ALL + JO_TIMEOUT_ALL + JO_STOPONEXIT
|
||||
+ JO_EXIT_CB + JO_OUT_IO + JO_BLOCK_WRITE) == FAIL)
|
||||
return job;
|
||||
|
||||
/* Check that when io is "file" that there is a file name. */
|
||||
@@ -3822,6 +4139,11 @@ job_start(typval_T *argvars)
|
||||
{
|
||||
/* Command is a string. */
|
||||
cmd = argvars[0].vval.v_string;
|
||||
if (cmd == NULL || *cmd == NUL)
|
||||
{
|
||||
EMSG(_(e_invarg));
|
||||
return job;
|
||||
}
|
||||
#ifdef USE_ARGV
|
||||
if (mch_parse_cmd(cmd, FALSE, &argv, &argc) == FAIL)
|
||||
return job;
|
||||
|
||||
@@ -762,6 +762,7 @@ install_bat_choice(int idx)
|
||||
fprintf(fd, "@echo off\n");
|
||||
fprintf(fd, "rem -- Run Vim --\n");
|
||||
fprintf(fd, "\n");
|
||||
fprintf(fd, "setlocal\n");
|
||||
|
||||
/* Don't use double quotes for the "set" argument, also when it
|
||||
* contains a space. The quotes would be included in the value
|
||||
@@ -793,6 +794,9 @@ install_bat_choice(int idx)
|
||||
fprintf(fd, "if .%%1==. goto loopend\n");
|
||||
if (*exename == 'g')
|
||||
{
|
||||
fprintf(fd, "if NOT .%%1==.--nofork goto noforklongarg\n");
|
||||
fprintf(fd, "set VIMNOFORK=1\n");
|
||||
fprintf(fd, ":noforklongarg\n");
|
||||
fprintf(fd, "if NOT .%%1==.-f goto noforkarg\n");
|
||||
fprintf(fd, "set VIMNOFORK=1\n");
|
||||
fprintf(fd, ":noforkarg\n");
|
||||
|
||||
+201
-48
@@ -372,6 +372,7 @@ static struct vimvar
|
||||
{VV_NAME("true", VAR_SPECIAL), VV_RO},
|
||||
{VV_NAME("null", VAR_SPECIAL), VV_RO},
|
||||
{VV_NAME("none", VAR_SPECIAL), VV_RO},
|
||||
{VV_NAME("vim_did_enter", VAR_NUMBER), VV_RO},
|
||||
};
|
||||
|
||||
/* shorthand */
|
||||
@@ -474,6 +475,9 @@ static void f_assert_equal(typval_T *argvars, typval_T *rettv);
|
||||
static void f_assert_exception(typval_T *argvars, typval_T *rettv);
|
||||
static void f_assert_fails(typval_T *argvars, typval_T *rettv);
|
||||
static void f_assert_false(typval_T *argvars, typval_T *rettv);
|
||||
static void f_assert_match(typval_T *argvars, typval_T *rettv);
|
||||
static void f_assert_notequal(typval_T *argvars, typval_T *rettv);
|
||||
static void f_assert_notmatch(typval_T *argvars, typval_T *rettv);
|
||||
static void f_assert_true(typval_T *argvars, typval_T *rettv);
|
||||
#ifdef FEAT_FLOAT
|
||||
static void f_asin(typval_T *argvars, typval_T *rettv);
|
||||
@@ -671,6 +675,7 @@ static void f_matchdelete(typval_T *argvars, typval_T *rettv);
|
||||
static void f_matchend(typval_T *argvars, typval_T *rettv);
|
||||
static void f_matchlist(typval_T *argvars, typval_T *rettv);
|
||||
static void f_matchstr(typval_T *argvars, typval_T *rettv);
|
||||
static void f_matchstrpos(typval_T *argvars, typval_T *rettv);
|
||||
static void f_max(typval_T *argvars, typval_T *rettv);
|
||||
static void f_min(typval_T *argvars, typval_T *rettv);
|
||||
#ifdef vim_mkdir
|
||||
@@ -931,6 +936,11 @@ eval_init(void)
|
||||
for (i = 0; i < VV_LEN; ++i)
|
||||
{
|
||||
p = &vimvars[i];
|
||||
if (STRLEN(p->vv_name) > 16)
|
||||
{
|
||||
EMSG("INTERNAL: name too long, increase size of dictitem16_T");
|
||||
getout(1);
|
||||
}
|
||||
STRCPY(p->vv_di.di_key, p->vv_name);
|
||||
if (p->vv_flags & VV_RO)
|
||||
p->vv_di.di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
|
||||
@@ -2772,11 +2782,9 @@ get_lval(
|
||||
if (len == -1)
|
||||
{
|
||||
/* "[key]": get key from "var1" */
|
||||
key = get_tv_string(&var1); /* is number or string */
|
||||
if (*key == NUL)
|
||||
key = get_tv_string_chk(&var1); /* is number or string */
|
||||
if (key == NULL)
|
||||
{
|
||||
if (!quiet)
|
||||
EMSG(_(e_emptykey));
|
||||
clear_tv(&var1);
|
||||
return NULL;
|
||||
}
|
||||
@@ -3397,6 +3405,12 @@ set_context_for_expression(
|
||||
got_eq = TRUE;
|
||||
xp->xp_context = EXPAND_EXPRESSION;
|
||||
}
|
||||
else if (c == '#'
|
||||
&& xp->xp_context == EXPAND_EXPRESSION)
|
||||
{
|
||||
/* Autoload function/variable contains '#'. */
|
||||
break;
|
||||
}
|
||||
else if ((c == '<' || c == '#')
|
||||
&& xp->xp_context == EXPAND_FUNCTIONS
|
||||
&& vim_strchr(xp->xp_pattern, '(') == NULL)
|
||||
@@ -4104,6 +4118,31 @@ get_user_var_name(expand_T *xp, int idx)
|
||||
|
||||
#endif /* FEAT_CMDL_COMPL */
|
||||
|
||||
/*
|
||||
* Return TRUE if "pat" matches "text".
|
||||
* Does not use 'cpo' and always uses 'magic'.
|
||||
*/
|
||||
static int
|
||||
pattern_match(char_u *pat, char_u *text, int ic)
|
||||
{
|
||||
int matches = FALSE;
|
||||
char_u *save_cpo;
|
||||
regmatch_T regmatch;
|
||||
|
||||
/* avoid 'l' flag in 'cpoptions' */
|
||||
save_cpo = p_cpo;
|
||||
p_cpo = (char_u *)"";
|
||||
regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING);
|
||||
if (regmatch.regprog != NULL)
|
||||
{
|
||||
regmatch.rm_ic = ic;
|
||||
matches = vim_regexec_nl(®match, text, (colnr_T)0);
|
||||
vim_regfree(regmatch.regprog);
|
||||
}
|
||||
p_cpo = save_cpo;
|
||||
return matches;
|
||||
}
|
||||
|
||||
/*
|
||||
* types for expressions.
|
||||
*/
|
||||
@@ -4402,9 +4441,7 @@ eval4(char_u **arg, typval_T *rettv, int evaluate)
|
||||
long n1, n2;
|
||||
char_u *s1, *s2;
|
||||
char_u buf1[NUMBUFLEN], buf2[NUMBUFLEN];
|
||||
regmatch_T regmatch;
|
||||
int ic;
|
||||
char_u *save_cpo;
|
||||
|
||||
/*
|
||||
* Get the first variable.
|
||||
@@ -4645,20 +4682,9 @@ eval4(char_u **arg, typval_T *rettv, int evaluate)
|
||||
|
||||
case TYPE_MATCH:
|
||||
case TYPE_NOMATCH:
|
||||
/* avoid 'l' flag in 'cpoptions' */
|
||||
save_cpo = p_cpo;
|
||||
p_cpo = (char_u *)"";
|
||||
regmatch.regprog = vim_regcomp(s2,
|
||||
RE_MAGIC + RE_STRING);
|
||||
regmatch.rm_ic = ic;
|
||||
if (regmatch.regprog != NULL)
|
||||
{
|
||||
n1 = vim_regexec_nl(®match, s1, (colnr_T)0);
|
||||
vim_regfree(regmatch.regprog);
|
||||
if (type == TYPE_NOMATCH)
|
||||
n1 = !n1;
|
||||
}
|
||||
p_cpo = save_cpo;
|
||||
n1 = pattern_match(s2, s1, ic);
|
||||
if (type == TYPE_NOMATCH)
|
||||
n1 = !n1;
|
||||
break;
|
||||
|
||||
case TYPE_UNKNOWN: break; /* avoid gcc warning */
|
||||
@@ -5595,11 +5621,9 @@ eval_index(
|
||||
|
||||
if (len == -1)
|
||||
{
|
||||
key = get_tv_string(&var1);
|
||||
if (*key == NUL)
|
||||
key = get_tv_string_chk(&var1);
|
||||
if (key == NULL)
|
||||
{
|
||||
if (verbose)
|
||||
EMSG(_(e_emptykey));
|
||||
clear_tv(&var1);
|
||||
return FAIL;
|
||||
}
|
||||
@@ -6007,6 +6031,7 @@ rettv_list_alloc(typval_T *rettv)
|
||||
|
||||
rettv->vval.v_list = l;
|
||||
rettv->v_type = VAR_LIST;
|
||||
rettv->v_lock = 0;
|
||||
++l->lv_refcount;
|
||||
return OK;
|
||||
}
|
||||
@@ -7257,6 +7282,7 @@ rettv_dict_alloc(typval_T *rettv)
|
||||
|
||||
rettv->vval.v_dict = d;
|
||||
rettv->v_type = VAR_DICT;
|
||||
rettv->v_lock = 0;
|
||||
++d->dv_refcount;
|
||||
return OK;
|
||||
}
|
||||
@@ -7724,11 +7750,9 @@ get_dict_tv(char_u **arg, typval_T *rettv, int evaluate)
|
||||
if (evaluate)
|
||||
{
|
||||
key = get_tv_string_buf_chk(&tvkey, buf);
|
||||
if (key == NULL || *key == NUL)
|
||||
if (key == NULL)
|
||||
{
|
||||
/* "key" is NULL when get_tv_string_buf_chk() gave an errmsg */
|
||||
if (key != NULL)
|
||||
EMSG(_(e_emptykey));
|
||||
clear_tv(&tvkey);
|
||||
goto failret;
|
||||
}
|
||||
@@ -8153,6 +8177,9 @@ static struct fst
|
||||
{"assert_exception", 1, 2, f_assert_exception},
|
||||
{"assert_fails", 1, 2, f_assert_fails},
|
||||
{"assert_false", 1, 2, f_assert_false},
|
||||
{"assert_match", 2, 3, f_assert_match},
|
||||
{"assert_notequal", 2, 3, f_assert_notequal},
|
||||
{"assert_notmatch", 2, 3, f_assert_notmatch},
|
||||
{"assert_true", 1, 2, f_assert_true},
|
||||
#ifdef FEAT_FLOAT
|
||||
{"atan", 1, 1, f_atan},
|
||||
@@ -8355,6 +8382,7 @@ static struct fst
|
||||
{"matchend", 2, 4, f_matchend},
|
||||
{"matchlist", 2, 4, f_matchlist},
|
||||
{"matchstr", 2, 4, f_matchstr},
|
||||
{"matchstrpos", 2, 4, f_matchstrpos},
|
||||
{"max", 1, 1, f_max},
|
||||
{"min", 1, 1, f_min},
|
||||
#ifdef vim_mkdir
|
||||
@@ -9293,8 +9321,17 @@ f_argv(typval_T *argvars, typval_T *rettv)
|
||||
alist_name(&ARGLIST[idx]), -1);
|
||||
}
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ASSERT_EQUAL,
|
||||
ASSERT_NOTEQUAL,
|
||||
ASSERT_MATCH,
|
||||
ASSERT_NOTMATCH,
|
||||
ASSERT_OTHER,
|
||||
} assert_type_T;
|
||||
|
||||
static void prepare_assert_error(garray_T*gap);
|
||||
static void fill_assert_error(garray_T *gap, typval_T *opt_msg_tv, char_u *exp_str, typval_T *exp_tv, typval_T *got_tv);
|
||||
static void fill_assert_error(garray_T *gap, typval_T *opt_msg_tv, char_u *exp_str, typval_T *exp_tv, typval_T *got_tv, assert_type_T is_match);
|
||||
static void assert_error(garray_T *gap);
|
||||
static void assert_bool(typval_T *argvars, int isTrue);
|
||||
|
||||
@@ -9369,7 +9406,8 @@ fill_assert_error(
|
||||
typval_T *opt_msg_tv,
|
||||
char_u *exp_str,
|
||||
typval_T *exp_tv,
|
||||
typval_T *got_tv)
|
||||
typval_T *got_tv,
|
||||
assert_type_T atype)
|
||||
{
|
||||
char_u numbuf[NUMBUFLEN];
|
||||
char_u *tofree;
|
||||
@@ -9381,7 +9419,10 @@ fill_assert_error(
|
||||
}
|
||||
else
|
||||
{
|
||||
ga_concat(gap, (char_u *)"Expected ");
|
||||
if (atype == ASSERT_MATCH || atype == ASSERT_NOTMATCH)
|
||||
ga_concat(gap, (char_u *)"Pattern ");
|
||||
else
|
||||
ga_concat(gap, (char_u *)"Expected ");
|
||||
if (exp_str == NULL)
|
||||
{
|
||||
ga_concat_esc(gap, tv2string(exp_tv, &tofree, numbuf, 0));
|
||||
@@ -9389,7 +9430,14 @@ fill_assert_error(
|
||||
}
|
||||
else
|
||||
ga_concat_esc(gap, exp_str);
|
||||
ga_concat(gap, (char_u *)" but got ");
|
||||
if (atype == ASSERT_MATCH)
|
||||
ga_concat(gap, (char_u *)" does not match ");
|
||||
else if (atype == ASSERT_NOTMATCH)
|
||||
ga_concat(gap, (char_u *)" does match ");
|
||||
else if (atype == ASSERT_NOTEQUAL)
|
||||
ga_concat(gap, (char_u *)" differs from ");
|
||||
else
|
||||
ga_concat(gap, (char_u *)" but got ");
|
||||
ga_concat_esc(gap, tv2string(got_tv, &tofree, numbuf, 0));
|
||||
vim_free(tofree);
|
||||
}
|
||||
@@ -9409,21 +9457,38 @@ assert_error(garray_T *gap)
|
||||
list_append_string(vimvars[VV_ERRORS].vv_list, gap->ga_data, gap->ga_len);
|
||||
}
|
||||
|
||||
static void
|
||||
assert_equal_common(typval_T *argvars, assert_type_T atype)
|
||||
{
|
||||
garray_T ga;
|
||||
|
||||
if (tv_equal(&argvars[0], &argvars[1], FALSE, FALSE)
|
||||
!= (atype == ASSERT_EQUAL))
|
||||
{
|
||||
prepare_assert_error(&ga);
|
||||
fill_assert_error(&ga, &argvars[2], NULL, &argvars[0], &argvars[1],
|
||||
atype);
|
||||
assert_error(&ga);
|
||||
ga_clear(&ga);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* "assert_equal(expected, actual[, msg])" function
|
||||
*/
|
||||
static void
|
||||
f_assert_equal(typval_T *argvars, typval_T *rettv UNUSED)
|
||||
{
|
||||
garray_T ga;
|
||||
assert_equal_common(argvars, ASSERT_EQUAL);
|
||||
}
|
||||
|
||||
if (!tv_equal(&argvars[0], &argvars[1], FALSE, FALSE))
|
||||
{
|
||||
prepare_assert_error(&ga);
|
||||
fill_assert_error(&ga, &argvars[2], NULL, &argvars[0], &argvars[1]);
|
||||
assert_error(&ga);
|
||||
ga_clear(&ga);
|
||||
}
|
||||
/*
|
||||
* "assert_notequal(expected, actual[, msg])" function
|
||||
*/
|
||||
static void
|
||||
f_assert_notequal(typval_T *argvars, typval_T *rettv UNUSED)
|
||||
{
|
||||
assert_equal_common(argvars, ASSERT_NOTEQUAL);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -9448,7 +9513,7 @@ f_assert_exception(typval_T *argvars, typval_T *rettv UNUSED)
|
||||
{
|
||||
prepare_assert_error(&ga);
|
||||
fill_assert_error(&ga, &argvars[1], NULL, &argvars[0],
|
||||
&vimvars[VV_EXCEPTION].vv_tv);
|
||||
&vimvars[VV_EXCEPTION].vv_tv, ASSERT_OTHER);
|
||||
assert_error(&ga);
|
||||
ga_clear(&ga);
|
||||
}
|
||||
@@ -9485,7 +9550,7 @@ f_assert_fails(typval_T *argvars, typval_T *rettv UNUSED)
|
||||
{
|
||||
prepare_assert_error(&ga);
|
||||
fill_assert_error(&ga, &argvars[2], NULL, &argvars[1],
|
||||
&vimvars[VV_ERRMSG].vv_tv);
|
||||
&vimvars[VV_ERRMSG].vv_tv, ASSERT_OTHER);
|
||||
assert_error(&ga);
|
||||
ga_clear(&ga);
|
||||
}
|
||||
@@ -9517,7 +9582,7 @@ assert_bool(typval_T *argvars, int isTrue)
|
||||
prepare_assert_error(&ga);
|
||||
fill_assert_error(&ga, &argvars[1],
|
||||
(char_u *)(isTrue ? "True" : "False"),
|
||||
NULL, &argvars[0]);
|
||||
NULL, &argvars[0], ASSERT_OTHER);
|
||||
assert_error(&ga);
|
||||
ga_clear(&ga);
|
||||
}
|
||||
@@ -9532,6 +9597,45 @@ f_assert_false(typval_T *argvars, typval_T *rettv UNUSED)
|
||||
assert_bool(argvars, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
assert_match_common(typval_T *argvars, assert_type_T atype)
|
||||
{
|
||||
garray_T ga;
|
||||
char_u buf1[NUMBUFLEN];
|
||||
char_u buf2[NUMBUFLEN];
|
||||
char_u *pat = get_tv_string_buf_chk(&argvars[0], buf1);
|
||||
char_u *text = get_tv_string_buf_chk(&argvars[1], buf2);
|
||||
|
||||
if (pat == NULL || text == NULL)
|
||||
EMSG(_(e_invarg));
|
||||
else if (pattern_match(pat, text, FALSE) != (atype == ASSERT_MATCH))
|
||||
{
|
||||
prepare_assert_error(&ga);
|
||||
fill_assert_error(&ga, &argvars[2], NULL, &argvars[0], &argvars[1],
|
||||
atype);
|
||||
assert_error(&ga);
|
||||
ga_clear(&ga);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* "assert_match(pattern, actual[, msg])" function
|
||||
*/
|
||||
static void
|
||||
f_assert_match(typval_T *argvars, typval_T *rettv UNUSED)
|
||||
{
|
||||
assert_match_common(argvars, ASSERT_MATCH);
|
||||
}
|
||||
|
||||
/*
|
||||
* "assert_notmatch(pattern, actual[, msg])" function
|
||||
*/
|
||||
static void
|
||||
f_assert_notmatch(typval_T *argvars, typval_T *rettv UNUSED)
|
||||
{
|
||||
assert_match_common(argvars, ASSERT_NOTMATCH);
|
||||
}
|
||||
|
||||
/*
|
||||
* "assert_true(actual[, msg])" function
|
||||
*/
|
||||
@@ -11306,7 +11410,10 @@ f_feedkeys(typval_T *argvars, typval_T *rettv UNUSED)
|
||||
|
||||
/* Avoid a 1 second delay when the keys start Insert mode. */
|
||||
msg_scroll = FALSE;
|
||||
|
||||
++ex_normal_busy;
|
||||
exec_normal(TRUE);
|
||||
--ex_normal_busy;
|
||||
msg_scroll |= save_msg_scroll;
|
||||
}
|
||||
}
|
||||
@@ -12731,7 +12838,7 @@ f_getmatches(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
|
||||
dict_add_nr_str(dict, "group", 0L, syn_id2name(cur->hlg_id));
|
||||
dict_add_nr_str(dict, "priority", (long)cur->priority, NULL);
|
||||
dict_add_nr_str(dict, "id", (long)cur->id, NULL);
|
||||
# ifdef FEAT_CONCEAL
|
||||
# if defined(FEAT_CONCEAL) && defined(FEAT_MBYTE)
|
||||
if (cur->conceal_char)
|
||||
{
|
||||
char_u buf[MB_MAXBYTES + 1];
|
||||
@@ -13856,7 +13963,7 @@ f_has(typval_T *argvars, typval_T *rettv)
|
||||
if (STRNICMP(name, "patch", 5) == 0)
|
||||
{
|
||||
if (name[5] == '-'
|
||||
&& STRLEN(name) > 11
|
||||
&& STRLEN(name) >= 11
|
||||
&& vim_isdigit(name[6])
|
||||
&& vim_isdigit(name[8])
|
||||
&& vim_isdigit(name[10]))
|
||||
@@ -15261,11 +15368,26 @@ find_some_match(typval_T *argvars, typval_T *rettv, int type)
|
||||
p_cpo = (char_u *)"";
|
||||
|
||||
rettv->vval.v_number = -1;
|
||||
if (type == 3)
|
||||
if (type == 3 || type == 4)
|
||||
{
|
||||
/* return empty list when there are no matches */
|
||||
/* type 3: return empty list when there are no matches.
|
||||
* type 4: return ["", -1, -1, -1] */
|
||||
if (rettv_list_alloc(rettv) == FAIL)
|
||||
goto theend;
|
||||
if (type == 4
|
||||
&& (list_append_string(rettv->vval.v_list,
|
||||
(char_u *)"", 0) == FAIL
|
||||
|| list_append_number(rettv->vval.v_list,
|
||||
(varnumber_T)-1) == FAIL
|
||||
|| list_append_number(rettv->vval.v_list,
|
||||
(varnumber_T)-1) == FAIL
|
||||
|| list_append_number(rettv->vval.v_list,
|
||||
(varnumber_T)-1) == FAIL))
|
||||
{
|
||||
list_free(rettv->vval.v_list, TRUE);
|
||||
rettv->vval.v_list = NULL;
|
||||
goto theend;
|
||||
}
|
||||
}
|
||||
else if (type == 2)
|
||||
{
|
||||
@@ -15342,7 +15464,7 @@ find_some_match(typval_T *argvars, typval_T *rettv, int type)
|
||||
break;
|
||||
}
|
||||
vim_free(tofree);
|
||||
str = echo_string(&li->li_tv, &tofree, strbuf, 0);
|
||||
expr = str = echo_string(&li->li_tv, &tofree, strbuf, 0);
|
||||
if (str == NULL)
|
||||
break;
|
||||
}
|
||||
@@ -15379,7 +15501,23 @@ find_some_match(typval_T *argvars, typval_T *rettv, int type)
|
||||
|
||||
if (match)
|
||||
{
|
||||
if (type == 3)
|
||||
if (type == 4)
|
||||
{
|
||||
listitem_T *li1 = rettv->vval.v_list->lv_first;
|
||||
listitem_T *li2 = li1->li_next;
|
||||
listitem_T *li3 = li2->li_next;
|
||||
listitem_T *li4 = li3->li_next;
|
||||
|
||||
li1->li_tv.vval.v_string = vim_strnsave(regmatch.startp[0],
|
||||
(int)(regmatch.endp[0] - regmatch.startp[0]));
|
||||
li3->li_tv.vval.v_number =
|
||||
(varnumber_T)(regmatch.startp[0] - expr);
|
||||
li4->li_tv.vval.v_number =
|
||||
(varnumber_T)(regmatch.endp[0] - expr);
|
||||
if (l != NULL)
|
||||
li2->li_tv.vval.v_number = (varnumber_T)idx;
|
||||
}
|
||||
else if (type == 3)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -15424,6 +15562,11 @@ find_some_match(typval_T *argvars, typval_T *rettv, int type)
|
||||
vim_regfree(regmatch.regprog);
|
||||
}
|
||||
|
||||
if (type == 4 && l == NULL)
|
||||
/* matchstrpos() without a list: drop the second item. */
|
||||
listitem_remove(rettv->vval.v_list,
|
||||
rettv->vval.v_list->lv_first->li_next);
|
||||
|
||||
theend:
|
||||
vim_free(tofree);
|
||||
p_cpo = save_cpo;
|
||||
@@ -15624,6 +15767,15 @@ f_matchstr(typval_T *argvars, typval_T *rettv)
|
||||
find_some_match(argvars, rettv, 2);
|
||||
}
|
||||
|
||||
/*
|
||||
* "matchstrpos()" function
|
||||
*/
|
||||
static void
|
||||
f_matchstrpos(typval_T *argvars, typval_T *rettv)
|
||||
{
|
||||
find_some_match(argvars, rettv, 4);
|
||||
}
|
||||
|
||||
static void max_min(typval_T *argvars, typval_T *rettv, int domax);
|
||||
|
||||
static void
|
||||
@@ -20217,6 +20369,7 @@ get_callback(typval_T *arg, partial_T **pp)
|
||||
if (arg->v_type == VAR_PARTIAL && arg->vval.v_partial != NULL)
|
||||
{
|
||||
*pp = arg->vval.v_partial;
|
||||
++(*pp)->pt_refcount;
|
||||
return (*pp)->pt_name;
|
||||
}
|
||||
*pp = NULL;
|
||||
|
||||
+1
-1
@@ -3449,7 +3449,7 @@ add_pack_plugin(char_u *fname, void *cookie)
|
||||
|
||||
if (load_files)
|
||||
{
|
||||
static char *plugpat = "%s/plugin/*.vim";
|
||||
static char *plugpat = "%s/plugin/**/*.vim";
|
||||
static char *ftpat = "%s/ftdetect/*.vim";
|
||||
int len;
|
||||
char_u *pat;
|
||||
|
||||
@@ -10067,6 +10067,7 @@ ex_stopinsert(exarg_T *eap UNUSED)
|
||||
{
|
||||
restart_edit = 0;
|
||||
stop_insert_mode = TRUE;
|
||||
clearmode();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+24
-2
@@ -4502,7 +4502,9 @@ expand_cmdline(
|
||||
|
||||
#ifdef FEAT_MULTI_LANG
|
||||
/*
|
||||
* Cleanup matches for help tags: remove "@en" if "en" is the only language.
|
||||
* Cleanup matches for help tags:
|
||||
* Remove "@ab" if the top of 'helplang' is "ab" and the language of the first
|
||||
* tag matches it. Otherwise remove "@en" if "en" is the only language.
|
||||
*/
|
||||
static void cleanup_help_tags(int num_file, char_u **file);
|
||||
|
||||
@@ -4511,11 +4513,28 @@ cleanup_help_tags(int num_file, char_u **file)
|
||||
{
|
||||
int i, j;
|
||||
int len;
|
||||
char_u buf[4];
|
||||
char_u *p = buf;
|
||||
|
||||
if (p_hlg[0] != NUL)
|
||||
{
|
||||
*p++ = '@';
|
||||
*p++ = p_hlg[0];
|
||||
*p++ = p_hlg[1];
|
||||
}
|
||||
*p = NUL;
|
||||
|
||||
for (i = 0; i < num_file; ++i)
|
||||
{
|
||||
len = (int)STRLEN(file[i]) - 3;
|
||||
if (len > 0 && STRCMP(file[i] + len, "@en") == 0)
|
||||
if (len <= 0)
|
||||
continue;
|
||||
if (i == 0 && STRCMP(file[i] + len, buf) == 0)
|
||||
{
|
||||
file[i][len] = NUL;
|
||||
break;
|
||||
}
|
||||
else if (STRCMP(file[i] + len, "@en") == 0)
|
||||
{
|
||||
/* Sorting on priority means the same item in another language may
|
||||
* be anywhere. Search all items for a match up to the "@en". */
|
||||
@@ -4525,7 +4544,10 @@ cleanup_help_tags(int num_file, char_u **file)
|
||||
&& STRNCMP(file[i], file[j], len + 1) == 0)
|
||||
break;
|
||||
if (j == num_file)
|
||||
{
|
||||
file[i][len] = NUL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+9
-1
@@ -2218,7 +2218,7 @@ gui_mch_wait_for_chars(int wtime)
|
||||
parse_queued_messages();
|
||||
|
||||
if (pPeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)
|
||||
|| MsgWaitForMultipleObjects(0, NULL, FALSE, 100, QS_ALLEVENTS)
|
||||
|| MsgWaitForMultipleObjects(0, NULL, FALSE, 100, QS_ALLINPUT)
|
||||
!= WAIT_TIMEOUT)
|
||||
break;
|
||||
}
|
||||
@@ -3291,6 +3291,7 @@ logfont2name(LOGFONT lf)
|
||||
char *p;
|
||||
char *res;
|
||||
char *charset_name;
|
||||
char *quality_name;
|
||||
char *font_name = lf.lfFaceName;
|
||||
|
||||
charset_name = charset_id2name((int)lf.lfCharSet);
|
||||
@@ -3304,6 +3305,8 @@ logfont2name(LOGFONT lf)
|
||||
(char_u **)&font_name, &len);
|
||||
}
|
||||
#endif
|
||||
quality_name = quality_id2name((int)lf.lfQuality);
|
||||
|
||||
res = (char *)alloc((unsigned)(strlen(font_name) + 20
|
||||
+ (charset_name == NULL ? 0 : strlen(charset_name) + 2)));
|
||||
if (res != NULL)
|
||||
@@ -3331,6 +3334,11 @@ logfont2name(LOGFONT lf)
|
||||
STRCAT(p, ":c");
|
||||
STRCAT(p, charset_name);
|
||||
}
|
||||
if (quality_name != NULL)
|
||||
{
|
||||
STRCAT(p, ":q");
|
||||
STRCAT(p, quality_name);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef FEAT_MBYTE
|
||||
|
||||
+30
-5
@@ -189,6 +189,8 @@ parse_list_options(
|
||||
option_table_T *table,
|
||||
int table_size)
|
||||
{
|
||||
option_table_T *old_opts;
|
||||
char_u *ret = NULL;
|
||||
char_u *stringp;
|
||||
char_u *colonp;
|
||||
char_u *commap;
|
||||
@@ -196,8 +198,16 @@ parse_list_options(
|
||||
int idx = 0; /* init for GCC */
|
||||
int len;
|
||||
|
||||
/* Save the old values, so that they can be restored in case of an error. */
|
||||
old_opts = (option_table_T *)alloc(sizeof(option_table_T) * table_size);
|
||||
if (old_opts == NULL)
|
||||
return NULL;
|
||||
|
||||
for (idx = 0; idx < table_size; ++idx)
|
||||
{
|
||||
old_opts[idx] = table[idx];
|
||||
table[idx].present = FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Repeat for all comma separated parts.
|
||||
@@ -207,7 +217,10 @@ parse_list_options(
|
||||
{
|
||||
colonp = vim_strchr(stringp, ':');
|
||||
if (colonp == NULL)
|
||||
return (char_u *)N_("E550: Missing colon");
|
||||
{
|
||||
ret = (char_u *)N_("E550: Missing colon");
|
||||
break;
|
||||
}
|
||||
commap = vim_strchr(stringp, ',');
|
||||
if (commap == NULL)
|
||||
commap = option_str + STRLEN(option_str);
|
||||
@@ -219,15 +232,20 @@ parse_list_options(
|
||||
break;
|
||||
|
||||
if (idx == table_size)
|
||||
return (char_u *)N_("E551: Illegal component");
|
||||
|
||||
{
|
||||
ret = (char_u *)N_("E551: Illegal component");
|
||||
break;
|
||||
}
|
||||
p = colonp + 1;
|
||||
table[idx].present = TRUE;
|
||||
|
||||
if (table[idx].hasnum)
|
||||
{
|
||||
if (!VIM_ISDIGIT(*p))
|
||||
return (char_u *)N_("E552: digit expected");
|
||||
{
|
||||
ret = (char_u *)N_("E552: digit expected");
|
||||
break;
|
||||
}
|
||||
|
||||
table[idx].number = getdigits(&p); /*advances p*/
|
||||
}
|
||||
@@ -240,7 +258,14 @@ parse_list_options(
|
||||
++stringp;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
if (ret != NULL)
|
||||
{
|
||||
/* Restore old options in case of error */
|
||||
for (idx = 0; idx < table_size; ++idx)
|
||||
table[idx] = old_opts[idx];
|
||||
}
|
||||
vim_free(old_opts);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-2
@@ -468,8 +468,7 @@ hash_hash(char_u *key)
|
||||
char_u *p;
|
||||
|
||||
if ((hash = *key) == 0)
|
||||
return (hash_T)0; /* Empty keys are not allowed, but we don't
|
||||
want to crash if we get one. */
|
||||
return (hash_T)0;
|
||||
p = key + 1;
|
||||
|
||||
/* A simplistic algorithm that appears to do very well.
|
||||
|
||||
+26
-1
@@ -1073,7 +1073,7 @@ load_base_module(void *data)
|
||||
}
|
||||
|
||||
static Scheme_Object *
|
||||
load_base_module_on_error(void *data)
|
||||
load_base_module_on_error(void *data UNUSED)
|
||||
{
|
||||
load_base_module_failed = TRUE;
|
||||
return scheme_null;
|
||||
@@ -3109,6 +3109,7 @@ vim_to_mzscheme_impl(typval_T *vim_value, int depth, Scheme_Hash_Table *visited)
|
||||
MZ_GC_VAR_IN_REG(0, funcname);
|
||||
MZ_GC_REG();
|
||||
|
||||
/* FIXME: func_ref() and func_unref() are needed. */
|
||||
funcname = scheme_make_byte_string((char *)vim_value->vval.v_string);
|
||||
MZ_GC_CHECK();
|
||||
result = scheme_make_closed_prim_w_arity(vim_funcref, funcname,
|
||||
@@ -3117,6 +3118,30 @@ vim_to_mzscheme_impl(typval_T *vim_value, int depth, Scheme_Hash_Table *visited)
|
||||
|
||||
MZ_GC_UNREG();
|
||||
}
|
||||
else if (vim_value->v_type == VAR_PARTIAL)
|
||||
{
|
||||
if (vim_value->vval.v_partial == NULL)
|
||||
result = scheme_null;
|
||||
else
|
||||
{
|
||||
Scheme_Object *funcname = NULL;
|
||||
|
||||
MZ_GC_DECL_REG(1);
|
||||
MZ_GC_VAR_IN_REG(0, funcname);
|
||||
MZ_GC_REG();
|
||||
|
||||
/* FIXME: func_ref() and func_unref() are needed. */
|
||||
/* TODO: Support pt_dict and pt_argv. */
|
||||
funcname = scheme_make_byte_string(
|
||||
(char *)vim_value->vval.v_partial->pt_name);
|
||||
MZ_GC_CHECK();
|
||||
result = scheme_make_closed_prim_w_arity(vim_funcref, funcname,
|
||||
(const char *)BYTE_STRING_VALUE(funcname), 0, -1);
|
||||
MZ_GC_CHECK();
|
||||
|
||||
MZ_GC_UNREG();
|
||||
}
|
||||
}
|
||||
else if (vim_value->v_type == VAR_SPECIAL)
|
||||
{
|
||||
if (vim_value->vval.v_number <= VVAL_TRUE)
|
||||
|
||||
+10
-6
@@ -52,7 +52,6 @@
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
||||
#endif
|
||||
|
||||
#include <EXTERN.h>
|
||||
@@ -307,16 +306,18 @@ static void (*perl_free)(PerlInterpreter*);
|
||||
static int (*perl_run)(PerlInterpreter*);
|
||||
static int (*perl_parse)(PerlInterpreter*, XSINIT_t, int, char**, char**);
|
||||
static void* (*Perl_get_context)(void);
|
||||
static void (*Perl_croak)(pTHX_ const char*, ...);
|
||||
static void (*Perl_croak)(pTHX_ const char*, ...) __attribute__noreturn__;
|
||||
#ifdef PERL5101_OR_LATER
|
||||
/* Perl-5.18 has a different Perl_croak_xs_usage signature. */
|
||||
# if (PERL_REVISION == 5) && (PERL_VERSION >= 18)
|
||||
static void (*Perl_croak_xs_usage)(const CV *const, const char *const params);
|
||||
static void (*Perl_croak_xs_usage)(const CV *const, const char *const params)
|
||||
__attribute__noreturn__;
|
||||
# else
|
||||
static void (*Perl_croak_xs_usage)(pTHX_ const CV *const, const char *const params);
|
||||
static void (*Perl_croak_xs_usage)(pTHX_ const CV *const, const char *const params)
|
||||
__attribute__noreturn__;
|
||||
# endif
|
||||
#endif
|
||||
static void (*Perl_croak_nocontext)(const char*, ...);
|
||||
static void (*Perl_croak_nocontext)(const char*, ...) __attribute__noreturn__;
|
||||
static I32 (*Perl_dowantarray)(pTHX);
|
||||
static void (*Perl_free_tmps)(pTHX);
|
||||
static HV* (*Perl_gv_stashpv)(pTHX_ const char*, I32);
|
||||
@@ -591,7 +592,9 @@ static struct {
|
||||
* "perl\lib\CORE\inline.h", after Perl_sv_free2 is defined.
|
||||
* The linker won't complain about undefined __impl_Perl_sv_free2. */
|
||||
#if (PERL_REVISION == 5) && (PERL_VERSION >= 18)
|
||||
# define PL_memory_wrap "panic: memory wrap" /* Dummy */
|
||||
# include <inline.h>
|
||||
# undef PL_memory_wrap
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -1516,7 +1519,8 @@ SetHeight(win, height)
|
||||
curwin = savewin;
|
||||
|
||||
void
|
||||
Cursor(VIWIN win, ...)
|
||||
Cursor(win, ...)
|
||||
VIWIN win
|
||||
|
||||
PPCODE:
|
||||
if (items == 1)
|
||||
|
||||
+24
-12
@@ -739,7 +739,8 @@ vim_str2rb_enc_str(const char *s)
|
||||
{
|
||||
enc = rb_enc_find((char *)sval);
|
||||
vim_free(sval);
|
||||
if (enc) {
|
||||
if (enc)
|
||||
{
|
||||
return rb_enc_str_new(s, strlen(s), enc);
|
||||
}
|
||||
}
|
||||
@@ -781,19 +782,23 @@ void ex_rubydo(exarg_T *eap)
|
||||
{
|
||||
if (u_save(eap->line1 - 1, eap->line2 + 1) != OK)
|
||||
return;
|
||||
for (i = eap->line1; i <= eap->line2; i++) {
|
||||
for (i = eap->line1; i <= eap->line2; i++)
|
||||
{
|
||||
VALUE line;
|
||||
|
||||
line = vim_str2rb_enc_str((char *)ml_get(i));
|
||||
rb_lastline_set(line);
|
||||
eval_enc_string_protect((char *) eap->arg, &state);
|
||||
if (state) {
|
||||
if (state)
|
||||
{
|
||||
error_print(state);
|
||||
break;
|
||||
}
|
||||
line = rb_lastline_get();
|
||||
if (!NIL_P(line)) {
|
||||
if (TYPE(line) != T_STRING) {
|
||||
if (!NIL_P(line))
|
||||
{
|
||||
if (TYPE(line) != T_STRING)
|
||||
{
|
||||
EMSG(_("E265: $_ must be an instance of String"));
|
||||
return;
|
||||
}
|
||||
@@ -906,7 +911,8 @@ static void error_print(int state)
|
||||
#define TAG_FATAL 0x8
|
||||
#define TAG_MASK 0xf
|
||||
|
||||
switch (state) {
|
||||
switch (state)
|
||||
{
|
||||
case TAG_RETURN:
|
||||
EMSG(_("E267: unexpected return"));
|
||||
break;
|
||||
@@ -931,10 +937,12 @@ static void error_print(int state)
|
||||
eclass = CLASS_OF(ruby_errinfo);
|
||||
einfo = rb_obj_as_string(ruby_errinfo);
|
||||
#endif
|
||||
if (eclass == rb_eRuntimeError && RSTRING_LEN(einfo) == 0) {
|
||||
if (eclass == rb_eRuntimeError && RSTRING_LEN(einfo) == 0)
|
||||
{
|
||||
EMSG(_("E272: unhandled exception"));
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
VALUE epath;
|
||||
char *p;
|
||||
|
||||
@@ -1216,7 +1224,8 @@ static VALUE set_buffer_line(buf_T *buf, linenr_T n, VALUE str)
|
||||
/* set curwin/curbuf for "buf" and save some things */
|
||||
aucmd_prepbuf(&aco, buf);
|
||||
|
||||
if (u_savesub(n) == OK) {
|
||||
if (u_savesub(n) == OK)
|
||||
{
|
||||
ml_replace(n, (char_u *)line, TRUE);
|
||||
changed();
|
||||
#ifdef SYNTAX_HL
|
||||
@@ -1257,7 +1266,8 @@ static VALUE buffer_delete(VALUE self, VALUE num)
|
||||
/* set curwin/curbuf for "buf" and save some things */
|
||||
aucmd_prepbuf(&aco, buf);
|
||||
|
||||
if (u_savedel(n, 1) == OK) {
|
||||
if (u_savedel(n, 1) == OK)
|
||||
{
|
||||
ml_delete(n, 0);
|
||||
|
||||
/* Changes to non-active buffers should properly refresh
|
||||
@@ -1296,7 +1306,8 @@ static VALUE buffer_append(VALUE self, VALUE num, VALUE str)
|
||||
/* set curwin/curbuf for "buf" and save some things */
|
||||
aucmd_prepbuf(&aco, buf);
|
||||
|
||||
if (u_inssub(n + 1) == OK) {
|
||||
if (u_inssub(n + 1) == OK)
|
||||
{
|
||||
ml_append(n, (char_u *) line, (colnr_T) 0, FALSE);
|
||||
|
||||
/* Changes to non-active buffers should properly refresh screen
|
||||
@@ -1502,7 +1513,8 @@ static VALUE f_p(int argc, VALUE *argv, VALUE self UNUSED)
|
||||
int i;
|
||||
VALUE str = rb_str_new("", 0);
|
||||
|
||||
for (i = 0; i < argc; i++) {
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
if (i > 0) rb_str_cat(str, ", ", 2);
|
||||
rb_str_concat(str, rb_inspect(argv[i]));
|
||||
}
|
||||
|
||||
+3
-1
@@ -350,8 +350,10 @@ json_skip_white(js_read_T *reader)
|
||||
if (reader->js_fill != NULL && c == NUL)
|
||||
{
|
||||
if (reader->js_fill(reader))
|
||||
{
|
||||
reader->js_end = reader->js_buf + STRLEN(reader->js_buf);
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (c == NUL || c > ' ')
|
||||
break;
|
||||
|
||||
@@ -1012,6 +1012,9 @@ vim_main2(int argc UNUSED, char **argv UNUSED)
|
||||
if (p_im)
|
||||
need_start_insertmode = TRUE;
|
||||
|
||||
#ifdef FEAT_EVAL
|
||||
set_vim_var_nr(VV_VIM_DID_ENTER, 1L);
|
||||
#endif
|
||||
#ifdef FEAT_AUTOCMD
|
||||
apply_autocmds(EVENT_VIMENTER, NULL, NULL, FALSE, curbuf);
|
||||
TIME_MSG("VimEnter autocommands");
|
||||
|
||||
+302
-295
@@ -1210,6 +1210,185 @@ intable(struct interval *table, size_t size, int c)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Sorted list of non-overlapping intervals of East Asian Ambiguous
|
||||
* characters, generated with ../runtime/tools/unicode.vim. */
|
||||
static struct interval ambiguous[] =
|
||||
{
|
||||
{0x00a1, 0x00a1},
|
||||
{0x00a4, 0x00a4},
|
||||
{0x00a7, 0x00a8},
|
||||
{0x00aa, 0x00aa},
|
||||
{0x00ad, 0x00ae},
|
||||
{0x00b0, 0x00b4},
|
||||
{0x00b6, 0x00ba},
|
||||
{0x00bc, 0x00bf},
|
||||
{0x00c6, 0x00c6},
|
||||
{0x00d0, 0x00d0},
|
||||
{0x00d7, 0x00d8},
|
||||
{0x00de, 0x00e1},
|
||||
{0x00e6, 0x00e6},
|
||||
{0x00e8, 0x00ea},
|
||||
{0x00ec, 0x00ed},
|
||||
{0x00f0, 0x00f0},
|
||||
{0x00f2, 0x00f3},
|
||||
{0x00f7, 0x00fa},
|
||||
{0x00fc, 0x00fc},
|
||||
{0x00fe, 0x00fe},
|
||||
{0x0101, 0x0101},
|
||||
{0x0111, 0x0111},
|
||||
{0x0113, 0x0113},
|
||||
{0x011b, 0x011b},
|
||||
{0x0126, 0x0127},
|
||||
{0x012b, 0x012b},
|
||||
{0x0131, 0x0133},
|
||||
{0x0138, 0x0138},
|
||||
{0x013f, 0x0142},
|
||||
{0x0144, 0x0144},
|
||||
{0x0148, 0x014b},
|
||||
{0x014d, 0x014d},
|
||||
{0x0152, 0x0153},
|
||||
{0x0166, 0x0167},
|
||||
{0x016b, 0x016b},
|
||||
{0x01ce, 0x01ce},
|
||||
{0x01d0, 0x01d0},
|
||||
{0x01d2, 0x01d2},
|
||||
{0x01d4, 0x01d4},
|
||||
{0x01d6, 0x01d6},
|
||||
{0x01d8, 0x01d8},
|
||||
{0x01da, 0x01da},
|
||||
{0x01dc, 0x01dc},
|
||||
{0x0251, 0x0251},
|
||||
{0x0261, 0x0261},
|
||||
{0x02c4, 0x02c4},
|
||||
{0x02c7, 0x02c7},
|
||||
{0x02c9, 0x02cb},
|
||||
{0x02cd, 0x02cd},
|
||||
{0x02d0, 0x02d0},
|
||||
{0x02d8, 0x02db},
|
||||
{0x02dd, 0x02dd},
|
||||
{0x02df, 0x02df},
|
||||
{0x0300, 0x036f},
|
||||
{0x0391, 0x03a1},
|
||||
{0x03a3, 0x03a9},
|
||||
{0x03b1, 0x03c1},
|
||||
{0x03c3, 0x03c9},
|
||||
{0x0401, 0x0401},
|
||||
{0x0410, 0x044f},
|
||||
{0x0451, 0x0451},
|
||||
{0x2010, 0x2010},
|
||||
{0x2013, 0x2016},
|
||||
{0x2018, 0x2019},
|
||||
{0x201c, 0x201d},
|
||||
{0x2020, 0x2022},
|
||||
{0x2024, 0x2027},
|
||||
{0x2030, 0x2030},
|
||||
{0x2032, 0x2033},
|
||||
{0x2035, 0x2035},
|
||||
{0x203b, 0x203b},
|
||||
{0x203e, 0x203e},
|
||||
{0x2074, 0x2074},
|
||||
{0x207f, 0x207f},
|
||||
{0x2081, 0x2084},
|
||||
{0x20ac, 0x20ac},
|
||||
{0x2103, 0x2103},
|
||||
{0x2105, 0x2105},
|
||||
{0x2109, 0x2109},
|
||||
{0x2113, 0x2113},
|
||||
{0x2116, 0x2116},
|
||||
{0x2121, 0x2122},
|
||||
{0x2126, 0x2126},
|
||||
{0x212b, 0x212b},
|
||||
{0x2153, 0x2154},
|
||||
{0x215b, 0x215e},
|
||||
{0x2160, 0x216b},
|
||||
{0x2170, 0x2179},
|
||||
{0x2189, 0x2189},
|
||||
{0x2190, 0x2199},
|
||||
{0x21b8, 0x21b9},
|
||||
{0x21d2, 0x21d2},
|
||||
{0x21d4, 0x21d4},
|
||||
{0x21e7, 0x21e7},
|
||||
{0x2200, 0x2200},
|
||||
{0x2202, 0x2203},
|
||||
{0x2207, 0x2208},
|
||||
{0x220b, 0x220b},
|
||||
{0x220f, 0x220f},
|
||||
{0x2211, 0x2211},
|
||||
{0x2215, 0x2215},
|
||||
{0x221a, 0x221a},
|
||||
{0x221d, 0x2220},
|
||||
{0x2223, 0x2223},
|
||||
{0x2225, 0x2225},
|
||||
{0x2227, 0x222c},
|
||||
{0x222e, 0x222e},
|
||||
{0x2234, 0x2237},
|
||||
{0x223c, 0x223d},
|
||||
{0x2248, 0x2248},
|
||||
{0x224c, 0x224c},
|
||||
{0x2252, 0x2252},
|
||||
{0x2260, 0x2261},
|
||||
{0x2264, 0x2267},
|
||||
{0x226a, 0x226b},
|
||||
{0x226e, 0x226f},
|
||||
{0x2282, 0x2283},
|
||||
{0x2286, 0x2287},
|
||||
{0x2295, 0x2295},
|
||||
{0x2299, 0x2299},
|
||||
{0x22a5, 0x22a5},
|
||||
{0x22bf, 0x22bf},
|
||||
{0x2312, 0x2312},
|
||||
{0x2460, 0x24e9},
|
||||
{0x24eb, 0x254b},
|
||||
{0x2550, 0x2573},
|
||||
{0x2580, 0x258f},
|
||||
{0x2592, 0x2595},
|
||||
{0x25a0, 0x25a1},
|
||||
{0x25a3, 0x25a9},
|
||||
{0x25b2, 0x25b3},
|
||||
{0x25b6, 0x25b7},
|
||||
{0x25bc, 0x25bd},
|
||||
{0x25c0, 0x25c1},
|
||||
{0x25c6, 0x25c8},
|
||||
{0x25cb, 0x25cb},
|
||||
{0x25ce, 0x25d1},
|
||||
{0x25e2, 0x25e5},
|
||||
{0x25ef, 0x25ef},
|
||||
{0x2605, 0x2606},
|
||||
{0x2609, 0x2609},
|
||||
{0x260e, 0x260f},
|
||||
{0x2614, 0x2615},
|
||||
{0x261c, 0x261c},
|
||||
{0x261e, 0x261e},
|
||||
{0x2640, 0x2640},
|
||||
{0x2642, 0x2642},
|
||||
{0x2660, 0x2661},
|
||||
{0x2663, 0x2665},
|
||||
{0x2667, 0x266a},
|
||||
{0x266c, 0x266d},
|
||||
{0x266f, 0x266f},
|
||||
{0x269e, 0x269f},
|
||||
{0x26be, 0x26bf},
|
||||
{0x26c4, 0x26cd},
|
||||
{0x26cf, 0x26e1},
|
||||
{0x26e3, 0x26e3},
|
||||
{0x26e8, 0x26ff},
|
||||
{0x273d, 0x273d},
|
||||
{0x2757, 0x2757},
|
||||
{0x2776, 0x277f},
|
||||
{0x2b55, 0x2b59},
|
||||
{0x3248, 0x324f},
|
||||
{0xe000, 0xf8ff},
|
||||
{0xfe00, 0xfe0f},
|
||||
{0xfffd, 0xfffd},
|
||||
{0x1f100, 0x1f10a},
|
||||
{0x1f110, 0x1f12d},
|
||||
{0x1f130, 0x1f169},
|
||||
{0x1f170, 0x1f19a},
|
||||
{0xe0100, 0xe01ef},
|
||||
{0xf0000, 0xffffd},
|
||||
{0x100000, 0x10fffd}
|
||||
};
|
||||
|
||||
/*
|
||||
* For UTF-8 character "c" return 2 for a double-width character, 1 for others.
|
||||
* Returns 4 or 6 for an unprintable character.
|
||||
@@ -1261,185 +1440,6 @@ utf_char2cells(int c)
|
||||
{0x30000, 0x3fffd}
|
||||
};
|
||||
|
||||
/* Sorted list of non-overlapping intervals of East Asian Ambiguous
|
||||
* characters, generated with ../runtime/tools/unicode.vim. */
|
||||
static struct interval ambiguous[] =
|
||||
{
|
||||
{0x00a1, 0x00a1},
|
||||
{0x00a4, 0x00a4},
|
||||
{0x00a7, 0x00a8},
|
||||
{0x00aa, 0x00aa},
|
||||
{0x00ad, 0x00ae},
|
||||
{0x00b0, 0x00b4},
|
||||
{0x00b6, 0x00ba},
|
||||
{0x00bc, 0x00bf},
|
||||
{0x00c6, 0x00c6},
|
||||
{0x00d0, 0x00d0},
|
||||
{0x00d7, 0x00d8},
|
||||
{0x00de, 0x00e1},
|
||||
{0x00e6, 0x00e6},
|
||||
{0x00e8, 0x00ea},
|
||||
{0x00ec, 0x00ed},
|
||||
{0x00f0, 0x00f0},
|
||||
{0x00f2, 0x00f3},
|
||||
{0x00f7, 0x00fa},
|
||||
{0x00fc, 0x00fc},
|
||||
{0x00fe, 0x00fe},
|
||||
{0x0101, 0x0101},
|
||||
{0x0111, 0x0111},
|
||||
{0x0113, 0x0113},
|
||||
{0x011b, 0x011b},
|
||||
{0x0126, 0x0127},
|
||||
{0x012b, 0x012b},
|
||||
{0x0131, 0x0133},
|
||||
{0x0138, 0x0138},
|
||||
{0x013f, 0x0142},
|
||||
{0x0144, 0x0144},
|
||||
{0x0148, 0x014b},
|
||||
{0x014d, 0x014d},
|
||||
{0x0152, 0x0153},
|
||||
{0x0166, 0x0167},
|
||||
{0x016b, 0x016b},
|
||||
{0x01ce, 0x01ce},
|
||||
{0x01d0, 0x01d0},
|
||||
{0x01d2, 0x01d2},
|
||||
{0x01d4, 0x01d4},
|
||||
{0x01d6, 0x01d6},
|
||||
{0x01d8, 0x01d8},
|
||||
{0x01da, 0x01da},
|
||||
{0x01dc, 0x01dc},
|
||||
{0x0251, 0x0251},
|
||||
{0x0261, 0x0261},
|
||||
{0x02c4, 0x02c4},
|
||||
{0x02c7, 0x02c7},
|
||||
{0x02c9, 0x02cb},
|
||||
{0x02cd, 0x02cd},
|
||||
{0x02d0, 0x02d0},
|
||||
{0x02d8, 0x02db},
|
||||
{0x02dd, 0x02dd},
|
||||
{0x02df, 0x02df},
|
||||
{0x0300, 0x036f},
|
||||
{0x0391, 0x03a1},
|
||||
{0x03a3, 0x03a9},
|
||||
{0x03b1, 0x03c1},
|
||||
{0x03c3, 0x03c9},
|
||||
{0x0401, 0x0401},
|
||||
{0x0410, 0x044f},
|
||||
{0x0451, 0x0451},
|
||||
{0x2010, 0x2010},
|
||||
{0x2013, 0x2016},
|
||||
{0x2018, 0x2019},
|
||||
{0x201c, 0x201d},
|
||||
{0x2020, 0x2022},
|
||||
{0x2024, 0x2027},
|
||||
{0x2030, 0x2030},
|
||||
{0x2032, 0x2033},
|
||||
{0x2035, 0x2035},
|
||||
{0x203b, 0x203b},
|
||||
{0x203e, 0x203e},
|
||||
{0x2074, 0x2074},
|
||||
{0x207f, 0x207f},
|
||||
{0x2081, 0x2084},
|
||||
{0x20ac, 0x20ac},
|
||||
{0x2103, 0x2103},
|
||||
{0x2105, 0x2105},
|
||||
{0x2109, 0x2109},
|
||||
{0x2113, 0x2113},
|
||||
{0x2116, 0x2116},
|
||||
{0x2121, 0x2122},
|
||||
{0x2126, 0x2126},
|
||||
{0x212b, 0x212b},
|
||||
{0x2153, 0x2154},
|
||||
{0x215b, 0x215e},
|
||||
{0x2160, 0x216b},
|
||||
{0x2170, 0x2179},
|
||||
{0x2189, 0x2189},
|
||||
{0x2190, 0x2199},
|
||||
{0x21b8, 0x21b9},
|
||||
{0x21d2, 0x21d2},
|
||||
{0x21d4, 0x21d4},
|
||||
{0x21e7, 0x21e7},
|
||||
{0x2200, 0x2200},
|
||||
{0x2202, 0x2203},
|
||||
{0x2207, 0x2208},
|
||||
{0x220b, 0x220b},
|
||||
{0x220f, 0x220f},
|
||||
{0x2211, 0x2211},
|
||||
{0x2215, 0x2215},
|
||||
{0x221a, 0x221a},
|
||||
{0x221d, 0x2220},
|
||||
{0x2223, 0x2223},
|
||||
{0x2225, 0x2225},
|
||||
{0x2227, 0x222c},
|
||||
{0x222e, 0x222e},
|
||||
{0x2234, 0x2237},
|
||||
{0x223c, 0x223d},
|
||||
{0x2248, 0x2248},
|
||||
{0x224c, 0x224c},
|
||||
{0x2252, 0x2252},
|
||||
{0x2260, 0x2261},
|
||||
{0x2264, 0x2267},
|
||||
{0x226a, 0x226b},
|
||||
{0x226e, 0x226f},
|
||||
{0x2282, 0x2283},
|
||||
{0x2286, 0x2287},
|
||||
{0x2295, 0x2295},
|
||||
{0x2299, 0x2299},
|
||||
{0x22a5, 0x22a5},
|
||||
{0x22bf, 0x22bf},
|
||||
{0x2312, 0x2312},
|
||||
{0x2460, 0x24e9},
|
||||
{0x24eb, 0x254b},
|
||||
{0x2550, 0x2573},
|
||||
{0x2580, 0x258f},
|
||||
{0x2592, 0x2595},
|
||||
{0x25a0, 0x25a1},
|
||||
{0x25a3, 0x25a9},
|
||||
{0x25b2, 0x25b3},
|
||||
{0x25b6, 0x25b7},
|
||||
{0x25bc, 0x25bd},
|
||||
{0x25c0, 0x25c1},
|
||||
{0x25c6, 0x25c8},
|
||||
{0x25cb, 0x25cb},
|
||||
{0x25ce, 0x25d1},
|
||||
{0x25e2, 0x25e5},
|
||||
{0x25ef, 0x25ef},
|
||||
{0x2605, 0x2606},
|
||||
{0x2609, 0x2609},
|
||||
{0x260e, 0x260f},
|
||||
{0x2614, 0x2615},
|
||||
{0x261c, 0x261c},
|
||||
{0x261e, 0x261e},
|
||||
{0x2640, 0x2640},
|
||||
{0x2642, 0x2642},
|
||||
{0x2660, 0x2661},
|
||||
{0x2663, 0x2665},
|
||||
{0x2667, 0x266a},
|
||||
{0x266c, 0x266d},
|
||||
{0x266f, 0x266f},
|
||||
{0x269e, 0x269f},
|
||||
{0x26be, 0x26bf},
|
||||
{0x26c4, 0x26cd},
|
||||
{0x26cf, 0x26e1},
|
||||
{0x26e3, 0x26e3},
|
||||
{0x26e8, 0x26ff},
|
||||
{0x273d, 0x273d},
|
||||
{0x2757, 0x2757},
|
||||
{0x2776, 0x277f},
|
||||
{0x2b55, 0x2b59},
|
||||
{0x3248, 0x324f},
|
||||
{0xe000, 0xf8ff},
|
||||
{0xfe00, 0xfe0f},
|
||||
{0xfffd, 0xfffd},
|
||||
{0x1f100, 0x1f10a},
|
||||
{0x1f110, 0x1f12d},
|
||||
{0x1f130, 0x1f169},
|
||||
{0x1f170, 0x1f19a},
|
||||
{0xe0100, 0xe01ef},
|
||||
{0xf0000, 0xffffd},
|
||||
{0x100000, 0x10fffd}
|
||||
};
|
||||
|
||||
/* Sorted list of non-overlapping intervals of Emoji characters that don't
|
||||
* have ambiguous or double width,
|
||||
* based on http://unicode.org/emoji/charts/emoji-list.html */
|
||||
@@ -2478,6 +2478,122 @@ utf_printable(int c)
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Sorted list of non-overlapping intervals of all Emoji characters,
|
||||
* based on http://unicode.org/emoji/charts/emoji-list.html */
|
||||
static struct interval emoji_all[] =
|
||||
{
|
||||
{0x203c, 0x203c},
|
||||
{0x2049, 0x2049},
|
||||
{0x2122, 0x2122},
|
||||
{0x2139, 0x2139},
|
||||
{0x2194, 0x2199},
|
||||
{0x21a9, 0x21aa},
|
||||
{0x231a, 0x231b},
|
||||
{0x2328, 0x2328},
|
||||
{0x23cf, 0x23cf},
|
||||
{0x23e9, 0x23f3},
|
||||
{0x24c2, 0x24c2},
|
||||
{0x25aa, 0x25ab},
|
||||
{0x25b6, 0x25b6},
|
||||
{0x25c0, 0x25c0},
|
||||
{0x25fb, 0x25fe},
|
||||
{0x2600, 0x2604},
|
||||
{0x260e, 0x260e},
|
||||
{0x2611, 0x2611},
|
||||
{0x2614, 0x2615},
|
||||
{0x2618, 0x2618},
|
||||
{0x261d, 0x261d},
|
||||
{0x2620, 0x2620},
|
||||
{0x2622, 0x2623},
|
||||
{0x2626, 0x2626},
|
||||
{0x262a, 0x262a},
|
||||
{0x262e, 0x262f},
|
||||
{0x2638, 0x263a},
|
||||
{0x2648, 0x2653},
|
||||
{0x2660, 0x2660},
|
||||
{0x2663, 0x2663},
|
||||
{0x2665, 0x2666},
|
||||
{0x2668, 0x2668},
|
||||
{0x267b, 0x267b},
|
||||
{0x267f, 0x267f},
|
||||
{0x2692, 0x2694},
|
||||
{0x2696, 0x2697},
|
||||
{0x2699, 0x2699},
|
||||
{0x269b, 0x269c},
|
||||
{0x26a0, 0x26a1},
|
||||
{0x26aa, 0x26ab},
|
||||
{0x26b0, 0x26b1},
|
||||
{0x26bd, 0x26be},
|
||||
{0x26c4, 0x26c5},
|
||||
{0x26c8, 0x26c8},
|
||||
{0x26ce, 0x26cf},
|
||||
{0x26d1, 0x26d1},
|
||||
{0x26d3, 0x26d4},
|
||||
{0x26e9, 0x26ea},
|
||||
{0x26f0, 0x26f5},
|
||||
{0x26f7, 0x26fa},
|
||||
{0x26fd, 0x26fd},
|
||||
{0x2702, 0x2702},
|
||||
{0x2705, 0x2705},
|
||||
{0x2708, 0x270d},
|
||||
{0x270f, 0x270f},
|
||||
{0x2712, 0x2712},
|
||||
{0x2714, 0x2714},
|
||||
{0x2716, 0x2716},
|
||||
{0x271d, 0x271d},
|
||||
{0x2721, 0x2721},
|
||||
{0x2728, 0x2728},
|
||||
{0x2733, 0x2734},
|
||||
{0x2744, 0x2744},
|
||||
{0x2747, 0x2747},
|
||||
{0x274c, 0x274c},
|
||||
{0x274e, 0x274e},
|
||||
{0x2753, 0x2755},
|
||||
{0x2757, 0x2757},
|
||||
{0x2763, 0x2764},
|
||||
{0x2795, 0x2797},
|
||||
{0x27a1, 0x27a1},
|
||||
{0x27b0, 0x27b0},
|
||||
{0x27bf, 0x27bf},
|
||||
{0x2934, 0x2935},
|
||||
{0x2b05, 0x2b07},
|
||||
{0x2b1b, 0x2b1c},
|
||||
{0x2b50, 0x2b50},
|
||||
{0x2b55, 0x2b55},
|
||||
{0x3030, 0x3030},
|
||||
{0x303d, 0x303d},
|
||||
{0x3297, 0x3297},
|
||||
{0x3299, 0x3299},
|
||||
{0x1f004, 0x1f004},
|
||||
{0x1f0cf, 0x1f0cf},
|
||||
{0x1f170, 0x1f171},
|
||||
{0x1f17e, 0x1f17f},
|
||||
{0x1f18e, 0x1f18e},
|
||||
{0x1f191, 0x1f19a},
|
||||
{0x1f1e6, 0x1f1ff},
|
||||
{0x1f201, 0x1f202},
|
||||
{0x1f21a, 0x1f21a},
|
||||
{0x1f22f, 0x1f22f},
|
||||
{0x1f232, 0x1f23a},
|
||||
{0x1f250, 0x1f251},
|
||||
{0x1f300, 0x1f320},
|
||||
{0x1f330, 0x1f335},
|
||||
{0x1f337, 0x1f37c},
|
||||
{0x1f380, 0x1f393},
|
||||
{0x1f3a0, 0x1f3c4},
|
||||
{0x1f3c6, 0x1f3ca},
|
||||
{0x1f3e0, 0x1f3f0},
|
||||
{0x1f400, 0x1f43e},
|
||||
{0x1f440, 0x1f440},
|
||||
{0x1f442, 0x1f4f7},
|
||||
{0x1f4f9, 0x1f4fc},
|
||||
{0x1f500, 0x1f53d},
|
||||
{0x1f550, 0x1f567},
|
||||
{0x1f5fb, 0x1f640},
|
||||
{0x1f645, 0x1f64f},
|
||||
{0x1f680, 0x1f6c5}
|
||||
};
|
||||
|
||||
/*
|
||||
* Get class of a Unicode character.
|
||||
* 0: white space
|
||||
@@ -2564,122 +2680,6 @@ utf_class(int c)
|
||||
{0x2f800, 0x2fa1f, 0x4e00}, /* CJK Ideographs */
|
||||
};
|
||||
|
||||
/* Sorted list of non-overlapping intervals of all Emoji characters,
|
||||
* based on http://unicode.org/emoji/charts/emoji-list.html */
|
||||
static struct interval emoji_all[] =
|
||||
{
|
||||
{0x203c, 0x203c},
|
||||
{0x2049, 0x2049},
|
||||
{0x2122, 0x2122},
|
||||
{0x2139, 0x2139},
|
||||
{0x2194, 0x2199},
|
||||
{0x21a9, 0x21aa},
|
||||
{0x231a, 0x231b},
|
||||
{0x2328, 0x2328},
|
||||
{0x23cf, 0x23cf},
|
||||
{0x23e9, 0x23f3},
|
||||
{0x24c2, 0x24c2},
|
||||
{0x25aa, 0x25ab},
|
||||
{0x25b6, 0x25b6},
|
||||
{0x25c0, 0x25c0},
|
||||
{0x25fb, 0x25fe},
|
||||
{0x2600, 0x2604},
|
||||
{0x260e, 0x260e},
|
||||
{0x2611, 0x2611},
|
||||
{0x2614, 0x2615},
|
||||
{0x2618, 0x2618},
|
||||
{0x261d, 0x261d},
|
||||
{0x2620, 0x2620},
|
||||
{0x2622, 0x2623},
|
||||
{0x2626, 0x2626},
|
||||
{0x262a, 0x262a},
|
||||
{0x262e, 0x262f},
|
||||
{0x2638, 0x263a},
|
||||
{0x2648, 0x2653},
|
||||
{0x2660, 0x2660},
|
||||
{0x2663, 0x2663},
|
||||
{0x2665, 0x2666},
|
||||
{0x2668, 0x2668},
|
||||
{0x267b, 0x267b},
|
||||
{0x267f, 0x267f},
|
||||
{0x2692, 0x2694},
|
||||
{0x2696, 0x2697},
|
||||
{0x2699, 0x2699},
|
||||
{0x269b, 0x269c},
|
||||
{0x26a0, 0x26a1},
|
||||
{0x26aa, 0x26ab},
|
||||
{0x26b0, 0x26b1},
|
||||
{0x26bd, 0x26be},
|
||||
{0x26c4, 0x26c5},
|
||||
{0x26c8, 0x26c8},
|
||||
{0x26ce, 0x26cf},
|
||||
{0x26d1, 0x26d1},
|
||||
{0x26d3, 0x26d4},
|
||||
{0x26e9, 0x26ea},
|
||||
{0x26f0, 0x26f5},
|
||||
{0x26f7, 0x26fa},
|
||||
{0x26fd, 0x26fd},
|
||||
{0x2702, 0x2702},
|
||||
{0x2705, 0x2705},
|
||||
{0x2708, 0x270d},
|
||||
{0x270f, 0x270f},
|
||||
{0x2712, 0x2712},
|
||||
{0x2714, 0x2714},
|
||||
{0x2716, 0x2716},
|
||||
{0x271d, 0x271d},
|
||||
{0x2721, 0x2721},
|
||||
{0x2728, 0x2728},
|
||||
{0x2733, 0x2734},
|
||||
{0x2744, 0x2744},
|
||||
{0x2747, 0x2747},
|
||||
{0x274c, 0x274c},
|
||||
{0x274e, 0x274e},
|
||||
{0x2753, 0x2755},
|
||||
{0x2757, 0x2757},
|
||||
{0x2763, 0x2764},
|
||||
{0x2795, 0x2797},
|
||||
{0x27a1, 0x27a1},
|
||||
{0x27b0, 0x27b0},
|
||||
{0x27bf, 0x27bf},
|
||||
{0x2934, 0x2935},
|
||||
{0x2b05, 0x2b07},
|
||||
{0x2b1b, 0x2b1c},
|
||||
{0x2b50, 0x2b50},
|
||||
{0x2b55, 0x2b55},
|
||||
{0x3030, 0x3030},
|
||||
{0x303d, 0x303d},
|
||||
{0x3297, 0x3297},
|
||||
{0x3299, 0x3299},
|
||||
{0x1f004, 0x1f004},
|
||||
{0x1f0cf, 0x1f0cf},
|
||||
{0x1f170, 0x1f171},
|
||||
{0x1f17e, 0x1f17f},
|
||||
{0x1f18e, 0x1f18e},
|
||||
{0x1f191, 0x1f19a},
|
||||
{0x1f1e6, 0x1f1ff},
|
||||
{0x1f201, 0x1f202},
|
||||
{0x1f21a, 0x1f21a},
|
||||
{0x1f22f, 0x1f22f},
|
||||
{0x1f232, 0x1f23a},
|
||||
{0x1f250, 0x1f251},
|
||||
{0x1f300, 0x1f320},
|
||||
{0x1f330, 0x1f335},
|
||||
{0x1f337, 0x1f37c},
|
||||
{0x1f380, 0x1f393},
|
||||
{0x1f3a0, 0x1f3c4},
|
||||
{0x1f3c6, 0x1f3ca},
|
||||
{0x1f3e0, 0x1f3f0},
|
||||
{0x1f400, 0x1f43e},
|
||||
{0x1f440, 0x1f440},
|
||||
{0x1f442, 0x1f4f7},
|
||||
{0x1f4f9, 0x1f4fc},
|
||||
{0x1f500, 0x1f53d},
|
||||
{0x1f550, 0x1f567},
|
||||
{0x1f5fb, 0x1f640},
|
||||
{0x1f645, 0x1f64f},
|
||||
{0x1f680, 0x1f6c5}
|
||||
};
|
||||
|
||||
int bot = 0;
|
||||
int top = sizeof(classes) / sizeof(struct clinterval) - 1;
|
||||
int mid;
|
||||
@@ -2714,6 +2714,13 @@ utf_class(int c)
|
||||
return 2;
|
||||
}
|
||||
|
||||
int
|
||||
utf_ambiguous_width(int c)
|
||||
{
|
||||
return c >= 0x80 && (intable(ambiguous, sizeof(ambiguous), c)
|
||||
|| intable(emoji_all, sizeof(emoji_all), c));
|
||||
}
|
||||
|
||||
/*
|
||||
* Code for Unicode case-dependent operations. Based on notes in
|
||||
* http://www.unicode.org/Public/UNIDATA/CaseFolding.txt
|
||||
|
||||
@@ -6236,6 +6236,9 @@ parse_queued_messages(void)
|
||||
netbeans_parse_messages();
|
||||
# endif
|
||||
# ifdef FEAT_JOB_CHANNEL
|
||||
/* Write any buffer lines still to be written. */
|
||||
channel_write_any_lines();
|
||||
|
||||
/* Process the messages queued on channels. */
|
||||
channel_parse_messages();
|
||||
# endif
|
||||
|
||||
@@ -2689,6 +2689,33 @@ charset_pairs[] =
|
||||
{NULL, 0}
|
||||
};
|
||||
|
||||
struct quality_pair
|
||||
{
|
||||
char *name;
|
||||
DWORD quality;
|
||||
};
|
||||
|
||||
static struct quality_pair
|
||||
quality_pairs[] = {
|
||||
#ifdef CLEARTYPE_QUALITY
|
||||
{"CLEARTYPE", CLEARTYPE_QUALITY},
|
||||
#endif
|
||||
#ifdef ANTIALIASED_QUALITY
|
||||
{"ANTIALIASED", ANTIALIASED_QUALITY},
|
||||
#endif
|
||||
#ifdef NOANTIALIASED_QUALITY
|
||||
{"NOANTIALIASED", NOANTIALIASED_QUALITY},
|
||||
#endif
|
||||
#ifdef PROOF_QUALITY
|
||||
{"PROOF", PROOF_QUALITY},
|
||||
#endif
|
||||
#ifdef PROOF_QUALITY
|
||||
{"DRAFT", DRAFT_QUALITY},
|
||||
#endif
|
||||
{"DEFAULT", DEFAULT_QUALITY},
|
||||
{NULL, 0}
|
||||
};
|
||||
|
||||
/*
|
||||
* Convert a charset ID to a name.
|
||||
* Return NULL when not recognized.
|
||||
@@ -2704,6 +2731,21 @@ charset_id2name(int id)
|
||||
return cp->name;
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert a quality ID to a name.
|
||||
* Return NULL when not recognized.
|
||||
*/
|
||||
char *
|
||||
quality_id2name(DWORD id)
|
||||
{
|
||||
struct quality_pair *qp;
|
||||
|
||||
for (qp = quality_pairs; qp->name != NULL; ++qp)
|
||||
if (id == qp->quality)
|
||||
break;
|
||||
return qp->name;
|
||||
}
|
||||
|
||||
static const LOGFONT s_lfDefault =
|
||||
{
|
||||
-12, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET,
|
||||
@@ -2985,6 +3027,26 @@ get_logfont(
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'q':
|
||||
{
|
||||
struct quality_pair *qp;
|
||||
|
||||
for (qp = quality_pairs; qp->name != NULL; ++qp)
|
||||
if (STRNCMP(p, qp->name, strlen(qp->name)) == 0)
|
||||
{
|
||||
lf->lfQuality = qp->quality;
|
||||
p += strlen(qp->name);
|
||||
break;
|
||||
}
|
||||
if (qp->name == NULL && verbose)
|
||||
{
|
||||
vim_snprintf((char *)IObuff, IOSIZE,
|
||||
_("E244: Illegal quality name \"%s\" in font name \"%s\""), p, name);
|
||||
EMSG(IObuff);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
if (verbose)
|
||||
{
|
||||
|
||||
+33
-20
@@ -176,11 +176,11 @@ typedef int waitstatus;
|
||||
static pid_t wait4pid(pid_t, waitstatus *);
|
||||
|
||||
static int WaitForChar(long);
|
||||
static int WaitForCharOrMouse(long);
|
||||
static int WaitForCharOrMouse(long, int *break_loop);
|
||||
#if defined(__BEOS__) || defined(VMS)
|
||||
int RealWaitForChar(int, long, int *);
|
||||
int RealWaitForChar(int, long, int *, int *break_loop);
|
||||
#else
|
||||
static int RealWaitForChar(int, long, int *);
|
||||
static int RealWaitForChar(int, long, int *, int *break_loop);
|
||||
#endif
|
||||
|
||||
#ifdef FEAT_XCLIPBOARD
|
||||
@@ -366,7 +366,7 @@ mch_write(char_u *s, int len)
|
||||
{
|
||||
ignored = (int)write(1, (char *)s, len);
|
||||
if (p_wd) /* Unix is too fast, slow down a bit more */
|
||||
RealWaitForChar(read_cmd_fd, p_wd, NULL);
|
||||
RealWaitForChar(read_cmd_fd, p_wd, NULL, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -4780,7 +4780,7 @@ mch_call_shell(
|
||||
* to some terminal (vt52?).
|
||||
*/
|
||||
++noread_cnt;
|
||||
while (RealWaitForChar(fromshell_fd, 10L, NULL))
|
||||
while (RealWaitForChar(fromshell_fd, 10L, NULL, NULL))
|
||||
{
|
||||
len = read_eintr(fromshell_fd, buffer
|
||||
# ifdef FEAT_MBYTE
|
||||
@@ -5365,7 +5365,7 @@ mch_clear_job(job_T *job)
|
||||
void
|
||||
mch_breakcheck(void)
|
||||
{
|
||||
if (curr_tmode == TMODE_RAW && RealWaitForChar(read_cmd_fd, 0L, NULL))
|
||||
if (curr_tmode == TMODE_RAW && RealWaitForChar(read_cmd_fd, 0L, NULL, NULL))
|
||||
fill_input_buf(FALSE);
|
||||
}
|
||||
|
||||
@@ -5382,10 +5382,11 @@ WaitForChar(long msec)
|
||||
#ifdef FEAT_TIMERS
|
||||
long due_time;
|
||||
long remaining = msec;
|
||||
int break_loop = FALSE;
|
||||
|
||||
/* When waiting very briefly don't trigger timers. */
|
||||
if (msec >= 0 && msec < 10L)
|
||||
return WaitForCharOrMouse(msec);
|
||||
return WaitForCharOrMouse(msec, NULL);
|
||||
|
||||
while (msec < 0 || remaining > 0)
|
||||
{
|
||||
@@ -5394,14 +5395,18 @@ WaitForChar(long msec)
|
||||
due_time = check_due_timer();
|
||||
if (due_time <= 0 || (msec > 0 && due_time > remaining))
|
||||
due_time = remaining;
|
||||
if (WaitForCharOrMouse(due_time))
|
||||
if (WaitForCharOrMouse(due_time, &break_loop))
|
||||
return TRUE;
|
||||
if (break_loop)
|
||||
/* Nothing available, but need to return so that side effects get
|
||||
* handled, such as handling a message on a channel. */
|
||||
return FALSE;
|
||||
if (msec > 0)
|
||||
remaining -= due_time;
|
||||
}
|
||||
return FALSE;
|
||||
#else
|
||||
return WaitForCharOrMouse(msec);
|
||||
return WaitForCharOrMouse(msec, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -5412,7 +5417,7 @@ WaitForChar(long msec)
|
||||
* When a GUI is being used, this will never get called -- webb
|
||||
*/
|
||||
static int
|
||||
WaitForCharOrMouse(long msec)
|
||||
WaitForCharOrMouse(long msec, int *break_loop)
|
||||
{
|
||||
#ifdef FEAT_MOUSE_GPM
|
||||
int gpm_process_wanted;
|
||||
@@ -5458,9 +5463,10 @@ WaitForCharOrMouse(long msec)
|
||||
# endif
|
||||
# ifdef FEAT_MOUSE_GPM
|
||||
gpm_process_wanted = 0;
|
||||
avail = RealWaitForChar(read_cmd_fd, msec, &gpm_process_wanted);
|
||||
avail = RealWaitForChar(read_cmd_fd, msec,
|
||||
&gpm_process_wanted, break_loop);
|
||||
# else
|
||||
avail = RealWaitForChar(read_cmd_fd, msec, NULL);
|
||||
avail = RealWaitForChar(read_cmd_fd, msec, NULL, break_loop);
|
||||
# endif
|
||||
if (!avail)
|
||||
{
|
||||
@@ -5479,10 +5485,11 @@ WaitForCharOrMouse(long msec)
|
||||
# ifdef FEAT_XCLIPBOARD
|
||||
|| (!avail && rest != 0)
|
||||
# endif
|
||||
);
|
||||
)
|
||||
;
|
||||
|
||||
#else
|
||||
avail = RealWaitForChar(read_cmd_fd, msec, NULL);
|
||||
avail = RealWaitForChar(read_cmd_fd, msec, NULL, break_loop);
|
||||
#endif
|
||||
return avail;
|
||||
}
|
||||
@@ -5501,7 +5508,7 @@ WaitForCharOrMouse(long msec)
|
||||
#else
|
||||
static int
|
||||
#endif
|
||||
RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED)
|
||||
RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *break_loop)
|
||||
{
|
||||
int ret;
|
||||
int result;
|
||||
@@ -5554,7 +5561,8 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED)
|
||||
# endif
|
||||
#endif
|
||||
#ifndef HAVE_SELECT
|
||||
struct pollfd fds[6 + MAX_OPEN_CHANNELS];
|
||||
/* each channel may use in, out and err */
|
||||
struct pollfd fds[6 + 3 * MAX_OPEN_CHANNELS];
|
||||
int nfd;
|
||||
# ifdef FEAT_XCLIPBOARD
|
||||
int xterm_idx = -1;
|
||||
@@ -5614,6 +5622,8 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED)
|
||||
ret = poll(fds, nfd, towait);
|
||||
|
||||
result = ret > 0 && (fds[0].revents & POLLIN);
|
||||
if (break_loop != NULL && ret > 0)
|
||||
*break_loop = TRUE;
|
||||
|
||||
# ifdef FEAT_MZSCHEME
|
||||
if (ret == 0 && mzquantum_used)
|
||||
@@ -5665,7 +5675,7 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED)
|
||||
|
||||
struct timeval tv;
|
||||
struct timeval *tvp;
|
||||
fd_set rfds, efds;
|
||||
fd_set rfds, wfds, efds;
|
||||
int maxfd;
|
||||
long towait = msec;
|
||||
|
||||
@@ -5698,6 +5708,7 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED)
|
||||
*/
|
||||
select_eintr:
|
||||
FD_ZERO(&rfds);
|
||||
FD_ZERO(&wfds);
|
||||
FD_ZERO(&efds);
|
||||
FD_SET(fd, &rfds);
|
||||
# if !defined(__QNX__) && !defined(__CYGWIN32__)
|
||||
@@ -5738,13 +5749,15 @@ select_eintr:
|
||||
}
|
||||
# endif
|
||||
# ifdef FEAT_JOB_CHANNEL
|
||||
maxfd = channel_select_setup(maxfd, &rfds);
|
||||
maxfd = channel_select_setup(maxfd, &rfds, &wfds);
|
||||
# endif
|
||||
|
||||
ret = select(maxfd + 1, &rfds, NULL, &efds, tvp);
|
||||
ret = select(maxfd + 1, &rfds, &wfds, &efds, tvp);
|
||||
result = ret > 0 && FD_ISSET(fd, &rfds);
|
||||
if (result)
|
||||
--ret;
|
||||
if (break_loop != NULL && ret > 0)
|
||||
*break_loop = TRUE;
|
||||
|
||||
# ifdef EINTR
|
||||
if (ret == -1 && errno == EINTR)
|
||||
@@ -5821,7 +5834,7 @@ select_eintr:
|
||||
# endif
|
||||
#ifdef FEAT_JOB_CHANNEL
|
||||
if (ret > 0)
|
||||
ret = channel_select_check(ret, &rfds);
|
||||
ret = channel_select_check(ret, &rfds, &wfds);
|
||||
#endif
|
||||
|
||||
#endif /* HAVE_SELECT */
|
||||
|
||||
@@ -13,7 +13,7 @@ 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, 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, partial_T *partial, int id);
|
||||
void channel_write_in(channel_T *channel);
|
||||
void channel_write_any_lines(void);
|
||||
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);
|
||||
@@ -37,8 +37,8 @@ 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);
|
||||
int channel_select_check(int ret_in, void *rfds_in);
|
||||
int channel_select_setup(int maxfd_in, void *rfds_in, void *wfds_in);
|
||||
int channel_select_check(int ret_in, void *rfds_in, void *wfds_in);
|
||||
int channel_parse_messages(void);
|
||||
int set_ref_in_channel(int copyID);
|
||||
int channel_part_send(channel_T *channel);
|
||||
|
||||
@@ -10,6 +10,7 @@ int latin_char2len(int c);
|
||||
int latin_char2bytes(int c, char_u *buf);
|
||||
int latin_ptr2len(char_u *p);
|
||||
int latin_ptr2len_len(char_u *p, int size);
|
||||
int utf_ambiguous_width(int c);
|
||||
int utf_char2cells(int c);
|
||||
int latin_ptr2cells(char_u *p);
|
||||
int utf_ptr2cells(char_u *p);
|
||||
|
||||
@@ -49,6 +49,7 @@ void serverForeground(char_u *name);
|
||||
char_u *serverGetReply(HWND server, int *expr_res, int remove, int wait);
|
||||
void serverProcessPendingMessages(void);
|
||||
char *charset_id2name(int id);
|
||||
char *quality_id2name(DWORD id);
|
||||
int get_logfont(LOGFONT *lf, char_u *name, HDC printer_dc, int verbose);
|
||||
void channel_init_winsock(void);
|
||||
/* vim: set ft=c : */
|
||||
|
||||
@@ -47,6 +47,7 @@ int screen_ins_lines(int off, int row, int line_count, int end, win_T *wp);
|
||||
int screen_del_lines(int off, int row, int line_count, int end, int force, win_T *wp);
|
||||
int showmode(void);
|
||||
void unshowmode(int force);
|
||||
void clearmode(void);
|
||||
void get_trans_bufname(buf_T *buf);
|
||||
int redrawing(void);
|
||||
int messaging(void);
|
||||
|
||||
+2
-1
@@ -532,7 +532,8 @@ qf_init_ext(
|
||||
else if (tv->v_type == VAR_LIST)
|
||||
{
|
||||
/* Get the next line from the supplied list */
|
||||
while (p_li && p_li->li_tv.v_type != VAR_STRING)
|
||||
while (p_li && (p_li->li_tv.v_type != VAR_STRING
|
||||
|| p_li->li_tv.vval.v_string == NULL))
|
||||
p_li = p_li->li_next; /* Skip non-string items */
|
||||
|
||||
if (!p_li) /* End of the list */
|
||||
|
||||
+2
-2
@@ -791,7 +791,7 @@ char *EQUIVAL_CLASS_C[16] = {
|
||||
"E\x71\x72\x73\x74",
|
||||
"I\x75\x76\x77\x78",
|
||||
"N\x69",
|
||||
"O\xEB\xEC\xED\xEE\xEF",
|
||||
"O\xEB\xEC\xED\xEE\xEF\x80",
|
||||
"U\xFB\xFC\xFD\xFE",
|
||||
"Y\xBA",
|
||||
"a\x42\x43\x44\x45\x46\x47",
|
||||
@@ -799,7 +799,7 @@ char *EQUIVAL_CLASS_C[16] = {
|
||||
"e\x51\x52\x53\x54",
|
||||
"i\x55\x56\x57\x58",
|
||||
"n\x49",
|
||||
"o\xCB\xCC\xCD\xCE\xCF",
|
||||
"o\xCB\xCC\xCD\xCE\xCF\x70",
|
||||
"u\xDB\xDC\xDD\xDE",
|
||||
"y\x8D\xDF",
|
||||
};
|
||||
|
||||
+16
-7
@@ -8065,7 +8065,9 @@ screen_char(unsigned off, int row, int col)
|
||||
buf[utfc_char2bytes(off, buf)] = NUL;
|
||||
|
||||
out_str(buf);
|
||||
if (utf_char2cells(ScreenLinesUC[off]) > 1)
|
||||
if (utf_ambiguous_width(ScreenLinesUC[off]))
|
||||
screen_cur_col = 9999;
|
||||
else if (utf_char2cells(ScreenLinesUC[off]) > 1)
|
||||
++screen_cur_col;
|
||||
}
|
||||
else
|
||||
@@ -10213,12 +10215,19 @@ unshowmode(int force)
|
||||
if (!redrawing() || (!force && char_avail() && !KeyTyped))
|
||||
redraw_cmdline = TRUE; /* delete mode later */
|
||||
else
|
||||
{
|
||||
msg_pos_mode();
|
||||
if (Recording)
|
||||
recording_mode(hl_attr(HLF_CM));
|
||||
msg_clr_eos();
|
||||
}
|
||||
clearmode();
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear the mode message.
|
||||
*/
|
||||
void
|
||||
clearmode()
|
||||
{
|
||||
msg_pos_mode();
|
||||
if (Recording)
|
||||
recording_mode(hl_attr(HLF_CM));
|
||||
msg_clr_eos();
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
+7
-1
@@ -1386,12 +1386,15 @@ typedef struct {
|
||||
#else
|
||||
struct timeval ch_deadline;
|
||||
#endif
|
||||
int ch_block_write; /* for testing: 0 when not used, -1 when write
|
||||
* does not block, 1 simulate blocking */
|
||||
|
||||
cbq_T ch_cb_head; /* dummy node for per-request callbacks */
|
||||
char_u *ch_callback; /* call when a msg is not handled */
|
||||
partial_T *ch_partial;
|
||||
|
||||
buf_T *ch_buffer; /* buffer to read from or write to */
|
||||
int ch_buf_append; /* write appended lines instead top-bot */
|
||||
linenr_T ch_buf_top; /* next line to send */
|
||||
linenr_T ch_buf_bot; /* last line to send */
|
||||
} chanpart_T;
|
||||
@@ -1460,7 +1463,8 @@ struct channel_S {
|
||||
#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_BLOCK_WRITE 0x10000000 /* "block_write" */
|
||||
#define JO_ALL 0x7fffffff
|
||||
|
||||
#define JO_MODE_ALL (JO_MODE + JO_IN_MODE + JO_OUT_MODE + JO_ERR_MODE)
|
||||
#define JO_CB_ALL \
|
||||
@@ -1502,6 +1506,7 @@ typedef struct
|
||||
int jo_timeout;
|
||||
int jo_out_timeout;
|
||||
int jo_err_timeout;
|
||||
int jo_block_write; /* for testing only */
|
||||
int jo_part;
|
||||
int jo_id;
|
||||
char_u jo_soe_buf[NUMBUFLEN];
|
||||
@@ -2990,6 +2995,7 @@ struct js_reader
|
||||
/* function to fill the buffer or NULL;
|
||||
* return TRUE when the buffer was filled */
|
||||
void *js_cookie; /* can be used by js_fill */
|
||||
int js_cookie_arg; /* can be used by js_fill */
|
||||
};
|
||||
typedef struct js_reader js_read_T;
|
||||
|
||||
|
||||
+4
-2
@@ -509,7 +509,9 @@ syntax_start(win_T *wp, linenr_T lnum)
|
||||
* Also do this when a change was made, the current state may be invalid
|
||||
* then.
|
||||
*/
|
||||
if (syn_block != wp->w_s || changedtick != syn_buf->b_changedtick)
|
||||
if (syn_block != wp->w_s
|
||||
|| syn_buf != wp->w_buffer
|
||||
|| changedtick != syn_buf->b_changedtick)
|
||||
{
|
||||
invalidate_current_state();
|
||||
syn_buf = wp->w_buffer;
|
||||
@@ -3813,6 +3815,7 @@ syn_cmd_enable(exarg_T *eap, int syncing UNUSED)
|
||||
|
||||
/*
|
||||
* Handle ":syntax reset" command.
|
||||
* It actually resets highlighting, not syntax.
|
||||
*/
|
||||
static void
|
||||
syn_cmd_reset(exarg_T *eap, int syncing UNUSED)
|
||||
@@ -3820,7 +3823,6 @@ syn_cmd_reset(exarg_T *eap, int syncing UNUSED)
|
||||
eap->nextcmd = check_nextcmd(eap->arg);
|
||||
if (!eap->skip)
|
||||
{
|
||||
clear_string_option(&curwin->w_s->b_syn_isk);
|
||||
set_internal_string_var((char_u *)"syntax_cmd", (char_u *)"reset");
|
||||
do_cmdline_cmd((char_u *)"runtime! syntax/syncolor.vim");
|
||||
do_unlet((char_u *)"g:syntax_cmd", TRUE);
|
||||
|
||||
@@ -183,6 +183,8 @@ NEW_TESTS = test_arglist.res \
|
||||
test_viml.res \
|
||||
test_visual.res \
|
||||
test_window_id.res \
|
||||
test_alot_latin.res \
|
||||
test_alot_utf8.res \
|
||||
test_alot.res
|
||||
|
||||
|
||||
|
||||
@@ -65,9 +65,11 @@ win32: fixff $(SCRIPTS_FIRST) $(SCRIPTS) $(SCRIPTS_WIN32)
|
||||
echo ALL DONE
|
||||
|
||||
fixff:
|
||||
# TODO: find a way to avoid changing the distributed files.
|
||||
-$(VIMPROG) -u dos.vim $(NO_PLUGIN) "+argdo set ff=dos|upd" +q *.in *.ok
|
||||
-$(VIMPROG) -u dos.vim $(NO_PLUGIN) "+argdo set ff=unix|upd" +q \
|
||||
dotest.in test60.ok test71.ok test74.ok test_listchars.ok
|
||||
dotest.in test60.ok test71.ok test74.ok test_listchars.ok \
|
||||
test_getcwd.ok test_wordcount.ok
|
||||
|
||||
clean:
|
||||
-$(DEL) *.out
|
||||
|
||||
@@ -55,6 +55,9 @@ lang mess C
|
||||
" Always use forward slashes.
|
||||
set shellslash
|
||||
|
||||
" Make sure $HOME does not get read or written.
|
||||
let $HOME = '/does/not/exist'
|
||||
|
||||
let s:srcdir = expand('%:p:h:h')
|
||||
|
||||
" Support function: get the alloc ID by name.
|
||||
@@ -141,7 +144,6 @@ for s:test in sort(s:tests)
|
||||
call extend(s:errors, v:errors)
|
||||
let v:errors = []
|
||||
endif
|
||||
|
||||
endfor
|
||||
|
||||
if s:fail == 0
|
||||
|
||||
@@ -34,10 +34,6 @@ x:" f
|
||||
/[\U1234abcd\u1234\uabcd]
|
||||
x:" g
|
||||
/\%d21879b
|
||||
x:" h
|
||||
/ [[=A=]]* [[=B=]]* [[=C=]]* [[=D=]]* [[=E=]]* [[=F=]]* [[=G=]]* [[=H=]]* [[=I=]]* [[=J=]]* [[=K=]]* [[=L=]]* [[=M=]]* [[=N=]]* [[=O=]]* [[=P=]]* [[=Q=]]* [[=R=]]* [[=S=]]* [[=T=]]* [[=U=]]* [[=V=]]* [[=W=]]* [[=X=]]* [[=Y=]]* [[=Z=]]*/e
|
||||
x:" i
|
||||
/ [[=a=]]* [[=b=]]* [[=c=]]* [[=d=]]* [[=e=]]* [[=f=]]* [[=g=]]* [[=h=]]* [[=i=]]* [[=j=]]* [[=k=]]* [[=l=]]* [[=m=]]* [[=n=]]* [[=o=]]* [[=p=]]* [[=q=]]* [[=r=]]* [[=s=]]* [[=t=]]* [[=u=]]* [[=v=]]* [[=w=]]* [[=x=]]* [[=y=]]* [[=z=]]*/e
|
||||
x:" j Test backwards search from a multi-byte char
|
||||
/x
|
||||
x?.
|
||||
@@ -80,8 +76,6 @@ d 天使x
|
||||
e ü’�…™¸y
|
||||
f ü’�Н�z
|
||||
g aå•·bb
|
||||
h AÀÁÂÃÄÅĀĂĄǍǞǠẢ BḂḆ CÇĆĈĊČ DĎĐḊḎḐ EÈÉÊËĒĔĖĘĚẺẼ FḞ GĜĞĠĢǤǦǴḠ HĤĦḢḦḨ IÌÍÎÏĨĪĬĮİǏỈ JĴ KĶǨḰḴ LĹĻĽĿŁḺ MḾṀ NÑŃŅŇṄṈ OÒÓÔÕÖØŌŎŐƠǑǪǬỎ PṔṖ Q RŔŖŘṘṞ SŚŜŞŠṠ TŢŤŦṪṮ UÙÚÛÜŨŪŬŮŰŲƯǓỦ VṼ WŴẀẂẄẆ XẊẌ YÝŶŸẎỲỶỸ ZŹŻŽƵẐẔ
|
||||
i aàáâãäåāăąǎǟǡả bḃḇ cçćĉċč dďđḋḏḑ eèéêëēĕėęěẻẽ fḟ gĝğġģǥǧǵḡ hĥħḣḧḩẖ iìíîïĩīĭįǐỉ jĵǰ kķǩḱḵ lĺļľŀłḻ mḿṁ nñńņňʼnṅṉ oòóôõöøōŏőơǒǫǭỏ pṕṗ q rŕŗřṙṟ sśŝşšṡ tţťŧṫṯẗ uùúûüũūŭůűųưǔủ vṽ wŵẁẃẅẇẘ xẋẍ yýÿŷẏẙỳỷỹ zźżžƶẑẕ
|
||||
j 0123�x
|
||||
k combinations
|
||||
l äö üᾱ̆�
|
||||
|
||||
@@ -14,8 +14,6 @@ d 使x
|
||||
e y
|
||||
f z
|
||||
g abb
|
||||
h AÀÁÂÃÄÅĀĂĄǍǞǠẢ BḂḆ CÇĆĈĊČ DĎĐḊḎḐ EÈÉÊËĒĔĖĘĚẺẼ FḞ GĜĞĠĢǤǦǴḠ HĤĦḢḦḨ IÌÍÎÏĨĪĬĮİǏỈ JĴ KĶǨḰḴ LĹĻĽĿŁḺ MḾṀ NÑŃŅŇṄṈ OÒÓÔÕÖØŌŎŐƠǑǪǬỎ PṔṖ Q RŔŖŘṘṞ SŚŜŞŠṠ TŢŤŦṪṮ UÙÚÛÜŨŪŬŮŰŲƯǓỦ VṼ WŴẀẂẄẆ XẊẌ YÝŶŸẎỲỶỸ ZŹŻŽƵẐ
|
||||
i aàáâãäåāăąǎǟǡả bḃḇ cçćĉċč dďđḋḏḑ eèéêëēĕėęěẻẽ fḟ gĝğġģǥǧǵḡ hĥħḣḧḩẖ iìíîïĩīĭįǐỉ jĵǰ kķǩḱḵ lĺļľŀłḻ mḿṁ nñńņňʼnṅṉ oòóôõöøōŏőơǒǫǭỏ pṕṗ q rŕŗřṙṟ sśŝşšṡ tţťŧṫṯẗ uùúûüũūŭůűųưǔủ vṽ wŵẁẃẅẇẘ xẋẍ yýÿŷẏẙỳỷỹ zźżžƶẑ
|
||||
j 012❤
|
||||
k œ̄ṣ́m̥̄ᾱ̆́
|
||||
l ä ö ü ᾱ̆́
|
||||
|
||||
@@ -589,15 +589,6 @@ endfunction
|
||||
endfunction
|
||||
:call TestExists()
|
||||
:"
|
||||
:function TestHas()
|
||||
redir >> test.out
|
||||
for pl in ['6.9.999', '7.1.999', '7.4.123', '9.1.0', '9.9.1']
|
||||
echo 'has patch ' . pl . ': ' . has('patch-' . pl)
|
||||
endfor
|
||||
redir END
|
||||
endfunc
|
||||
:call TestHas()
|
||||
:"
|
||||
:delfunc TestExists
|
||||
:delfunc RunTest
|
||||
:delfunc TestFuncArg
|
||||
|
||||
@@ -204,8 +204,3 @@ OK
|
||||
g:footest#x = 1
|
||||
footest#F() 0
|
||||
UndefFun() 0
|
||||
has patch 6.9.999: 1
|
||||
has patch 7.1.999: 1
|
||||
has patch 7.4.123: 1
|
||||
has patch 9.1.0: 0
|
||||
has patch 9.9.1: 0
|
||||
|
||||
@@ -29,8 +29,6 @@ x/[\u4f7f\u5929]\+
|
||||
x/\%U12345678
|
||||
x/[\U1234abcd\u1234\uabcd]
|
||||
x/\%d21879b
|
||||
x/ [[=A=]]* [[=B=]]* [[=C=]]* [[=D=]]* [[=E=]]* [[=F=]]* [[=G=]]* [[=H=]]* [[=I=]]* [[=J=]]* [[=K=]]* [[=L=]]* [[=M=]]* [[=N=]]* [[=O=]]* [[=P=]]* [[=Q=]]* [[=R=]]* [[=S=]]* [[=T=]]* [[=U=]]* [[=V=]]* [[=W=]]* [[=X=]]* [[=Y=]]* [[=Z=]]*/e
|
||||
x/ [[=a=]]* [[=b=]]* [[=c=]]* [[=d=]]* [[=e=]]* [[=f=]]* [[=g=]]* [[=h=]]* [[=i=]]* [[=j=]]* [[=k=]]* [[=l=]]* [[=m=]]* [[=n=]]* [[=o=]]* [[=p=]]* [[=q=]]* [[=r=]]* [[=s=]]* [[=t=]]* [[=u=]]* [[=v=]]* [[=w=]]* [[=x=]]* [[=y=]]* [[=z=]]*/e
|
||||
x:" Test backwards search from a multi-byte char
|
||||
/x
|
||||
x?.
|
||||
@@ -66,8 +64,6 @@ d 天使x
|
||||
e ü’�…™¸y
|
||||
f ü’�Н�z
|
||||
g aå•·bb
|
||||
h AÀÁÂÃÄÅĀĂĄǍǞǠẢ BḂḆ CÇĆĈĊČ DĎĐḊḎḐ EÈÉÊËĒĔĖĘĚẺẼ FḞ GĜĞĠĢǤǦǴḠ HĤĦḢḦḨ IÌÍÎÏĨĪĬĮİǏỈ JĴ KĶǨḰḴ LĹĻĽĿŁḺ MḾṀ NÑŃŅŇṄṈ OÒÓÔÕÖØŌŎŐƠǑǪǬỎ PṔṖ Q RŔŖŘṘṞ SŚŜŞŠṠ TŢŤŦṪṮ UÙÚÛÜŨŪŬŮŰŲƯǓỦ VṼ WŴẀẂẄẆ XẊẌ YÝŶŸẎỲỶỸ ZŹŻŽƵẐẔ
|
||||
i aàáâãäåāăąǎǟǡả bḃḇ cçćĉċč dďđḋḏḑ eèéêëēĕėęěẻẽ fḟ gĝğġģǥǧǵḡ hĥħḣḧḩẖ iìíîïĩīĭįǐỉ jĵǰ kķǩḱḵ lĺļľŀłḻ mḿṁ nñńņňʼnṅṉ oòóôõöøōŏőơǒǫǭỏ pṕṗ q rŕŗřṙṟ sśŝşšṡ tţťŧṫṯẗ uùúûüũūŭůűųưǔủ vṽ wŵẁẃẅẇẘ xẋẍ yýÿŷẏẙỳỷỹ zźżžƶẑẕ
|
||||
j 0123�x
|
||||
k combinations
|
||||
l äö üᾱ̆�
|
||||
|
||||
@@ -14,8 +14,6 @@ d 使x
|
||||
e y
|
||||
f z
|
||||
g abb
|
||||
h AÀÁÂÃÄÅĀĂĄǍǞǠẢ BḂḆ CÇĆĈĊČ DĎĐḊḎḐ EÈÉÊËĒĔĖĘĚẺẼ FḞ GĜĞĠĢǤǦǴḠ HĤĦḢḦḨ IÌÍÎÏĨĪĬĮİǏỈ JĴ KĶǨḰḴ LĹĻĽĿŁḺ MḾṀ NÑŃŅŇṄṈ OÒÓÔÕÖØŌŎŐƠǑǪǬỎ PṔṖ Q RŔŖŘṘṞ SŚŜŞŠṠ TŢŤŦṪṮ UÙÚÛÜŨŪŬŮŰŲƯǓỦ VṼ WŴẀẂẄẆ XẊẌ YÝŶŸẎỲỶỸ ZŹŻŽƵẐ
|
||||
i aàáâãäåāăąǎǟǡả bḃḇ cçćĉċč dďđḋḏḑ eèéêëēĕėęěẻẽ fḟ gĝğġģǥǧǵḡ hĥħḣḧḩẖ iìíîïĩīĭįǐỉ jĵǰ kķǩḱḵ lĺļľŀłḻ mḿṁ nñńņňʼnṅṉ oòóôõöøōŏőơǒǫǭỏ pṕṗ q rŕŗřṙṟ sśŝşšṡ tţťŧṫṯẗ uùúûüũūŭůűųưǔủ vṽ wŵẁẃẅẇẘ xẋẍ yýÿŷẏẙỳỷỹ zźżžƶẑ
|
||||
j 012❤
|
||||
k œ̄ṣ́m̥̄ᾱ̆́
|
||||
l ä ö ü ᾱ̆́
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
" This makes testing go faster, since Vim doesn't need to restart.
|
||||
|
||||
source test_assign.vim
|
||||
source test_autocmd.vim
|
||||
source test_cursor_func.vim
|
||||
source test_delete.vim
|
||||
source test_ex_undo.vim
|
||||
@@ -14,6 +15,7 @@ source test_glob2regpat.vim
|
||||
source test_help_tagjump.vim
|
||||
source test_join.vim
|
||||
source test_lispwords.vim
|
||||
source test_matchstrpos.vim
|
||||
source test_menu.vim
|
||||
source test_partial.vim
|
||||
source test_reltime.vim
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
" A series of tests that can run in one Vim invocation.
|
||||
" This makes testing go faster, since Vim doesn't need to restart.
|
||||
|
||||
" These tests use latin1 'encoding'. Setting 'encoding' is in the individual
|
||||
" files, so that they can be run by themselves.
|
||||
|
||||
source test_regexp_latin.vim
|
||||
@@ -0,0 +1,7 @@
|
||||
" A series of tests that can run in one Vim invocation.
|
||||
" This makes testing go faster, since Vim doesn't need to restart.
|
||||
|
||||
" These tests use utf8 'encoding'. Setting 'encoding' is in the individual
|
||||
" files, so that they can be run by themselves.
|
||||
|
||||
source test_regexp_utf8.vim
|
||||
@@ -18,6 +18,22 @@ func Test_assert_equal()
|
||||
call assert_equal(4, n)
|
||||
let l = [1, 2, 3]
|
||||
call assert_equal([1, 2, 3], l)
|
||||
|
||||
let s = 'foo'
|
||||
call assert_equal('bar', s)
|
||||
call assert_match("Expected 'bar' but got 'foo'", v:errors[0])
|
||||
call remove(v:errors, 0)
|
||||
endfunc
|
||||
|
||||
func Test_assert_notequal()
|
||||
let n = 4
|
||||
call assert_notequal('foo', n)
|
||||
let s = 'foo'
|
||||
call assert_notequal([1, 2, 3], s)
|
||||
|
||||
call assert_notequal('foo', s)
|
||||
call assert_match("Expected 'foo' differs from 'foo'", v:errors[0])
|
||||
call remove(v:errors, 0)
|
||||
endfunc
|
||||
|
||||
func Test_assert_exception()
|
||||
@@ -57,14 +73,35 @@ func Test_compare_fail()
|
||||
call assert_equal(s:w, '')
|
||||
catch
|
||||
call assert_exception('E724:')
|
||||
call assert_true(v:errors[0] =~ "Expected NULL but got ''")
|
||||
call assert_match("Expected NULL but got ''", v:errors[0])
|
||||
call remove(v:errors, 0)
|
||||
endtry
|
||||
endfunc
|
||||
|
||||
func Test_match()
|
||||
call assert_match('^f.*b.*r$', 'foobar')
|
||||
|
||||
call assert_match('bar.*foo', 'foobar')
|
||||
call assert_match("Pattern 'bar.*foo' does not match 'foobar'", v:errors[0])
|
||||
call remove(v:errors, 0)
|
||||
|
||||
call assert_match('bar.*foo', 'foobar', 'wrong')
|
||||
call assert_match('wrong', v:errors[0])
|
||||
call remove(v:errors, 0)
|
||||
endfunc
|
||||
|
||||
func Test_notmatch()
|
||||
call assert_notmatch('foo', 'bar')
|
||||
call assert_notmatch('^foobar$', 'foobars')
|
||||
|
||||
call assert_notmatch('foo', 'foobar')
|
||||
call assert_match("Pattern 'foo' does match 'foobar'", v:errors[0])
|
||||
call remove(v:errors, 0)
|
||||
endfunc
|
||||
|
||||
func Test_assert_fail_fails()
|
||||
call assert_fails('xxx', {})
|
||||
call assert_true(v:errors[0] =~ "Expected {} but got 'E731:")
|
||||
call assert_match("Expected {} but got 'E731:", v:errors[0])
|
||||
call remove(v:errors, 0)
|
||||
endfunc
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
" Tests for autocommands
|
||||
|
||||
func Test_vim_did_enter()
|
||||
call assert_false(v:vim_did_enter)
|
||||
|
||||
" This script will never reach the main loop, can't check if v:vim_did_enter
|
||||
" becomes one.
|
||||
endfunc
|
||||
@@ -53,7 +53,7 @@ func Test_backspace_option()
|
||||
" Cleared when 'compatible' is set
|
||||
set compatible
|
||||
call assert_equal('', &backspace)
|
||||
set nocompatible
|
||||
set nocompatible viminfo+=nviminfo
|
||||
endfunc
|
||||
|
||||
" vim: tabstop=2 shiftwidth=0 expandtab
|
||||
|
||||
@@ -73,6 +73,11 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
|
||||
print("sending: {0}".format(cmd))
|
||||
self.request.sendall(cmd.encode('utf-8'))
|
||||
response = "ok"
|
||||
elif decoded[1] == 'bad command':
|
||||
cmd = '["ex","foo bar"]'
|
||||
print("sending: {0}".format(cmd))
|
||||
self.request.sendall(cmd.encode('utf-8'))
|
||||
response = "ok"
|
||||
elif decoded[1] == 'do normal':
|
||||
# Send a normal command.
|
||||
cmd = '["normal","G$s more\u001b"]'
|
||||
@@ -85,16 +90,28 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
|
||||
print("sending: {0}".format(cmd))
|
||||
self.request.sendall(cmd.encode('utf-8'))
|
||||
response = "ok"
|
||||
elif decoded[1] == 'eval-special':
|
||||
# Send an eval request. We ignore the response.
|
||||
cmd = '["expr","\\"foo\x7f\x10\x01bar\\"", -2]'
|
||||
print("sending: {0}".format(cmd))
|
||||
self.request.sendall(cmd.encode('utf-8'))
|
||||
response = "ok"
|
||||
elif decoded[1] == 'eval-getline':
|
||||
# Send an eval request. We ignore the response.
|
||||
cmd = '["expr","getline(3)", -3]'
|
||||
print("sending: {0}".format(cmd))
|
||||
self.request.sendall(cmd.encode('utf-8'))
|
||||
response = "ok"
|
||||
elif decoded[1] == 'eval-fails':
|
||||
# Send an eval request that will fail.
|
||||
cmd = '["expr","xxx", -2]'
|
||||
cmd = '["expr","xxx", -4]'
|
||||
print("sending: {0}".format(cmd))
|
||||
self.request.sendall(cmd.encode('utf-8'))
|
||||
response = "ok"
|
||||
elif decoded[1] == 'eval-error':
|
||||
# Send an eval request that works but the result can't
|
||||
# be encoded.
|
||||
cmd = '["expr","function(\\"tr\\")", -3]'
|
||||
cmd = '["expr","function(\\"tr\\")", -5]'
|
||||
print("sending: {0}".format(cmd))
|
||||
self.request.sendall(cmd.encode('utf-8'))
|
||||
response = "ok"
|
||||
|
||||
@@ -151,6 +151,11 @@ func s:communicate(port)
|
||||
call assert_equal('added1', getline(line('$') - 1))
|
||||
call assert_equal('added2', getline('$'))
|
||||
|
||||
" Request command "foo bar", which fails silently.
|
||||
call assert_equal('ok', ch_evalexpr(handle, 'bad command'))
|
||||
call s:waitFor('v:errmsg =~ "E492"')
|
||||
call assert_match('E492:.*foo bar', v:errmsg)
|
||||
|
||||
call assert_equal('ok', ch_evalexpr(handle, 'do normal', {'timeout': 100}))
|
||||
call s:waitFor('"added more" == getline("$")')
|
||||
call assert_equal('added more', getline('$'))
|
||||
@@ -192,20 +197,31 @@ func s:communicate(port)
|
||||
sleep 10m
|
||||
call assert_equal([-1, 'foo123'], ch_evalexpr(handle, 'eval-result'))
|
||||
|
||||
" Send an eval request with special characters.
|
||||
call assert_equal('ok', ch_evalexpr(handle, 'eval-special'))
|
||||
sleep 10m
|
||||
call assert_equal([-2, "foo\x7f\x10\x01bar"], ch_evalexpr(handle, 'eval-result'))
|
||||
|
||||
" Send an eval request to get a line with special characters.
|
||||
call setline(3, "a\nb\<CR>c\x01d\x7fe")
|
||||
call assert_equal('ok', ch_evalexpr(handle, 'eval-getline'))
|
||||
sleep 10m
|
||||
call assert_equal([-3, "a\nb\<CR>c\x01d\x7fe"], ch_evalexpr(handle, 'eval-result'))
|
||||
|
||||
" Send an eval request that fails.
|
||||
call assert_equal('ok', ch_evalexpr(handle, 'eval-fails'))
|
||||
sleep 10m
|
||||
call assert_equal([-2, 'ERROR'], ch_evalexpr(handle, 'eval-result'))
|
||||
call assert_equal([-4, 'ERROR'], ch_evalexpr(handle, 'eval-result'))
|
||||
|
||||
" Send an eval request that works but can't be encoded.
|
||||
call assert_equal('ok', ch_evalexpr(handle, 'eval-error'))
|
||||
sleep 10m
|
||||
call assert_equal([-3, 'ERROR'], ch_evalexpr(handle, 'eval-result'))
|
||||
call assert_equal([-5, 'ERROR'], ch_evalexpr(handle, 'eval-result'))
|
||||
|
||||
" Send a bad eval request. There will be no response.
|
||||
call assert_equal('ok', ch_evalexpr(handle, 'eval-bad'))
|
||||
sleep 10m
|
||||
call assert_equal([-3, 'ERROR'], ch_evalexpr(handle, 'eval-result'))
|
||||
call assert_equal([-5, 'ERROR'], ch_evalexpr(handle, 'eval-result'))
|
||||
|
||||
" Send an expr request
|
||||
call assert_equal('ok', ch_evalexpr(handle, 'an expr'))
|
||||
@@ -775,7 +791,7 @@ func Run_test_pipe_from_buffer(use_name)
|
||||
|
||||
sp pipe-input
|
||||
call setline(1, ['echo one', 'echo two', 'echo three'])
|
||||
let options = {'in_io': 'buffer'}
|
||||
let options = {'in_io': 'buffer', 'block_write': 1}
|
||||
if a:use_name
|
||||
let options['in_name'] = 'pipe-input'
|
||||
else
|
||||
@@ -869,7 +885,8 @@ func Test_pipe_io_two_buffers()
|
||||
|
||||
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'})
|
||||
\ 'out_io': 'buffer', 'out_name': 'pipe-output',
|
||||
\ 'block_write': 1})
|
||||
call assert_equal("run", job_status(job))
|
||||
try
|
||||
exe "normal Gaecho hello\<CR>"
|
||||
@@ -904,7 +921,8 @@ func Test_pipe_io_one_buffer()
|
||||
|
||||
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'})
|
||||
\ 'out_io': 'buffer', 'out_name': 'pipe-io',
|
||||
\ 'block_write': 1})
|
||||
call assert_equal("run", job_status(job))
|
||||
try
|
||||
exe "normal Goecho hello\<CR>"
|
||||
@@ -1185,5 +1203,33 @@ func Test_close_callback()
|
||||
call s:run_server('s:test_close_callback')
|
||||
endfunc
|
||||
|
||||
function s:test_close_partial(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
|
||||
let s:d = {}
|
||||
func s:d.closeCb(ch) dict
|
||||
let self.close_ret = 'closed'
|
||||
endfunc
|
||||
call ch_setoptions(handle, {'close_cb': s:d.closeCb})
|
||||
|
||||
call assert_equal('', ch_evalexpr(handle, 'close me'))
|
||||
call s:waitFor('"closed" == s:d.close_ret')
|
||||
call assert_equal('closed', s:d.close_ret)
|
||||
unlet s:d
|
||||
endfunc
|
||||
|
||||
func Test_close_partial()
|
||||
call ch_log('Test_close_partial()')
|
||||
call s:run_server('s:test_close_partial')
|
||||
endfunc
|
||||
|
||||
func Test_job_start_invalid()
|
||||
call assert_fails('call job_start($x)', 'E474:')
|
||||
call assert_fails('call job_start("")', 'E474:')
|
||||
endfunc
|
||||
|
||||
" Uncomment this to see what happens, output is in src/testdir/channellog.
|
||||
" call ch_logfile('channellog', 'w')
|
||||
|
||||
@@ -21,3 +21,32 @@ func Test_equal()
|
||||
|
||||
call assert_fails('echo base.method > instance.method')
|
||||
endfunc
|
||||
|
||||
func Test_version()
|
||||
call assert_true(has('patch-7.4.001'))
|
||||
call assert_true(has('patch-7.4.01'))
|
||||
call assert_true(has('patch-7.4.1'))
|
||||
call assert_true(has('patch-6.9.999'))
|
||||
call assert_true(has('patch-7.1.999'))
|
||||
call assert_true(has('patch-7.4.123'))
|
||||
|
||||
call assert_false(has('patch-7'))
|
||||
call assert_false(has('patch-7.4'))
|
||||
call assert_false(has('patch-7.4.'))
|
||||
call assert_false(has('patch-9.1.0'))
|
||||
call assert_false(has('patch-9.9.1'))
|
||||
endfunc
|
||||
|
||||
func Test_dict()
|
||||
let d = {'': 'empty', 'a': 'a', 0: 'zero'}
|
||||
call assert_equal('empty', d[''])
|
||||
call assert_equal('a', d['a'])
|
||||
call assert_equal('zero', d[0])
|
||||
call assert_true(has_key(d, ''))
|
||||
call assert_true(has_key(d, 'a'))
|
||||
|
||||
let d[''] = 'none'
|
||||
let d['a'] = 'aaa'
|
||||
call assert_equal('none', d[''])
|
||||
call assert_equal('aaa', d['a'])
|
||||
endfunc
|
||||
|
||||
@@ -6,5 +6,9 @@ func Test_feedkeys_x_with_empty_string()
|
||||
call assert_equal('', getline('.'))
|
||||
call feedkeys('', 'x')
|
||||
call assert_equal('foo', getline('.'))
|
||||
|
||||
" check it goes back to normal mode immediately.
|
||||
call feedkeys('i', 'x')
|
||||
call assert_equal('foo', getline('.'))
|
||||
quit!
|
||||
endfunc
|
||||
|
||||
@@ -23,6 +23,10 @@ func Test_printoptions_parsing()
|
||||
set printoptions=formfeed:y
|
||||
set printoptions=
|
||||
set printoptions&
|
||||
|
||||
call assert_fails('set printoptions=paper', 'E550:')
|
||||
call assert_fails('set printoptions=shredder:on', 'E551:')
|
||||
call assert_fails('set printoptions=left:no', 'E552:')
|
||||
endfunc
|
||||
|
||||
func Test_printmbfont_parsing()
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
" Test matchstrpos
|
||||
|
||||
func Test_matchstrpos()
|
||||
call assert_equal(['ing', 4, 7], matchstrpos('testing', 'ing'))
|
||||
|
||||
call assert_equal(['ing', 4, 7], matchstrpos('testing', 'ing', 2))
|
||||
|
||||
call assert_equal(['', -1, -1], matchstrpos('testing', 'ing', 5))
|
||||
|
||||
call assert_equal(['ing', 1, 4, 7], matchstrpos(['vim', 'testing', 'execute'], 'ing'))
|
||||
|
||||
call assert_equal(['', -1, -1, -1], matchstrpos(['vim', 'testing', 'execute'], 'img'))
|
||||
endfunc
|
||||
@@ -11,7 +11,7 @@ func TearDown()
|
||||
endfunc
|
||||
|
||||
func Test_packadd()
|
||||
call mkdir(s:plugdir . '/plugin', 'p')
|
||||
call mkdir(s:plugdir . '/plugin/also', 'p')
|
||||
call mkdir(s:plugdir . '/ftdetect', 'p')
|
||||
set rtp&
|
||||
let rtp = &rtp
|
||||
@@ -21,6 +21,10 @@ func Test_packadd()
|
||||
call setline(1, 'let g:plugin_works = 42')
|
||||
wq
|
||||
|
||||
exe 'split ' . s:plugdir . '/plugin/also/loaded.vim'
|
||||
call setline(1, 'let g:plugin_also_works = 77')
|
||||
wq
|
||||
|
||||
exe 'split ' . s:plugdir . '/ftdetect/test.vim'
|
||||
call setline(1, 'let g:ftdetect_works = 17')
|
||||
wq
|
||||
@@ -28,6 +32,7 @@ func Test_packadd()
|
||||
packadd mytest
|
||||
|
||||
call assert_equal(42, g:plugin_works)
|
||||
call assert_equal(77, g:plugin_also_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\($\|,\)')
|
||||
|
||||
@@ -692,3 +692,8 @@ func Test_caddbuffer_to_empty()
|
||||
endtry
|
||||
quit!
|
||||
endfunc
|
||||
|
||||
func Test_cgetexpr_works()
|
||||
" this must not crash Vim
|
||||
cgetexpr [$x]
|
||||
endfunc
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
" Tests for regexp in latin1 encoding
|
||||
set encoding=latin1
|
||||
scriptencoding latin1
|
||||
|
||||
func s:equivalence_test()
|
||||
let str = "AÀÁÂÃÄÅ B C D EÈÉÊË F G H IÌÍÎÏ J K L M NÑ OÒÓÔÕÖØ P Q R S T UÙÚÛÜ V W X YÝ Z aàáâãäå b c d eèéêë f g h iìíîï j k l m nñ oòóôõöø p q r s t uùúûü v w x yýÿ z"
|
||||
let groups = split(str)
|
||||
for group1 in groups
|
||||
for c in split(group1, '\zs')
|
||||
" next statement confirms that equivalence class matches every
|
||||
" character in group
|
||||
call assert_match('^[[=' . c . '=]]*$', group1)
|
||||
for group2 in groups
|
||||
if group2 != group1
|
||||
" next statement converts that equivalence class doesn't match
|
||||
" a character in any other group
|
||||
call assert_equal(-1, match(group2, '[[=' . c . '=]]'))
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
endfor
|
||||
endfunc
|
||||
|
||||
func Test_equivalence_re1()
|
||||
set re=1
|
||||
call s:equivalence_test()
|
||||
endfunc
|
||||
|
||||
func Test_equivalence_re2()
|
||||
set re=2
|
||||
call s:equivalence_test()
|
||||
endfunc
|
||||
@@ -0,0 +1,35 @@
|
||||
" Tests for regexp in utf8 encoding
|
||||
if !has('multi_byte')
|
||||
finish
|
||||
endif
|
||||
set encoding=utf-8
|
||||
scriptencoding utf-8
|
||||
|
||||
func s:equivalence_test()
|
||||
let str = "AÀÁÂÃÄÅĀĂĄǍǞǠẢ BḂḆ CÇĆĈĊČ DĎĐḊḎḐ EÈÉÊËĒĔĖĘĚẺẼ FḞ GĜĞĠĢǤǦǴḠ HĤĦḢḦḨ IÌÍÎÏĨĪĬĮİǏỈ JĴ KĶǨḰḴ LĹĻĽĿŁḺ MḾṀ NÑŃŅŇṄṈ OÒÓÔÕÖØŌŎŐƠǑǪǬỎ PṔṖ Q RŔŖŘṘṞ SŚŜŞŠṠ TŢŤŦṪṮ UÙÚÛÜŨŪŬŮŰŲƯǓỦ VṼ WŴẀẂẄẆ XẊẌ YÝŶŸẎỲỶỸ ZŹŻŽƵẐẔ aàáâãäåāăąǎǟǡả bḃḇ cçćĉċč dďđḋḏḑ eèéêëēĕėęěẻẽ fḟ gĝğġģǥǧǵḡ hĥħḣḧḩẖ iìíîïĩīĭįǐỉ jĵǰ kķǩḱḵ lĺļľŀłḻ mḿṁ nñńņňʼnṅṉ oòóôõöøōŏőơǒǫǭỏ pṕṗ q rŕŗřṙṟ sśŝşšṡ tţťŧṫṯẗ uùúûüũūŭůűųưǔủ vṽ wŵẁẃẅẇẘ xẋẍ yýÿŷẏẙỳỷỹ zźżžƶẑẕ"
|
||||
let groups = split(str)
|
||||
for group1 in groups
|
||||
for c in split(group1, '\zs')
|
||||
" next statement confirms that equivalence class matches every
|
||||
" character in group
|
||||
call assert_match('^[[=' . c . '=]]*$', group1)
|
||||
for group2 in groups
|
||||
if group2 != group1
|
||||
" next statement converts that equivalence class doesn't match
|
||||
" character in any other group
|
||||
call assert_equal(-1, match(group2, '[[=' . c . '=]]'))
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
endfor
|
||||
endfunc
|
||||
|
||||
func Test_equivalence_re1()
|
||||
set re=1
|
||||
call s:equivalence_test()
|
||||
endfunc
|
||||
|
||||
func Test_equivalence_re2()
|
||||
set re=2
|
||||
call s:equivalence_test()
|
||||
endfunc
|
||||
@@ -30,3 +30,16 @@ func Test_repeat_many()
|
||||
call assert_true(s:val > 1)
|
||||
call assert_true(s:val < 5)
|
||||
endfunc
|
||||
|
||||
func Test_with_partial_callback()
|
||||
let s:val = 0
|
||||
let s:meow = {}
|
||||
function s:meow.bite(...)
|
||||
let s:val += 1
|
||||
endfunction
|
||||
|
||||
call timer_start(50, s:meow.bite)
|
||||
sleep 200m
|
||||
call assert_equal(1, s:val)
|
||||
endfunc
|
||||
" vim: ts=2 sw=0 et
|
||||
|
||||
@@ -36,7 +36,7 @@ func Test_global_vars()
|
||||
" store a really long list, so line wrapping will occur in viminfo file
|
||||
let test_list = range(1,100)
|
||||
let g:MY_GLOBAL_LIST = test_list
|
||||
set viminfo='100,<50,s10,h,!
|
||||
set viminfo='100,<50,s10,h,!,nviminfo
|
||||
wv! Xviminfo
|
||||
unlet g:MY_GLOBAL_DICT
|
||||
unlet g:MY_GLOBAL_LIST
|
||||
|
||||
+104
@@ -763,6 +763,110 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1707,
|
||||
/**/
|
||||
1706,
|
||||
/**/
|
||||
1705,
|
||||
/**/
|
||||
1704,
|
||||
/**/
|
||||
1703,
|
||||
/**/
|
||||
1702,
|
||||
/**/
|
||||
1701,
|
||||
/**/
|
||||
1700,
|
||||
/**/
|
||||
1699,
|
||||
/**/
|
||||
1698,
|
||||
/**/
|
||||
1697,
|
||||
/**/
|
||||
1696,
|
||||
/**/
|
||||
1695,
|
||||
/**/
|
||||
1694,
|
||||
/**/
|
||||
1693,
|
||||
/**/
|
||||
1692,
|
||||
/**/
|
||||
1691,
|
||||
/**/
|
||||
1690,
|
||||
/**/
|
||||
1689,
|
||||
/**/
|
||||
1688,
|
||||
/**/
|
||||
1687,
|
||||
/**/
|
||||
1686,
|
||||
/**/
|
||||
1685,
|
||||
/**/
|
||||
1684,
|
||||
/**/
|
||||
1683,
|
||||
/**/
|
||||
1682,
|
||||
/**/
|
||||
1681,
|
||||
/**/
|
||||
1680,
|
||||
/**/
|
||||
1679,
|
||||
/**/
|
||||
1678,
|
||||
/**/
|
||||
1677,
|
||||
/**/
|
||||
1676,
|
||||
/**/
|
||||
1675,
|
||||
/**/
|
||||
1674,
|
||||
/**/
|
||||
1673,
|
||||
/**/
|
||||
1672,
|
||||
/**/
|
||||
1671,
|
||||
/**/
|
||||
1670,
|
||||
/**/
|
||||
1669,
|
||||
/**/
|
||||
1668,
|
||||
/**/
|
||||
1667,
|
||||
/**/
|
||||
1666,
|
||||
/**/
|
||||
1665,
|
||||
/**/
|
||||
1664,
|
||||
/**/
|
||||
1663,
|
||||
/**/
|
||||
1662,
|
||||
/**/
|
||||
1661,
|
||||
/**/
|
||||
1660,
|
||||
/**/
|
||||
1659,
|
||||
/**/
|
||||
1658,
|
||||
/**/
|
||||
1657,
|
||||
/**/
|
||||
1656,
|
||||
/**/
|
||||
1655,
|
||||
/**/
|
||||
|
||||
@@ -494,13 +494,11 @@ typedef unsigned long u8char_T; /* long should be 32 bits or more */
|
||||
#ifndef HAVE_SELECT
|
||||
# ifdef HAVE_SYS_POLL_H
|
||||
# include <sys/poll.h>
|
||||
# define HAVE_POLL
|
||||
# elif defined(WIN32)
|
||||
# define HAVE_SELECT
|
||||
# else
|
||||
# ifdef HAVE_POLL_H
|
||||
# include <poll.h>
|
||||
# define HAVE_POLL
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
@@ -1872,7 +1870,8 @@ typedef int sock_T;
|
||||
#define VV_TRUE 64
|
||||
#define VV_NULL 65
|
||||
#define VV_NONE 66
|
||||
#define VV_LEN 67 /* number of v: vars */
|
||||
#define VV_VIM_DID_ENTER 67
|
||||
#define VV_LEN 68 /* number of v: vars */
|
||||
|
||||
/* used for v_number in VAR_SPECIAL */
|
||||
#define VVAL_FALSE 0L
|
||||
|
||||
+12
-5
@@ -340,7 +340,7 @@ newwindow:
|
||||
/* cursor to last accessed (previous) window */
|
||||
case 'p':
|
||||
case Ctrl_P:
|
||||
if (prevwin == NULL)
|
||||
if (!win_valid(prevwin))
|
||||
beep_flush();
|
||||
else
|
||||
win_goto(prevwin);
|
||||
@@ -4582,8 +4582,15 @@ win_free(
|
||||
unref_var_dict(wp->w_vars);
|
||||
#endif
|
||||
|
||||
if (prevwin == wp)
|
||||
prevwin = NULL;
|
||||
{
|
||||
tabpage_T *ttp;
|
||||
|
||||
if (prevwin == wp)
|
||||
prevwin = NULL;
|
||||
for (ttp = first_tabpage; ttp != NULL; ttp = ttp->tp_next)
|
||||
if (ttp->tp_prevwin == wp)
|
||||
ttp->tp_prevwin = NULL;
|
||||
}
|
||||
win_free_lsize(wp);
|
||||
|
||||
for (i = 0; i < wp->w_tagstacklen; ++i)
|
||||
@@ -6756,11 +6763,11 @@ match_add(
|
||||
m->match.regprog = regprog;
|
||||
m->match.rmm_ic = FALSE;
|
||||
m->match.rmm_maxcol = 0;
|
||||
#ifdef FEAT_CONCEAL
|
||||
# if defined(FEAT_CONCEAL) && defined(FEAT_MBYTE)
|
||||
m->conceal_char = 0;
|
||||
if (conceal_char != NULL)
|
||||
m->conceal_char = (*mb_ptr2char)(conceal_char);
|
||||
#endif
|
||||
# endif
|
||||
|
||||
/* Set up position matches */
|
||||
if (pos_list != NULL)
|
||||
|
||||
Reference in New Issue
Block a user