mirror of
https://github.com/zoriya/vim.git
synced 2025-12-26 09:05:28 +00:00
Compare commits
193 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea6553bec3 | ||
|
|
4f3f668c84 | ||
|
|
c4dcd60c76 | ||
|
|
fa8b2e173d | ||
|
|
819821c5a9 | ||
|
|
e1581307d2 | ||
|
|
1473551a44 | ||
|
|
8fdd721047 | ||
|
|
92e35efaf6 | ||
|
|
1e7885abe8 | ||
|
|
52c6eaffd4 | ||
|
|
da64ab322a | ||
|
|
610cc1b9b3 | ||
|
|
780d4c3fff | ||
|
|
f68f1d7079 | ||
|
|
aedfcbe1e6 | ||
|
|
bee6c0cf86 | ||
|
|
8b20179c65 | ||
|
|
4c90861e9f | ||
|
|
c5fbe8af4c | ||
|
|
24c77a1e3a | ||
|
|
d4caf5c16a | ||
|
|
6a08454b93 | ||
|
|
5ca84ce4aa | ||
|
|
ffec3c5349 | ||
|
|
5f436fcf99 | ||
|
|
e4eb6ff089 | ||
|
|
6c0e984f26 | ||
|
|
6135d0d803 | ||
|
|
6a06363861 | ||
|
|
8e08125d3a | ||
|
|
b763eba7ae | ||
|
|
6098957458 | ||
|
|
573e445664 | ||
|
|
d63aff0a65 | ||
|
|
b86f10ee10 | ||
|
|
3f3fbd3fdb | ||
|
|
75f7265dd4 | ||
|
|
580984e026 | ||
|
|
e18c0b3981 | ||
|
|
be6aa46c4d | ||
|
|
03602ec28e | ||
|
|
e9d6a298df | ||
|
|
17b56c9f83 | ||
|
|
a63cdb5ed6 | ||
|
|
4077b33a83 | ||
|
|
364fa5c7ec | ||
|
|
a4f6ca717b | ||
|
|
ba61ac0d61 | ||
|
|
ac74d5e86c | ||
|
|
829c8e3696 | ||
|
|
7eba3d2cbf | ||
|
|
064154c3fe | ||
|
|
d293b2b9d4 | ||
|
|
44a2f923c0 | ||
|
|
cc6cf9b9f9 | ||
|
|
4d581a826c | ||
|
|
5c29154b52 | ||
|
|
f0e86a0dbd | ||
|
|
953cc7fb13 | ||
|
|
3905e291fe | ||
|
|
3848e00e01 | ||
|
|
bfb96c047b | ||
|
|
cff572abb9 | ||
|
|
818c9e7edf | ||
|
|
062cc1857d | ||
|
|
8a82c7fa5e | ||
|
|
6d8d849f5a | ||
|
|
9f6154f26e | ||
|
|
ba8cd122ef | ||
|
|
c0a1d7f3ad | ||
|
|
943bb2b8eb | ||
|
|
a889cf4642 | ||
|
|
0899d69803 | ||
|
|
5584df65a0 | ||
|
|
3f242a844e | ||
|
|
9e63f61cb0 | ||
|
|
1ff2b64b11 | ||
|
|
1c8b4edb9b | ||
|
|
8a1bb04637 | ||
|
|
d22a18928e | ||
|
|
0e0b3dd335 | ||
|
|
597385ab43 | ||
|
|
6f2e4b36c9 | ||
|
|
65639032bb | ||
|
|
7a5c46a9df | ||
|
|
a3dc5e92dc | ||
|
|
975b5271ee | ||
|
|
ab1fa3955f | ||
|
|
927030af23 | ||
|
|
89e375a88f | ||
|
|
8067a64852 | ||
|
|
d22e9465f6 | ||
|
|
ce2ec0a82a | ||
|
|
85a7cb4dcf | ||
|
|
8e15ffcde7 | ||
|
|
426dd02195 | ||
|
|
e27dba499a | ||
|
|
00f9e0dbbd | ||
|
|
1abb502635 | ||
|
|
4f118be2bb | ||
|
|
f155196444 | ||
|
|
346418c624 | ||
|
|
790500a8e6 | ||
|
|
9eb3bb2930 | ||
|
|
39afdea203 | ||
|
|
d6c2f05260 | ||
|
|
1735bc988c | ||
|
|
9cdf86b86f | ||
|
|
86edef664e | ||
|
|
a3442cb505 | ||
|
|
fff341eb59 | ||
|
|
52f9c19015 | ||
|
|
8dcf259d90 | ||
|
|
7f8989dd8a | ||
|
|
6bef5306e4 | ||
|
|
2d8f56acb3 | ||
|
|
c835293d54 | ||
|
|
5a2800fd14 | ||
|
|
385111bd86 | ||
|
|
f6f32c38bf | ||
|
|
b4ebf9ae3b | ||
|
|
583c1f14a4 | ||
|
|
5a6ec52392 | ||
|
|
1adda3403d | ||
|
|
8950a563b3 | ||
|
|
ac42afd10b | ||
|
|
8e2c942ce4 | ||
|
|
77cdfd1038 | ||
|
|
4fc563b397 | ||
|
|
509ce2a558 | ||
|
|
de27989157 | ||
|
|
9e496854a9 | ||
|
|
846cdb2275 | ||
|
|
74c5bbf134 | ||
|
|
7bffaa9f9b | ||
|
|
40e8cb292c | ||
|
|
75578a388d | ||
|
|
29fd03878c | ||
|
|
af1a0e371e | ||
|
|
562ca71428 | ||
|
|
d5d3d307dd | ||
|
|
beb003b303 | ||
|
|
045a284a83 | ||
|
|
0622732b32 | ||
|
|
6ff02c9651 | ||
|
|
8322e1f06e | ||
|
|
d9d473ea12 | ||
|
|
13d6fb17a2 | ||
|
|
f65333c9b5 | ||
|
|
367aabdbf7 | ||
|
|
8049253b96 | ||
|
|
9fe885e49a | ||
|
|
e98d121052 | ||
|
|
41e0f2f48f | ||
|
|
94d0191dbc | ||
|
|
af6e36ff16 | ||
|
|
5f148ec0b5 | ||
|
|
304563c0b3 | ||
|
|
151f656e17 | ||
|
|
47cff3a444 | ||
|
|
4e329fcaf7 | ||
|
|
b69fccf377 | ||
|
|
d0b6502a7a | ||
|
|
3f39f64866 | ||
|
|
839fd11d7e | ||
|
|
99ef06296f | ||
|
|
38fd4bb284 | ||
|
|
9ef00be261 | ||
|
|
be82c25486 | ||
|
|
2588b5a43f | ||
|
|
0ecbe33718 | ||
|
|
a96909cfaf | ||
|
|
802d559431 | ||
|
|
119d4693e0 | ||
|
|
5983ad0b03 | ||
|
|
35ca0e7a1c | ||
|
|
019b9c644e | ||
|
|
20b4f463f4 | ||
|
|
2369c15407 | ||
|
|
0c171716c0 | ||
|
|
179f1b9a7d | ||
|
|
328da0dcb7 | ||
|
|
6300317b15 | ||
|
|
f365482736 | ||
|
|
014069a7ac | ||
|
|
c25558bff4 | ||
|
|
d6547fc647 | ||
|
|
da94fdf258 | ||
|
|
9f7820f83b | ||
|
|
91715873d1 | ||
|
|
863c1a9079 | ||
|
|
1bdd42627d |
34
Filelist
34
Filelist
@@ -495,7 +495,6 @@ RT_ALL = \
|
||||
runtime/macros/life/click.me \
|
||||
runtime/macros/life/life.vim \
|
||||
runtime/macros/matchit.vim \
|
||||
runtime/macros/matchit.txt \
|
||||
runtime/macros/maze/README.txt \
|
||||
runtime/macros/maze/[mM]akefile \
|
||||
runtime/macros/maze/main.aap \
|
||||
@@ -525,6 +524,9 @@ RT_ALL = \
|
||||
runtime/tutor/tutor \
|
||||
runtime/tutor/tutor.vim \
|
||||
runtime/vimrc_example.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 files for all distributions without CR-NL translation
|
||||
RT_ALL_BIN = \
|
||||
@@ -605,7 +607,6 @@ RT_AMI = \
|
||||
README.txt.info \
|
||||
README_ami.txt \
|
||||
README_ami.txt.info \
|
||||
libs/arp.library \
|
||||
runtime/doc.info \
|
||||
runtime/doc/*.info \
|
||||
runtime/icons/README.txt \
|
||||
@@ -693,6 +694,35 @@ EXTRA = \
|
||||
src/tee/Make_mvc.mak \
|
||||
src/tee/tee.c \
|
||||
|
||||
# files in READMEdir that are included from the top dir
|
||||
IN_README_DIR = \
|
||||
README.txt.info \
|
||||
README_ami.txt \
|
||||
README_ami.txt.info \
|
||||
README_amibin.txt \
|
||||
README_amibin.txt.info \
|
||||
README_amisrc.txt \
|
||||
README_amisrc.txt.info \
|
||||
README_bindos.txt \
|
||||
README_dos.txt \
|
||||
README_extra.txt \
|
||||
README_mac.txt \
|
||||
README_ole.txt \
|
||||
README_os2.txt \
|
||||
README_os390.txt \
|
||||
README_src.txt \
|
||||
README_srcdos.txt \
|
||||
README_unix.txt \
|
||||
README_vms.txt \
|
||||
README_w32s.txt \
|
||||
Contents \
|
||||
Contents.info \
|
||||
Vim.info \
|
||||
Xxd.info \
|
||||
runtime.info \
|
||||
src.info \
|
||||
vimdir.info \
|
||||
|
||||
# generic language files
|
||||
LANG_GEN = \
|
||||
runtime/doc/*-de.1 \
|
||||
|
||||
40
Makefile
40
Makefile
@@ -213,24 +213,13 @@ MINOR = 4
|
||||
# > bigvim64.bat
|
||||
#
|
||||
#
|
||||
# OBSOLETE systems: You can build this if you have an appropriate system.
|
||||
# OBSOLETE systems: You can build these if you have an appropriate system.
|
||||
#
|
||||
# 16 bit DOS version: (doesn't build anywhere)
|
||||
# - Set environment for compiling with Borland C++ 3.1.
|
||||
# - "bmake -f Make_bc3.mak BOR=E:\borlandc" (compiling xxd might fail, in that
|
||||
# case set environment for compiling with Borland C++ 4.0 and do
|
||||
# "make -f make_bc3.mak BOR=E:\BC4 xxd/xxd.exe").
|
||||
# NOTE: this currently fails because Vim is too big.
|
||||
# - "make test" and check the output.
|
||||
# - Rename the executables to "vimd16.exe", "xxdd16.exe", "installd16.exe" and
|
||||
# "uninstald16.exe".
|
||||
# 16 bit DOS version: You need to get a very old version of Vim, for several
|
||||
# years even the tiny build is too big to fit in DOS memory.
|
||||
#
|
||||
# 32 bit DOS version: (requires Windows XP or earlier)
|
||||
# - Set environment for compiling with DJGPP; "gmake -f Make_djg.mak".
|
||||
# - "rm testdir/*.out", "gmake -f Make_djg.mak test" and check the output for
|
||||
# "ALL DONE".
|
||||
# - Rename the executables to "vimd32.exe", "xxdd32.exe", "installd32.exe" and
|
||||
# "uninstald32.exe".
|
||||
# 32 bit DOS version: Support was removed in 7.4.1399. When syncing to before
|
||||
# that it probably won't build.
|
||||
#
|
||||
# Win32s GUI version: (requires a very old compiler)
|
||||
# - Set environment for Visual C++ 4.1 (requires a new console window):
|
||||
@@ -242,12 +231,9 @@ MINOR = 4
|
||||
# - Rename "uninstal.exe" to "uninstalw32.exe"
|
||||
# - The produced uninstalw32.exe and vimrun.exe are used.
|
||||
#
|
||||
# OS/2: (requires an OS/2 system)
|
||||
# - Unpack the Unix archive.
|
||||
# - "make -f Make_os2.mak".
|
||||
# - Rename the executables to vimos2.exe, xxdos2.exe and teeos2.exe and copy
|
||||
# them to here.
|
||||
# - "make os2bin".
|
||||
# OS/2 support was removed in patch 7.4.1008. If you want to give it a try
|
||||
# sync to before that and check the old version of this Makefile for
|
||||
# instructions.
|
||||
|
||||
VIMVER = vim-$(MAJOR).$(MINOR)
|
||||
VERSION = $(MAJOR)$(MINOR)
|
||||
@@ -269,9 +255,13 @@ dist:
|
||||
mkdir dist
|
||||
|
||||
# Clean up some files to avoid they are included.
|
||||
# Copy README files to the top directory.
|
||||
prepare:
|
||||
if test -f runtime/doc/uganda.nsis.txt; then \
|
||||
rm runtime/doc/uganda.nsis.txt; fi
|
||||
for name in $(IN_README_DIR); do \
|
||||
cp READMEdir/"$$name" .; \
|
||||
done
|
||||
|
||||
# For the zip files we need to create a file with the comment line
|
||||
dist/comment:
|
||||
@@ -336,6 +326,7 @@ unixall: dist prepare
|
||||
$(EXTRA) \
|
||||
$(LANG_SRC) \
|
||||
| (cd dist/$(VIMRTDIR); tar xf -)
|
||||
-rm $(IN_README_DIR)
|
||||
# Need to use a "distclean" config.mk file
|
||||
# Note: this file is not included in the repository to avoid problems, but it's
|
||||
# OK to put it in the archive.
|
||||
@@ -372,6 +363,7 @@ amirt: dist prepare
|
||||
$(RT_NO_UNIX) \
|
||||
$(RT_AMI_DOS) \
|
||||
| (cd dist/Vim/$(VIMRTDIR); tar xf -)
|
||||
-rm $(IN_README_DIR)
|
||||
mv dist/Vim/$(VIMRTDIR)/vimdir.info dist/Vim.info
|
||||
mv dist/Vim/$(VIMRTDIR)/runtime.info dist/Vim/$(VIMRTDIR).info
|
||||
mv dist/Vim/$(VIMRTDIR)/runtime/* dist/Vim/$(VIMRTDIR)
|
||||
@@ -392,6 +384,7 @@ amibin: dist prepare
|
||||
Vim \
|
||||
Xxd \
|
||||
| (cd dist/Vim/$(VIMRTDIR); tar xf -)
|
||||
-rm $(IN_README_DIR)
|
||||
mv dist/Vim/$(VIMRTDIR)/vimdir.info dist/Vim.info
|
||||
mv dist/Vim/$(VIMRTDIR)/runtime.info dist/Vim/$(VIMRTDIR).info
|
||||
cd dist && tar cf vim$(VERSION)bin.tar Vim Vim.info
|
||||
@@ -410,6 +403,7 @@ amisrc: dist prepare
|
||||
$(SRC_AMI) \
|
||||
$(SRC_AMI_DOS) \
|
||||
| (cd dist/Vim/$(VIMRTDIR); tar xf -)
|
||||
-rm $(IN_README_DIR)
|
||||
mv dist/Vim/$(VIMRTDIR)/vimdir.info dist/Vim.info
|
||||
mv dist/Vim/$(VIMRTDIR)/runtime.info dist/Vim/$(VIMRTDIR).info
|
||||
cd dist && tar cf vim$(VERSION)src.tar Vim Vim.info
|
||||
@@ -483,6 +477,7 @@ dosrt_files: dist prepare no_title.vim
|
||||
$(RT_DOS_BIN) \
|
||||
$(LANG_GEN_BIN) \
|
||||
| (cd dist/vim/$(VIMRTDIR); tar xf -)
|
||||
-rm $(IN_README_DIR)
|
||||
mv dist/vim/$(VIMRTDIR)/runtime/* dist/vim/$(VIMRTDIR)
|
||||
rmdir dist/vim/$(VIMRTDIR)/runtime
|
||||
# Add the message translations. Trick: skip ja.mo and use ja.sjis.mo instead.
|
||||
@@ -517,6 +512,7 @@ dosbin_gvim: dist no_title.vim dist/$(COMMENT_GVIM)
|
||||
tar cf - \
|
||||
$(BIN_DOS) \
|
||||
| (cd dist/vim/$(VIMRTDIR); tar xf -)
|
||||
-rm $(IN_README_DIR)
|
||||
cp gvim.exe dist/vim/$(VIMRTDIR)/gvim.exe
|
||||
cp xxdw32.exe dist/vim/$(VIMRTDIR)/xxd.exe
|
||||
cp vimrun.exe dist/vim/$(VIMRTDIR)/vimrun.exe
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
[](https://travis-ci.org/vim/vim)
|
||||
[](https://coveralls.io/github/vim/vim?branch=master)
|
||||
[](https://ci.appveyor.com/project/chrisbra/vim)
|
||||
[](https://scan.coverity.com/projects/vim)
|
||||
|
||||
|
||||
## What is Vim? ##
|
||||
|
||||
@@ -9,7 +9,7 @@ Vim Vi IMproved. A clone of the UNIX text editor Vi. Very useful
|
||||
messages, shows current file name in window title, on-line
|
||||
help, rectangular cut/paste, etc., etc., etc...
|
||||
|
||||
Version 7.4. Also runs under UNIX, MSDOS and other systems.
|
||||
Version 7.4. Also runs under UNIX, MS-Windows, Mac, etc.
|
||||
vim74rt.tgz contains the documentation and syntax files.
|
||||
vim74bin.tgz contains the binaries.
|
||||
vim74src.tgz contains the sources.
|
||||
@@ -19,5 +19,5 @@ Vim Vi IMproved. A clone of the UNIX text editor Vi. Very useful
|
||||
Xxd Hex dumper and reader. Can be used to view files as hex, edit
|
||||
them and write them back. Can also be used to patch files.
|
||||
|
||||
Version 1.8 (1997 May 22)
|
||||
Version 1.10 (1997 May 22)
|
||||
Author: Juergen Weigert
|
||||
0
Contents.info → READMEdir/Contents.info
Executable file → Normal file
0
Contents.info → READMEdir/Contents.info
Executable file → Normal file
0
README.txt.info → READMEdir/README.txt.info
Executable file → Normal file
0
README.txt.info → READMEdir/README.txt.info
Executable file → Normal file
0
README_ami.txt.info → READMEdir/README_ami.txt.info
Executable file → Normal file
0
README_ami.txt.info → READMEdir/README_ami.txt.info
Executable file → Normal file
0
README_amibin.txt.info → READMEdir/README_amibin.txt.info
Executable file → Normal file
0
README_amibin.txt.info → READMEdir/README_amibin.txt.info
Executable file → Normal file
0
README_amisrc.txt.info → READMEdir/README_amisrc.txt.info
Executable file → Normal file
0
README_amisrc.txt.info → READMEdir/README_amisrc.txt.info
Executable file → Normal file
0
Vim.info → READMEdir/Vim.info
Executable file → Normal file
0
Vim.info → READMEdir/Vim.info
Executable file → Normal file
0
Xxd.info → READMEdir/Xxd.info
Executable file → Normal file
0
Xxd.info → READMEdir/Xxd.info
Executable file → Normal file
0
runtime.info → READMEdir/runtime.info
Executable file → Normal file
0
runtime.info → READMEdir/runtime.info
Executable file → Normal file
0
src.info → READMEdir/src.info
Executable file → Normal file
0
src.info → READMEdir/src.info
Executable file → Normal file
0
vimdir.info → READMEdir/vimdir.info
Executable file → Normal file
0
vimdir.info → READMEdir/vimdir.info
Executable file → Normal file
BIN
libs/arp.library
BIN
libs/arp.library
Binary file not shown.
@@ -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.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*change.txt* For Vim version 7.4. Last change: 2016 Feb 10
|
||||
*change.txt* For Vim version 7.4. Last change: 2016 Mar 08
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -109,7 +109,9 @@ is an error when 'cpoptions' includes the 'E' flag.
|
||||
*J*
|
||||
J Join [count] lines, with a minimum of two lines.
|
||||
Remove the indent and insert up to two spaces (see
|
||||
below).
|
||||
below). Fails when on the last line of the buffer.
|
||||
If [count] is too big it is reduce to the number of
|
||||
lines available.
|
||||
|
||||
*v_J*
|
||||
{Visual}J Join the highlighted lines, with a minimum of two
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*channel.txt* For Vim version 7.4. Last change: 2016 Feb 27
|
||||
*channel.txt* For Vim version 7.4. Last change: 2016 Mar 26
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -44,8 +44,8 @@ There are four main types of jobs:
|
||||
4. Running a filter, synchronously.
|
||||
Uses pipes.
|
||||
|
||||
For when using sockets See |job-start|, |job-may-start| and |channel-open|.
|
||||
For 2 and 3, one or more jobs using pipes, see |job-start|.
|
||||
For when using sockets See |job-start|, |job-start-nochannel| and
|
||||
|channel-open|. For 2 and 3, one or more jobs using pipes, see |job-start|.
|
||||
For 4 use the ":{range}!cmd" command, see |filter|.
|
||||
|
||||
Over the socket and pipes these protocols are available:
|
||||
@@ -103,6 +103,11 @@ when opening the channel: >
|
||||
let channel = ch_open('localhost:8765', {'callback': "MyHandler"})
|
||||
call ch_sendexpr(channel, 'hello!')
|
||||
|
||||
When trying out channels it's useful to see what is going on. You can tell
|
||||
Vim to write lines in log file: >
|
||||
call ch_logfile('channellog', 'w')
|
||||
See |ch_logfile()|.
|
||||
|
||||
==============================================================================
|
||||
3. Opening a channel *channel-open*
|
||||
|
||||
@@ -115,24 +120,14 @@ 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" 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 NL mode is always used.
|
||||
|
||||
*channel-callback*
|
||||
*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
|
||||
and the received message. Example: >
|
||||
@@ -147,17 +142,12 @@ Use |ch_status()| to see if the channel could be opened.
|
||||
excluding the NL.
|
||||
When "mode" is "raw" the "msg" argument is the whole message
|
||||
as a string.
|
||||
*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.
|
||||
|
||||
TODO: *close-cb*
|
||||
"close-cb" A function that is called when the channel gets closed, other
|
||||
For all callbacks: Use |function()| to bind it to arguments
|
||||
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: >
|
||||
func MyCloseHandler(channel)
|
||||
< *waittime*
|
||||
@@ -169,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.
|
||||
@@ -191,6 +175,10 @@ For example, the handler can be added or changed: >
|
||||
call ch_setoptions(channel, {'callback': callback})
|
||||
When "callback" is empty (zero or an empty string) the handler is removed.
|
||||
|
||||
After a callback has been invoked Vim will update the screen and put the
|
||||
cursor back where it belongs. Thus the callback should not need to do
|
||||
`:redraw`.
|
||||
|
||||
The timeout can be changed: >
|
||||
call ch_setoptions(channel, {'timeout': msec})
|
||||
<
|
||||
@@ -202,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.
|
||||
@@ -259,9 +254,9 @@ message, it must use the number zero:
|
||||
Then channel handler will then get {response} converted to Vim types. If the
|
||||
channel does not have a handler the message is dropped.
|
||||
|
||||
On read error or ch_close(), when using a socket, the string "DETACH" is sent,
|
||||
if still possible. The channel will then be inactive. For a JSON and JS mode
|
||||
channel quotes are used around DETACH, otherwise there are no quotes.
|
||||
On read error or ch_close(), when using a socket with RAW or NL mode, the
|
||||
string "DETACH\n" is sent, if still possible. The channel will then be
|
||||
inactive.
|
||||
|
||||
It is also possible to use ch_sendraw() and ch_evalraw() on a JSON or JS
|
||||
channel. The caller is then completely responsible for correct encoding and
|
||||
@@ -313,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" ~
|
||||
|
||||
@@ -400,7 +398,6 @@ are:
|
||||
"open" The channel can be used.
|
||||
"closed" The channel was closed.
|
||||
|
||||
TODO:
|
||||
To obtain the job associated with a channel: ch_getjob(channel)
|
||||
|
||||
To read one message from a channel: >
|
||||
@@ -416,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*
|
||||
|
||||
@@ -431,7 +445,7 @@ been received and not parsed correctly.
|
||||
|
||||
If the command produces a line of output that you want to deal with, specify
|
||||
a handler for stdout: >
|
||||
let job = job_start(command, {"out-cb": "MyHandler"})
|
||||
let job = job_start(command, {"out_cb": "MyHandler"})
|
||||
The function will be called with the channel and a message. You would define
|
||||
it like this: >
|
||||
func MyHandler(channel, msg)
|
||||
@@ -439,10 +453,10 @@ it like this: >
|
||||
Without the handler you need to read the output with |ch_read()| or
|
||||
|ch_readraw()|.
|
||||
|
||||
The handler defined for "out-cb" will not receive stderr. If you want to
|
||||
handle that separately, add an "err-cb" handler: >
|
||||
let job = job_start(command, {"out-cb": "MyHandler",
|
||||
\ "err-cb": "ErrHandler"})
|
||||
The handler defined for "out_cb" will not receive stderr. If you want to
|
||||
handle that separately, add an "err_cb" handler: >
|
||||
let job = job_start(command, {"out_cb": "MyHandler",
|
||||
\ "err_cb": "ErrHandler"})
|
||||
|
||||
If you want to handle both stderr and stdout with one handler use the
|
||||
"callback" option: >
|
||||
@@ -454,48 +468,54 @@ JSON or JS mode you can use ch_evalexpr().
|
||||
There are several options you can use, see |job-options|.
|
||||
For example, to start a job and write its output in buffer "dummy": >
|
||||
let logjob = job_start("tail -f /tmp/log",
|
||||
\ {'out-io': 'buffer', 'out-name': 'dummy'})
|
||||
\ {'out_io': 'buffer', 'out_name': 'dummy'})
|
||||
sbuf dummy
|
||||
|
||||
TODO:
|
||||
To run a job and read its output once it is done: >
|
||||
let job = job_start({command}, {'exit-cb': 'MyHandler'})
|
||||
func MyHandler(job, status)
|
||||
let channel = job_getchannel()
|
||||
let output = ch_readall(channel)
|
||||
" parse output
|
||||
endfunc
|
||||
|
||||
Job input from a buffer ~
|
||||
|
||||
To run a job that reads from a buffer: >
|
||||
let job = job_start({command},
|
||||
\ {'in_io': 'buffer', 'in_name': 'mybuffer'})
|
||||
<
|
||||
*E915* *E918*
|
||||
The buffer is found by name, similar to |bufnr()|. The buffer must exist and
|
||||
be loaded when job_start() is called.
|
||||
|
||||
By default this reads the whole buffer. This can be changed with the "in_top"
|
||||
and "in_bot" options.
|
||||
|
||||
A special mode is when "in_top" is set to zero and "in_bot" is not set: Every
|
||||
time a line is added to the buffer, the last-but-one line will be send to the
|
||||
job stdin. This allows for editing the last line and sending it when pressing
|
||||
Enter.
|
||||
|
||||
==============================================================================
|
||||
9. Starting a job without a channel *job-start-nochannel*
|
||||
|
||||
To start another process without creating a channel: >
|
||||
let job = job_start(command, {"in-io": "null", "out-io": "null"})
|
||||
let job = job_start(command,
|
||||
\ {"in_io": "null", "out_io": "null", "err_io": "null"})
|
||||
|
||||
This starts {command} in the background, Vim does not wait for it to finish.
|
||||
|
||||
TODO:
|
||||
When Vim sees that neither stdin, stdout or stderr are connected, no channel
|
||||
will be created. Often you will want to include redirection in the command to
|
||||
avoid it getting stuck.
|
||||
|
||||
There are several options you can use, see |job-options|.
|
||||
|
||||
TODO: *job-may-start*
|
||||
To start a job only when connecting to an address does not work use
|
||||
job_maystart('command', {address}, {options}), For Example: >
|
||||
let job = job_maystart(command, address, {"waittime": 1000})
|
||||
let channel = job_gethandle(job)
|
||||
|
||||
This comes down to: >
|
||||
*job-start-if-needed*
|
||||
To start a job only when connecting to an address does not work, do something
|
||||
like this: >
|
||||
let channel = ch_open(address, {"waittime": 0})
|
||||
if ch_status(channel) == "fail"
|
||||
let job = job_start(command)
|
||||
let channel = ch_open(address, {"waittime": 1000})
|
||||
call job_sethandle(channel)
|
||||
endif
|
||||
Note that the specified waittime applies to when the job has been started.
|
||||
This gives the job some time to make the port available.
|
||||
|
||||
Note that the waittime for ch_open() gives the job one second to make the port
|
||||
available.
|
||||
|
||||
==============================================================================
|
||||
10. Job options *job-options*
|
||||
@@ -506,61 +526,109 @@ 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*
|
||||
"out-cb": handler Callback for when there is something to read on
|
||||
stdout.
|
||||
*job-err-cb*
|
||||
"err-cb": handler Callback for when there is something to read on
|
||||
stderr.
|
||||
*job-close-cb*
|
||||
"close-cb": handler Callback for when the channel is closed. Same as
|
||||
"close-cb" on ch_open().
|
||||
*job-exit-cb*
|
||||
"exit-cb": handler Callback for when the job ends. The arguments are the
|
||||
*job-out_cb* *out_cb*
|
||||
"out_cb": handler Callback for when there is something to read on
|
||||
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. 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().
|
||||
*job-exit_cb*
|
||||
"exit_cb": handler Callback for when the job ends. The arguments are the
|
||||
job and the exit status.
|
||||
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.
|
||||
"stoponexit": "" Do not stop the job when Vim exits.
|
||||
The default is "term".
|
||||
|
||||
TODO: *job-term*
|
||||
*job-term*
|
||||
"term": "open" Start a terminal and connect the job
|
||||
stdin/stdout/stderr to it.
|
||||
NOTE: Not implemented yet!
|
||||
|
||||
*job-in-io*
|
||||
"in-io": "null" disconnect stdin TODO
|
||||
"in-io": "pipe" stdin is connected to the channel (default)
|
||||
"in-io": "file" stdin reads from a file TODO
|
||||
"in-io": "buffer" stdin reads from a buffer TODO
|
||||
"in-name": "/path/file" the name of he file or buffer to read from
|
||||
"in-buf": number the number of the buffer to read from TODO
|
||||
"channel": {channel} Use an existing channel instead of creating a new one.
|
||||
The parts of the channel that get used for the new job
|
||||
will be disconnected from what they were used before.
|
||||
If the channel was still use by another job this may
|
||||
cause I/O errors.
|
||||
Existing callbacks and other settings remain.
|
||||
|
||||
*job-out-io*
|
||||
"out-io": "null" disconnect stdout TODO
|
||||
"out-io": "pipe" stdout is connected to the channel (default)
|
||||
"out-io": "file" stdout writes to a file TODO
|
||||
"out-io": "buffer" stdout appends to a buffer
|
||||
"out-name": "/path/file" the name of the file or buffer to write to
|
||||
"out-buf": number the number of the buffer to write to TODO
|
||||
*job-in_io* *in_top* *in_bot* *in_name* *in_buf*
|
||||
"in_io": "null" disconnect stdin (read from /dev/null)
|
||||
"in_io": "pipe" stdin is connected to the channel (default)
|
||||
"in_io": "file" stdin reads from a file
|
||||
"in_io": "buffer" stdin reads from a buffer
|
||||
"in_top": number when using "buffer": first line to send (default: 1)
|
||||
"in_bot": number when using "buffer": last line to send (default: last)
|
||||
"in_name": "/path/file" the name of the file or buffer to read from
|
||||
"in_buf": number the number of the buffer to read from
|
||||
|
||||
*job-err-io*
|
||||
"err-io": "out" same as stdout TODO
|
||||
"err-io": "null" disconnect stderr TODO
|
||||
"err-io": "pipe" stderr is connected to the channel (default)
|
||||
"err-io": "file" stderr writes to a file TODO
|
||||
"err-io": "buffer" stderr appends to a buffer TODO
|
||||
"err-name": "/path/file" the name of the file or buffer to write to
|
||||
"err-buf": number the number of the buffer to write to TODO
|
||||
*job-out_io* *out_name* *out_buf*
|
||||
"out_io": "null" disconnect stdout (goes to /dev/null)
|
||||
"out_io": "pipe" stdout is connected to the channel (default)
|
||||
"out_io": "file" stdout writes to a file
|
||||
"out_io": "buffer" stdout appends to a buffer
|
||||
"out_name": "/path/file" the name of the file or buffer to write to
|
||||
"out_buf": number the number of the buffer to write to
|
||||
|
||||
When the IO mode is "buffer" and there is a callback, the text is appended to
|
||||
the buffer before invoking the callback.
|
||||
*job-err_io* *err_name* *err_buf*
|
||||
"err_io": "out" stderr messages to go to stdout
|
||||
"err_io": "null" disconnect stderr (goes to /dev/null)
|
||||
"err_io": "pipe" stderr is connected to the channel (default)
|
||||
"err_io": "file" stderr writes to a file
|
||||
"err_io": "buffer" stderr appends to a buffer
|
||||
"err_name": "/path/file" the name of the file or buffer to write to
|
||||
"err_buf": number the number of the buffer to write to
|
||||
|
||||
|
||||
Writing to a buffer ~
|
||||
|
||||
When the out_io or err_io mode is "buffer" and there is a callback, the text
|
||||
is appended to the buffer before invoking the callback.
|
||||
|
||||
When a buffer is used both for input and output, the output lines are put
|
||||
above the last line, since the last line is what is written to the channel
|
||||
input. Otherwise lines are appended below the last line.
|
||||
|
||||
When using JS or JSON mode with "buffer", only messages with zero or negative
|
||||
ID will be added to the buffer, after decoding + encoding. Messages with a
|
||||
positive number will be handled by a callback, commands are handled as usual.
|
||||
|
||||
The name of the buffer is compared the full name of existing buffers. If
|
||||
there is a match that buffer is used. Otherwise a new buffer is created.
|
||||
@@ -576,6 +644,14 @@ line and the window is scrolled up to show the cursor if needed.
|
||||
|
||||
Undo is synced for every added line.
|
||||
|
||||
|
||||
Writing to a file ~
|
||||
*E920*
|
||||
The file is created with permissions 600 (read-write for the user, not
|
||||
accessible for others). Use |setfperm()| to change this.
|
||||
|
||||
If the file already exists it is truncated.
|
||||
|
||||
==============================================================================
|
||||
11. Controlling a job *job-control*
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*eval.txt* For Vim version 7.4. Last change: 2016 Feb 27
|
||||
*eval.txt* For Vim version 7.4. Last change: 2016 Mar 27
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -113,16 +113,8 @@ to Float, printf() for Float to String and float2nr() for Float to Number.
|
||||
*E891* *E892* *E893* *E894* *E907* *E911* *E914*
|
||||
When expecting a Float a Number can also be used, but nothing else.
|
||||
|
||||
*E706* *sticky-type-checking*
|
||||
You will get an error if you try to change the type of a variable. You need
|
||||
to |:unlet| it first to avoid this error. String and Number are considered
|
||||
equivalent though, as well are Float and Number. Consider this sequence of
|
||||
commands: >
|
||||
:let l = "string"
|
||||
:let l = 44 " changes type from String to Number
|
||||
:let l = [1, 2, 3] " error! l is still a Number
|
||||
:let l = 4.4 " changes type from Number to Float
|
||||
:let l = "string" " error!
|
||||
*no-type-checking*
|
||||
You will not get an error if you try to change the type of a variable.
|
||||
|
||||
|
||||
1.2 Function references ~
|
||||
@@ -358,10 +350,6 @@ This works like: >
|
||||
: let index = index + 1
|
||||
:endwhile
|
||||
|
||||
Note that all items in the list should be of the same type, otherwise this
|
||||
results in error |E706|. To avoid this |:unlet| the variable at the end of
|
||||
the loop.
|
||||
|
||||
If all you want to do is modify each item in the list then the |map()|
|
||||
function will be a simpler method than a for loop.
|
||||
|
||||
@@ -765,20 +753,35 @@ recursively. Ignoring case means case is ignored when comparing item values.
|
||||
|
||||
*E693* *E694*
|
||||
A |Funcref| can only be compared with a |Funcref| and only "equal" and "not
|
||||
equal" can be used. Case is never ignored.
|
||||
equal" can be used. Case is never ignored. Whether arguments or a Dictionary
|
||||
are bound (with a partial) is ignored. This is so that when a function is
|
||||
made a member of a Dictionary it is still considered to be the same function.
|
||||
To compare partials to see if they bind the same argument and Dictionary
|
||||
values use string(): >
|
||||
echo string(Partial1) == string(Partial2)
|
||||
|
||||
When using "is" or "isnot" with a |List| or a |Dictionary| this checks if the
|
||||
expressions are referring to the same |List| or |Dictionary| instance. A copy
|
||||
of a |List| is different from the original |List|. When using "is" without
|
||||
a |List| or a |Dictionary| it is equivalent to using "equal", using "isnot"
|
||||
equivalent to using "not equal". Except that a different type means the
|
||||
values are different: "4 == '4'" is true, "4 is '4'" is false and "0 is []" is
|
||||
false and not an error. "is#"/"isnot#" and "is?"/"isnot?" can be used to match
|
||||
and ignore case.
|
||||
values are different: >
|
||||
echo 4 == '4'
|
||||
1
|
||||
echo 4 is '4'
|
||||
0
|
||||
echo 0 is []
|
||||
0
|
||||
"is#"/"isnot#" and "is?"/"isnot?" can be used to match and ignore case.
|
||||
|
||||
When comparing a String with a Number, the String is converted to a Number,
|
||||
and the comparison is done on Numbers. This means that "0 == 'x'" is TRUE,
|
||||
because 'x' converted to a Number is zero.
|
||||
and the comparison is done on Numbers. This means that: >
|
||||
echo 0 == 'x'
|
||||
1
|
||||
because 'x' converted to a Number is zero. However: >
|
||||
echo [0] == ['x']
|
||||
0
|
||||
Inside a List or Dictionary this conversion is not used.
|
||||
|
||||
When comparing two Strings, this is done with strcmp() or stricmp(). This
|
||||
results in the mathematical difference (comparing byte values), not
|
||||
@@ -1759,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.
|
||||
|
||||
@@ -1798,6 +1805,7 @@ assert_equal( {exp}, {act} [, {msg}]) none assert {exp} equals {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_true( {actual} [, {msg}]) none assert {actual} is true
|
||||
asin( {expr}) Float arc sine of {expr}
|
||||
atan( {expr}) Float arc tangent of {expr}
|
||||
@@ -1817,24 +1825,25 @@ byteidxcomp( {expr}, {nr}) Number byte index of {nr}'th char in {expr}
|
||||
call( {func}, {arglist} [, {dict}])
|
||||
any call {func} with arguments {arglist}
|
||||
ceil( {expr}) Float round {expr} up
|
||||
ch_close( {channel}) none close {channel}
|
||||
ch_evalexpr( {channel}, {expr} [, {options}])
|
||||
any evaluate {expr} on JSON {channel}
|
||||
ch_evalraw( {channel}, {string} [, {options}])
|
||||
any evaluate {string} on raw {channel}
|
||||
ch_getbufnr( {channel}, {what}) Number get buffer number for {channel}/{what}
|
||||
ch_close( {handle}) none close {handle}
|
||||
ch_evalexpr( {handle}, {expr} [, {options}])
|
||||
any evaluate {expr} on JSON {handle}
|
||||
ch_evalraw( {handle}, {string} [, {options}])
|
||||
any evaluate {string} on raw {handle}
|
||||
ch_getbufnr( {handle}, {what}) Number get buffer number for {handle}/{what}
|
||||
ch_getjob( {channel}) Job get the Job of {channel}
|
||||
ch_log( {msg} [, {channel}]) none write {msg} in the channel log file
|
||||
ch_info( {handle}) String info about channel {handle}
|
||||
ch_log( {msg} [, {handle}]) none write {msg} in the channel log file
|
||||
ch_logfile( {fname} [, {mode}]) none start logging channel activity
|
||||
ch_open( {address} [, {options}]) Channel open a channel to {address}
|
||||
ch_read( {channel} [, {options}]) String read from {channel}
|
||||
ch_readraw( {channel} [, {options}]) String read raw from {channel}
|
||||
ch_sendexpr( {channel}, {expr} [, {options}])
|
||||
any send {expr} over JSON {channel}
|
||||
ch_sendraw( {channel}, {string} [, {options}])
|
||||
any send {string} over raw {channel}
|
||||
ch_setoptions( {channel}, {options}) none set options for {channel}
|
||||
ch_status( {channel}) String status of {channel}
|
||||
ch_read( {handle} [, {options}]) String read from {handle}
|
||||
ch_readraw( {handle} [, {options}]) String read raw from {handle}
|
||||
ch_sendexpr( {handle}, {expr} [, {options}])
|
||||
any send {expr} over JSON {handle}
|
||||
ch_sendraw( {handle}, {string} [, {options}])
|
||||
any send {string} over raw {handle}
|
||||
ch_setoptions( {handle}, {options}) none set options for {handle}
|
||||
ch_status( {handle}) String status of channel {handle}
|
||||
changenr() Number current change number
|
||||
char2nr( {expr}[, {utf8}]) Number ASCII/UTF8 value of first char in {expr}
|
||||
cindent( {lnum}) Number C indent for line {lnum}
|
||||
@@ -1893,7 +1902,8 @@ foldlevel( {lnum}) Number fold level at {lnum}
|
||||
foldtext() String line displayed for closed fold
|
||||
foldtextresult( {lnum}) String text for closed fold at {lnum}
|
||||
foreground() Number bring the Vim window to the foreground
|
||||
function( {name}) Funcref reference to function {name}
|
||||
function({name} [, {arglist}] [, {dict}])
|
||||
Funcref reference to function {name}
|
||||
garbagecollect( [{atexit}]) none free memory, breaking cyclic references
|
||||
get( {list}, {idx} [, {def}]) any get item {idx} from {list} or {def}
|
||||
get( {dict}, {key} [, {def}]) any get item {key} from {dict} or {def}
|
||||
@@ -1969,6 +1979,7 @@ islocked( {expr}) Number TRUE if {expr} is locked
|
||||
isnan( {expr}) Number TRUE if {expr} is NaN
|
||||
items( {dict}) List key-value pairs in {dict}
|
||||
job_getchannel( {job}) Channel get the channel handle for {job}
|
||||
job_info( {job}) Dict get information about {job}
|
||||
job_setoptions( {job}, {options}) none set options for {job}
|
||||
job_start( {command} [, {options}]) Job start a job
|
||||
job_status( {job}) String get the status of {job}
|
||||
@@ -2067,6 +2078,7 @@ serverlist() String get a list of available servers
|
||||
setbufvar( {expr}, {varname}, {val}) set {varname} in buffer {expr} to {val}
|
||||
setcharsearch( {dict}) Dict set character search from {dict}
|
||||
setcmdpos( {pos}) Number set cursor position in command-line
|
||||
setfperm( {fname}, {mode}) Number set {fname} file permissions to {mode}
|
||||
setline( {lnum}, {line}) Number set line {lnum} to {line}
|
||||
setloclist( {nr}, {list}[, {action}])
|
||||
Number modify location list using {list}
|
||||
@@ -2128,9 +2140,12 @@ tabpagewinnr( {tabarg}[, {arg}])
|
||||
Number number of current window in tab page
|
||||
taglist( {expr}) List list of tags matching {expr}
|
||||
tagfiles() List tags files used
|
||||
tempname() String name for a temporary file
|
||||
tan( {expr}) Float tangent of {expr}
|
||||
tanh( {expr}) Float hyperbolic tangent of {expr}
|
||||
tempname() String name for a temporary file
|
||||
timer_start( {time}, {callback} [, {options}])
|
||||
Number create a timer
|
||||
timer_stop( {timer}) none stop a timer
|
||||
tolower( {expr}) String the String {expr} switched to lowercase
|
||||
toupper( {expr}) String the String {expr} switched to uppercase
|
||||
tr( {src}, {fromstr}, {tostr}) String translate chars of {src} in {fromstr}
|
||||
@@ -2145,6 +2160,11 @@ values( {dict}) List values in {dict}
|
||||
virtcol( {expr}) Number screen column of cursor or mark
|
||||
visualmode( [expr]) String last visual mode used
|
||||
wildmenumode() Number whether 'wildmenu' mode is active
|
||||
win_findbuf( {bufnr}) List find windows containing {bufnr}
|
||||
win_getid( [{win} [, {tab}]]) Number get window ID for {win} in {tab}
|
||||
win_gotoid( {expr}) Number go to window with ID {expr}
|
||||
win_id2tabwin( {expr}) List get tab and window nr from window ID
|
||||
win_id2win( {expr}) Number get window nr from window ID
|
||||
winbufnr( {nr}) Number buffer number of window {nr}
|
||||
wincol() Number window column of the cursor
|
||||
winheight( {nr}) Number height of window {nr}
|
||||
@@ -2296,6 +2316,26 @@ 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_true({actual} [, {msg}]) *assert_true()*
|
||||
When {actual} is not true an error message is added to
|
||||
|v:errors|, like with |assert_equal()|.
|
||||
@@ -2693,17 +2733,21 @@ confirm({msg} [, {choices} [, {default} [, {type}]]])
|
||||
don't fit, a vertical layout is used anyway. For some systems
|
||||
the horizontal layout is always used.
|
||||
|
||||
ch_close({channel}) *ch_close()*
|
||||
Close {channel}. See |channel-close|.
|
||||
ch_close({handle}) *ch_close()*
|
||||
Close {handle}. See |channel-close|.
|
||||
{handle} can be Channel or a Job that has a Channel.
|
||||
|
||||
{only available when compiled with the |+channel| feature}
|
||||
|
||||
ch_evalexpr({channel}, {expr} [, {options}]) *ch_evalexpr()*
|
||||
Send {expr} over {channel}. The {expr} is encoded
|
||||
ch_evalexpr({handle}, {expr} [, {options}]) *ch_evalexpr()*
|
||||
Send {expr} over {handle}. The {expr} is encoded
|
||||
according to the type of channel. The function cannot be used
|
||||
with a raw channel. See |channel-use|.
|
||||
{handle} can be Channel or a Job that has a Channel.
|
||||
*E917*
|
||||
{options} must be a Dictionary. It must not have a "callback"
|
||||
entry.
|
||||
entry. It can have a "timeout" entry 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
|
||||
@@ -2711,8 +2755,10 @@ ch_evalexpr({channel}, {expr} [, {options}]) *ch_evalexpr()*
|
||||
|
||||
{only available when compiled with the |+channel| feature}
|
||||
|
||||
ch_evalraw({channel}, {string} [, {options}]) *ch_evalraw()*
|
||||
Send {string} over {channel}.
|
||||
ch_evalraw({handle}, {string} [, {options}]) *ch_evalraw()*
|
||||
Send {string} over {handle}.
|
||||
{handle} can be Channel or a Job that has a Channel.
|
||||
|
||||
Works like |ch_evalexpr()|, but does not encode the request or
|
||||
decode the response. The caller is responsible for the
|
||||
correct contents. Also does not add a newline for a channel
|
||||
@@ -2722,8 +2768,9 @@ ch_evalraw({channel}, {string} [, {options}]) *ch_evalraw()*
|
||||
|
||||
{only available when compiled with the |+channel| feature}
|
||||
|
||||
ch_getbufnr({channel}, {what}) *ch_getbufnr()*
|
||||
Get the buffer number that {channel} is using for {what}.
|
||||
ch_getbufnr({handle}, {what}) *ch_getbufnr()*
|
||||
Get the buffer number that {handle} is using for {what}.
|
||||
{handle} can be Channel or a Job that has a Channel.
|
||||
{what} can be "err" for stderr, "out" for stdout or empty for
|
||||
socket output.
|
||||
Returns -1 when there is no buffer.
|
||||
@@ -2737,11 +2784,39 @@ ch_getjob({channel}) *ch_getjob()*
|
||||
{only available when compiled with the |+channel| and
|
||||
|+job| features}
|
||||
|
||||
ch_log({msg} [, {channel}]) *ch_log()*
|
||||
ch_info({handle}) *ch_info()*
|
||||
Returns a Dictionary with information about {handle}. The
|
||||
items are:
|
||||
"id" number of the channel
|
||||
"status" "open" (any part is open) or "closed"
|
||||
When opened with ch_open():
|
||||
"hostname" the hostname of the address
|
||||
"port" the port of the address
|
||||
"sock_status" "open" or "closed"
|
||||
"sock_mode" "NL", "RAW", "JSON" or "JS"
|
||||
"sock_io" "socket"
|
||||
"sock_timeout" timeout in msec
|
||||
When opened with job_start():
|
||||
"out_status" "open" or "closed"
|
||||
"out_mode" "NL", "RAW", "JSON" or "JS"
|
||||
"out_io" "null", "pipe", "file" or "buffer"
|
||||
"out_timeout" timeout in msec
|
||||
"err_status" "open" or "closed"
|
||||
"err_mode" "NL", "RAW", "JSON" or "JS"
|
||||
"err_io" "out", "null", "pipe", "file" or "buffer"
|
||||
"err_timeout" timeout in msec
|
||||
"in_status" "open" or "closed"
|
||||
"in_mode" "NL", "RAW", "JSON" or "JS"
|
||||
"in_io" "null", "pipe", "file" or "buffer"
|
||||
"in_timeout" timeout in msec
|
||||
|
||||
ch_log({msg} [, {handle}]) *ch_log()*
|
||||
Write {msg} in the channel log file, if it was opened with
|
||||
|ch_logfile()|.
|
||||
When {channel} is passed the channel number is used for the
|
||||
message. {channel} must be an open channel.
|
||||
When {handle} is passed the channel number is used for the
|
||||
message.
|
||||
{handle} can be Channel or a Job that has a Channel. The
|
||||
Channel must open.
|
||||
|
||||
ch_logfile({fname} [, {mode}]) *ch_logfile()*
|
||||
Start logging channel activity to {fname}.
|
||||
@@ -2753,69 +2828,41 @@ ch_logfile({fname} [, {mode}]) *ch_logfile()*
|
||||
The file is flushed after every message, on Unix you can use
|
||||
"tail -f" to see what is going on in real time.
|
||||
|
||||
|
||||
ch_open({address} [, {options}]) *ch_open()*
|
||||
Open a channel to {address}. See |channel|.
|
||||
Returns a Channel. Use |ch_status()| to check for
|
||||
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({channel} [, {options}]) *ch_read()*
|
||||
Read from {channel} and return the received message.
|
||||
ch_read({handle} [, {options}]) *ch_read()*
|
||||
Read from {handle} and return the received message.
|
||||
{handle} can be Channel or a Job that has a Channel.
|
||||
See |channel-more|.
|
||||
{only available when compiled with the |+channel| feature}
|
||||
|
||||
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.
|
||||
|
||||
ch_readraw({channel} [, {options}]) *ch_readraw()*
|
||||
ch_readraw({handle} [, {options}]) *ch_readraw()*
|
||||
Like ch_read() but for a JS and JSON channel does not decode
|
||||
the message.
|
||||
the message. See |channel-more|.
|
||||
{only available when compiled with the |+channel| feature}
|
||||
|
||||
ch_sendexpr({channel}, {expr} [, {options}]) *ch_sendexpr()*
|
||||
Send {expr} over {channel}. The {expr} is encoded
|
||||
ch_sendexpr({handle}, {expr} [, {options}]) *ch_sendexpr()*
|
||||
Send {expr} over {handle}. The {expr} is encoded
|
||||
according to the type of channel. The function cannot be used
|
||||
with a raw channel. See |channel-use|. *E912*
|
||||
|
||||
{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.
|
||||
with a raw channel.
|
||||
See |channel-use|. *E912*
|
||||
{handle} can be Channel or a Job that has a Channel.
|
||||
|
||||
{only available when compiled with the |+channel| feature}
|
||||
|
||||
ch_sendraw({channel}, {string} [, {options}]) *ch_sendraw()*
|
||||
Send {string} over {channel}.
|
||||
ch_sendraw({handle}, {string} [, {options}]) *ch_sendraw()*
|
||||
Send {string} over {handle}.
|
||||
Works like |ch_sendexpr()|, but does not encode the request or
|
||||
decode the response. The caller is responsible for the
|
||||
correct contents. Also does not add a newline for a channel
|
||||
@@ -2825,12 +2872,13 @@ ch_sendraw({channel}, {string} [, {options}]) *ch_sendraw()*
|
||||
|
||||
{only available when compiled with the |+channel| feature}
|
||||
|
||||
ch_setoptions({channel}, {options}) *ch_setoptions()*
|
||||
Set options on {channel}:
|
||||
ch_setoptions({handle}, {options}) *ch_setoptions()*
|
||||
Set options on {handle}:
|
||||
"callback" the channel callback
|
||||
"timeout" default read timeout in msec
|
||||
"mode" mode for the whole channel
|
||||
See |ch_open()| for more explanation.
|
||||
{handle} can be Channel or a Job that has a Channel.
|
||||
|
||||
Note that changing the mode may cause queued messages to be
|
||||
lost.
|
||||
@@ -2838,11 +2886,12 @@ ch_setoptions({channel}, {options}) *ch_setoptions()*
|
||||
These options cannot be changed:
|
||||
"waittime" only applies to "ch_open()|
|
||||
|
||||
ch_status({channel}) *ch_status()*
|
||||
Return the status of {channel}:
|
||||
ch_status({handle}) *ch_status()*
|
||||
Return the status of {handle}:
|
||||
"fail" failed to open the channel
|
||||
"open" channel can be used
|
||||
"closed" channel can not be used
|
||||
{handle} can be Channel or a Job that has a Channel.
|
||||
|
||||
*copy()*
|
||||
copy({expr}) Make a copy of {expr}. For Numbers and Strings this isn't
|
||||
@@ -3539,9 +3588,68 @@ foreground() Move the Vim window to the foreground. Useful when sent from
|
||||
Win32 console version}
|
||||
|
||||
|
||||
function({name}) *function()* *E700*
|
||||
*function()* *E700* *E922* *E923*
|
||||
function({name} [, {arglist}] [, {dict}])
|
||||
Return a |Funcref| variable that refers to function {name}.
|
||||
{name} can be a user defined function or an internal function.
|
||||
{name} can be the name of a user defined function or an
|
||||
internal function.
|
||||
|
||||
{name} can also be a Funcref, also a partial. When it is a
|
||||
partial the dict stored in it will be used and the {dict}
|
||||
argument is not allowed. E.g.: >
|
||||
let FuncWithArg = function(dict.Func, [arg])
|
||||
let Broken = function(dict.Func, [arg], dict)
|
||||
<
|
||||
When {arglist} or {dict} is present this creates a partial.
|
||||
That mans the argument list and/or the dictionary is stored in
|
||||
the Funcref and will be used when the Funcref is called.
|
||||
|
||||
The arguments are passed to the function in front of other
|
||||
arguments. Example: >
|
||||
func Callback(arg1, arg2, name)
|
||||
...
|
||||
let Func = function('Callback', ['one', 'two'])
|
||||
...
|
||||
call Func('name')
|
||||
< Invokes the function as with: >
|
||||
call Callback('one', 'two', 'name')
|
||||
|
||||
< The function() call can be nested to add more arguments to the
|
||||
Funcref. The extra arguments are appended to the list of
|
||||
arguments. Example: >
|
||||
func Callback(arg1, arg2, name)
|
||||
...
|
||||
let Func = function('Callback', ['one'])
|
||||
let Func2 = function(Func, ['two'])
|
||||
...
|
||||
call Func2('name')
|
||||
< Invokes the function as with: >
|
||||
call Callback('one', 'two', 'name')
|
||||
|
||||
< The Dictionary is only useful when calling a "dict" function.
|
||||
In that case the {dict} is passed in as "self". Example: >
|
||||
function Callback() dict
|
||||
echo "called for " . self.name
|
||||
endfunction
|
||||
...
|
||||
let context = {"name": "example"}
|
||||
let Func = function('Callback', context)
|
||||
...
|
||||
call Func() " will echo: called for example
|
||||
< The use of function() is not needed when there are no extra
|
||||
arguments, these two are equivalent: >
|
||||
let Func = function('Callback', context)
|
||||
let Func = context.Callback
|
||||
|
||||
< The argument list and the Dictionary can be combined: >
|
||||
function Callback(arg1, count) dict
|
||||
...
|
||||
let context = {"name": "example"}
|
||||
let Func = function('Callback', ['one'], context)
|
||||
...
|
||||
call Func(500)
|
||||
< Invokes the function as with: >
|
||||
call context.Callback('one', 500)
|
||||
|
||||
|
||||
garbagecollect([{atexit}]) *garbagecollect()*
|
||||
@@ -3810,6 +3918,8 @@ getfperm({fname}) *getfperm()*
|
||||
< This will hopefully (from a security point of view) display
|
||||
the string "rw-r--r--" or even "rw-------".
|
||||
|
||||
For setting permissins use |setfperm()|.
|
||||
|
||||
getftime({fname}) *getftime()*
|
||||
The result is a Number, which is the last modification time of
|
||||
the given file {fname}. The value is measured as seconds
|
||||
@@ -4445,12 +4555,23 @@ items({dict}) *items()*
|
||||
|
||||
job_getchannel({job}) *job_getchannel()*
|
||||
Get the channel handle that {job} is using.
|
||||
To check if the job has no channel: >
|
||||
if string(job_getchannel()) == 'channel fail'
|
||||
<
|
||||
{only available when compiled with the |+job| feature}
|
||||
|
||||
job_info({job}) *job_info()*
|
||||
Returns a Dictionary with information about {job}:
|
||||
"status" what |job_status()| returns
|
||||
"channel" what |job_getchannel()| returns
|
||||
"exitval" only valid when "status" is "dead"
|
||||
"exit_cb" function to be called on exit
|
||||
"stoponexit" |job-stoponexit|
|
||||
|
||||
job_setoptions({job}, {options}) *job_setoptions()*
|
||||
Change options for {job}. Supported are:
|
||||
"stoponexit" |job-stoponexit|
|
||||
"exit-cb" |job-exit-cb|
|
||||
"stoponexit" |job-stoponexit|
|
||||
"exit_cb" |job-exit_cb|
|
||||
|
||||
job_start({command} [, {options}]) *job_start()*
|
||||
Start a job and return a Job object. Unlike |system()| and
|
||||
@@ -4501,6 +4622,8 @@ job_status({job}) *job_status()* *E916*
|
||||
If an exit callback was set with the "exit-cb" option and the
|
||||
job is now detected to be "dead" the callback will be invoked.
|
||||
|
||||
For more information see |job_info()|.
|
||||
|
||||
{only available when compiled with the |+job| feature}
|
||||
|
||||
job_stop({job} [, {how}]) *job_stop()*
|
||||
@@ -5981,6 +6104,24 @@ setcmdpos({pos}) *setcmdpos()*
|
||||
Returns 0 when successful, 1 when not editing the command
|
||||
line.
|
||||
|
||||
setfperm({fname}, {mode}) *setfperm()* *chmod*
|
||||
Set the file permissions for {fname} to {mode}.
|
||||
{mode} must be a string with 9 characters. It is of the form
|
||||
"rwxrwxrwx", where each group of "rwx" flags represent, in
|
||||
turn, the permissions of the owner of the file, the group the
|
||||
file belongs to, and other users. A '-' character means the
|
||||
permission is off, any other character means on. Multi-byte
|
||||
characters are not supported.
|
||||
|
||||
For example "rw-r-----" means read-write for the user,
|
||||
readable by the group, not accessible by others. "xx-x-----"
|
||||
would do the same thing.
|
||||
|
||||
Returns non-zero for success, zero for failure.
|
||||
|
||||
To read permissions see |getfperm()|.
|
||||
|
||||
|
||||
setline({lnum}, {text}) *setline()*
|
||||
Set line {lnum} of the current buffer to {text}. To insert
|
||||
lines use |append()|.
|
||||
@@ -6518,13 +6659,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()*
|
||||
@@ -6798,8 +6943,7 @@ systemlist({expr} [, {input}]) *systemlist()*
|
||||
is the same as |readfile()| will output with {binary} argument
|
||||
set to "b".
|
||||
|
||||
Returns an empty string on error, so be careful not to run
|
||||
into |E706|.
|
||||
Returns an empty string on error.
|
||||
|
||||
|
||||
tabpagebuflist([{arg}]) *tabpagebuflist()*
|
||||
@@ -6915,6 +7059,37 @@ tanh({expr}) *tanh()*
|
||||
{only available when compiled with the |+float| feature}
|
||||
|
||||
|
||||
*timer_start()*
|
||||
timer_start({time}, {callback} [, {options}])
|
||||
Create a timer and return the timer ID.
|
||||
|
||||
{time} is the waiting time in milliseconds. This is the
|
||||
minimum time before invoking the callback. When the system is
|
||||
busy or Vim is not waiting for input the time will be longer.
|
||||
|
||||
{callback} is the function to call. It can be the name of a
|
||||
function or a Funcref. It is called with one argument, which
|
||||
is the timer ID. The callback is only invoked when Vim is
|
||||
waiting for input.
|
||||
|
||||
{options} is a dictionary. Supported entries:
|
||||
"repeat" Number of times to repeat calling the
|
||||
callback. -1 means forever.
|
||||
|
||||
Example: >
|
||||
func MyHandler(timer)
|
||||
echo 'Handler called'
|
||||
endfunc
|
||||
let timer = timer_start(500, 'MyHandler',
|
||||
\ {'repeat': 3})
|
||||
< This will invoke MyHandler() three times at 500 msec
|
||||
intervals.
|
||||
{only available when compiled with the |+timers| feature}
|
||||
|
||||
timer_stop({timer}) *timer_stop()*
|
||||
Stop a timer. {timer} is an ID returned by timer_start().
|
||||
The timer callback will no longer be invoked.
|
||||
|
||||
tolower({expr}) *tolower()*
|
||||
The result is a copy of the String given, with all uppercase
|
||||
characters turned into lowercase (just like applying |gu| to
|
||||
@@ -7115,6 +7290,33 @@ wildmenumode() *wildmenumode()*
|
||||
(Note, this needs the 'wildcharm' option set appropriately).
|
||||
|
||||
|
||||
win_findbuf({bufnr}) *win_findbuf()*
|
||||
Returns a list with window IDs for windows that contain buffer
|
||||
{bufnr}. When there is none the list is empty.
|
||||
|
||||
win_getid([{win} [, {tab}]]) *win_getid()*
|
||||
Get the window ID for the specified window.
|
||||
When {win} is missing use the current window.
|
||||
With {win} this is the window number. The top window has
|
||||
number 1.
|
||||
Without {tab} use the current tab, otherwise the tab with
|
||||
number {tab}. The first tab has number one.
|
||||
Return zero if the window cannot be found.
|
||||
|
||||
win_gotoid({expr}) *win_gotoid()*
|
||||
Go to window with ID {expr}. This may also change the current
|
||||
tabpage.
|
||||
Return 1 if successful, 0 if the window cannot be found.
|
||||
|
||||
win_id2tabwin({expr} *win_id2tabwin()*
|
||||
Return a list with the tab number and window number of window
|
||||
with ID {expr}: [tabnr, winnr].
|
||||
Return [0, 0] if the window cannot be found.
|
||||
|
||||
win_id2win({expr}) *win_id2win()*
|
||||
Return the window number of window with ID {expr}.
|
||||
Return 0 if the window cannot be found in the current tabpage.
|
||||
|
||||
*winbufnr()*
|
||||
winbufnr({nr}) The result is a Number, which is the number of the buffer
|
||||
associated with window {nr}. When {nr} is zero, the number of
|
||||
@@ -7444,12 +7646,14 @@ termresponse Compiled with support for |t_RV| and |v:termresponse|.
|
||||
textobjects Compiled with support for |text-objects|.
|
||||
tgetent Compiled with tgetent support, able to use a termcap
|
||||
or terminfo file.
|
||||
timers Compiled with |timer_start()| support.
|
||||
title Compiled with window title support |'title'|.
|
||||
toolbar Compiled with support for |gui-toolbar|.
|
||||
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: 2014 Sep 19
|
||||
*helphelp.txt* For Vim version 7.4. Last change: 2016 Mar 26
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -197,6 +197,9 @@ command: >
|
||||
*E154* *E150* *E151* *E152* *E153* *E670*
|
||||
:helpt[ags] [++t] {dir}
|
||||
Generate the help tags file(s) for directory {dir}.
|
||||
When {dir} is ALL then all "doc" directories in
|
||||
'runtimepath' will be used.
|
||||
|
||||
All "*.txt" and "*.??x" files in the directory and
|
||||
sub-directories are scanned for a help tag definition
|
||||
in between stars. The "*.??x" files are for
|
||||
@@ -205,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
|
||||
|
||||
@@ -410,13 +410,20 @@ This means that Vim will search for the Lua DLL or shared library file only
|
||||
when needed. When you don't use the Lua interface you don't need it, thus
|
||||
you can use Vim without this file.
|
||||
|
||||
On MS-Windows to use the Lua interface the Lua DLL must be in your search path.
|
||||
In a console window type "path" to see what directories are used. The version
|
||||
of the DLL must match the Lua version Vim was compiled with.
|
||||
|
||||
On Unix the 'luadll' option can be used to specify the Lua shared library file
|
||||
instead of DYNAMIC_LUA_DLL file what was specified at compile time. The
|
||||
version of the shared library must match the Lua version Vim was compiled with.
|
||||
MS-Windows ~
|
||||
|
||||
To use the Lua interface the Lua DLL must be in your search path. In a
|
||||
console window type "path" to see what directories are used. The 'luadll'
|
||||
option can be also used to specify the Lua DLL. The version of the DLL must
|
||||
match the Lua version Vim was compiled with.
|
||||
|
||||
|
||||
Unix ~
|
||||
|
||||
The 'luadll' option can be used to specify the Lua shared library file instead
|
||||
of DYNAMIC_LUA_DLL file what was specified at compile time. The version of
|
||||
the shared library must match the Lua version Vim was compiled with.
|
||||
|
||||
|
||||
==============================================================================
|
||||
|
||||
@@ -284,7 +284,8 @@ used for building Vim.
|
||||
To use the Perl interface the Perl DLL must be in your search path.
|
||||
If Vim reports it cannot find the perl512.dll, make sure your $PATH includes
|
||||
the directory where it is located. The Perl installer normally does that.
|
||||
In a console window type "path" to see what directories are used.
|
||||
In a console window type "path" to see what directories are used. The
|
||||
'perldll' option can be also used to specify the Perl DLL.
|
||||
|
||||
The name of the DLL must match the Perl version Vim was compiled with.
|
||||
Currently the name is "perl512.dll". That is for Perl 5.12. To know for
|
||||
|
||||
@@ -686,18 +686,24 @@ This means that Vim will search for the Python DLL or shared library file only
|
||||
when needed. When you don't use the Python interface you don't need it, thus
|
||||
you can use Vim without this file.
|
||||
|
||||
On MS-Windows to use the Python interface the Python DLL must be in your search
|
||||
path. In a console window type "path" to see what directories are used.
|
||||
|
||||
MS-Windows ~
|
||||
|
||||
To use the Python interface the Python DLL must be in your search path. In a
|
||||
console window type "path" to see what directories are used. The 'pythondll'
|
||||
or 'pythonthreedll' option can be also used to specify the Python DLL.
|
||||
|
||||
The name of the DLL must match the Python version Vim was compiled with.
|
||||
Currently the name is "python24.dll". That is for Python 2.4. To know for
|
||||
sure edit "gvim.exe" and search for "python\d*.dll\c".
|
||||
|
||||
On Unix the 'pythondll' or 'pythonthreedll' option can be used to specify the
|
||||
Python shared library file instead of DYNAMIC_PYTHON_DLL or
|
||||
DYNAMIC_PYTHON3_DLL file what were specified at compile time. The version of
|
||||
the shared library must match the Python 2.x or Python 3 version Vim was
|
||||
compiled with.
|
||||
|
||||
Unix ~
|
||||
|
||||
The 'pythondll' or 'pythonthreedll' option can be used to specify the Python
|
||||
shared library file instead of DYNAMIC_PYTHON_DLL or DYNAMIC_PYTHON3_DLL file
|
||||
what were specified at compile time. The version of the shared library must
|
||||
match the Python 2.x or Python 3 version Vim was compiled with.
|
||||
|
||||
==============================================================================
|
||||
10. Python 3 *python3*
|
||||
|
||||
@@ -199,6 +199,7 @@ This means that Vim will search for the Ruby DLL file or shared library only
|
||||
when needed. When you don't use the Ruby interface you don't need it, thus
|
||||
you can use Vim even though this library file is not on your system.
|
||||
|
||||
|
||||
MS-Windows ~
|
||||
|
||||
You need to install the right version of Ruby for this to work. You can find
|
||||
@@ -207,7 +208,8 @@ http://www.garbagecollect.jp/ruby/mswin32/en/download/release.html
|
||||
Currently that is ruby-1.9.1-p429-i386-mswin32.zip
|
||||
|
||||
To use the Ruby interface the Ruby DLL must be in your search path. In a
|
||||
console window type "path" to see what directories are used.
|
||||
console window type "path" to see what directories are used. The 'rubydll'
|
||||
option can be also used to specify the Ruby DLL.
|
||||
|
||||
The name of the DLL must match the Ruby version Vim was compiled with.
|
||||
Currently the name is "msvcrt-ruby191.dll". That is for Ruby 1.9.1. To know
|
||||
@@ -218,6 +220,7 @@ and comment-out the check for _MSC_VER.
|
||||
You may also need to rename the include directory name to match the version,
|
||||
strangely for Ruby 1.9.3 the directory is called 1.9.1.
|
||||
|
||||
|
||||
Unix ~
|
||||
|
||||
The 'rubydll' option can be used to specify the Ruby shared library file
|
||||
|
||||
@@ -526,7 +526,8 @@ can use Vim without this file.
|
||||
MS-Windows ~
|
||||
|
||||
To use the Tcl interface the Tcl DLL must be in your search path. In a
|
||||
console window type "path" to see what directories are used.
|
||||
console window type "path" to see what directories are used. The 'tcldll'
|
||||
option can be also used to specify the Tcl DLL.
|
||||
|
||||
The name of the DLL must match the Tcl version Vim was compiled with.
|
||||
Currently the name is "tcl86.dll". That is for Tcl 8.6. To know for sure
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*index.txt* For Vim version 7.4. Last change: 2016 Feb 27
|
||||
*index.txt* For Vim version 7.4. Last change: 2016 Mar 12
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -1324,7 +1324,6 @@ tag command action ~
|
||||
|:lnfile| :lnf[ile] go to first location in next file
|
||||
|:lnoremap| :ln[oremap] like ":noremap!" but includes Lang-Arg mode
|
||||
|:loadkeymap| :loadk[eymap] load the following keymaps until EOF
|
||||
|:loadplugin| :loadp[lugin] load a plugin from 'packpath'
|
||||
|:loadview| :lo[adview] load view for current window from a file
|
||||
|:lockmarks| :loc[kmarks] following command keeps marks where they are
|
||||
|:lockvar| :lockv[ar] lock variables
|
||||
@@ -1395,6 +1394,8 @@ tag command action ~
|
||||
|:ounmap| :ou[nmap] like ":unmap" but for Operator-pending mode
|
||||
|:ounmenu| :ounme[nu] remove menu for Operator-pending mode
|
||||
|:ownsyntax| :ow[nsyntax] set new local syntax highlight for this window
|
||||
|:packadd| :pa[ckadd] add a plugin from 'packpath'
|
||||
|:packloadall| :packl[oadall] load all packages under 'packpath'
|
||||
|:pclose| :pc[lose] close preview window
|
||||
|:pedit| :ped[it] edit file in the preview window
|
||||
|:perl| :pe[rl] execute Perl command
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*options.txt* For Vim version 7.4. Last change: 2016 Feb 24
|
||||
*options.txt* For Vim version 7.4. Last change: 2016 Mar 24
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -69,7 +69,7 @@ achieve special effects. These options come in three forms:
|
||||
:se[t] {option}:{value}
|
||||
Set string or number option to {value}.
|
||||
For numeric options the value can be given in decimal,
|
||||
hex (preceded with 0x) or octal (preceded with '0').
|
||||
hex (preceded with 0x) or octal (preceded with '0').
|
||||
The old value can be inserted by typing 'wildchar' (by
|
||||
default this is a <Tab> or CTRL-E if 'compatible' is
|
||||
set). See |cmdline-completion|.
|
||||
@@ -1002,7 +1002,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
- The backup file will be created in the first directory in the list
|
||||
where this is possible. The directory must exist, Vim will not
|
||||
create it for you.
|
||||
- Empty means that no backup file will be created ( 'patchmode' is
|
||||
- Empty means that no backup file will be created ('patchmode' is
|
||||
impossible!). Writing may fail because of this.
|
||||
- A directory "." means to put the backup file in the same directory
|
||||
as the edited file.
|
||||
@@ -1792,7 +1792,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
when CTRL-P or CTRL-N are used. It is also used for whole-line
|
||||
completion |i_CTRL-X_CTRL-L|. It indicates the type of completion
|
||||
and the places to scan. It is a comma separated list of flags:
|
||||
. scan the current buffer ( 'wrapscan' is ignored)
|
||||
. scan the current buffer ('wrapscan' is ignored)
|
||||
w scan buffers from other windows
|
||||
b scan other loaded buffers that are in the buffer list
|
||||
u scan the unloaded buffers that are in the buffer list
|
||||
@@ -2292,6 +2292,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.
|
||||
@@ -2644,6 +2646,15 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
also 'gdefault' option.
|
||||
Switching this option on is discouraged!
|
||||
|
||||
*'emoji'* *'emo'*
|
||||
'emoji' 'emo' boolean (default: on)
|
||||
global
|
||||
{not in Vi}
|
||||
{only available when compiled with the |+multi_byte|
|
||||
feature}
|
||||
When on all Unicode emoji characters are considered to be full width.
|
||||
|
||||
|
||||
*'encoding'* *'enc'* *E543*
|
||||
'encoding' 'enc' string (default: "latin1" or value from $LANG)
|
||||
global
|
||||
@@ -3021,8 +3032,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
|
||||
@@ -3732,7 +3743,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
The same applies to the modeless selection.
|
||||
*'go-P'*
|
||||
'P' Like autoselect but using the "+ register instead of the "*
|
||||
register.
|
||||
register.
|
||||
*'go-A'*
|
||||
'A' Autoselect for the modeless selection. Like 'a', but only
|
||||
applies to the modeless selection.
|
||||
@@ -4841,7 +4852,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
reset this option. |-u| |--noplugin|
|
||||
|
||||
*'luadll'*
|
||||
'luadll' string (default depends on the build)
|
||||
'luadll' string (default depends on the build)
|
||||
global
|
||||
{not in Vi}
|
||||
{only available when compiled with the |+lua/dyn|
|
||||
@@ -5106,6 +5117,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
|
||||
@@ -5298,7 +5310,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
respectively; see |CTRL-A| for more info on these commands.
|
||||
alpha If included, single alphabetical characters will be
|
||||
incremented or decremented. This is useful for a list with a
|
||||
letter index a), b), etc. *octal-nrformats*
|
||||
letter index a), b), etc. *octal-nrformats*
|
||||
octal If included, numbers that start with a zero will be considered
|
||||
to be octal. Example: Using CTRL-A on "007" results in "010".
|
||||
hex If included, numbers starting with "0x" or "0X" will be
|
||||
@@ -5328,7 +5340,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
relative to the cursor. Together with 'number' there are these
|
||||
four combinations (cursor in line 3):
|
||||
|
||||
'nonu' 'nu' 'nonu' 'nu'
|
||||
'nonu' 'nu' 'nonu' 'nu'
|
||||
'nornu' 'nornu' 'rnu' 'rnu'
|
||||
|
||||
|apple | 1 apple | 2 apple | 2 apple
|
||||
@@ -5567,7 +5579,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
this doesn't work when $INCL contains a comma or white space.
|
||||
|
||||
*'perldll'*
|
||||
'perldll' string (default depends on the build)
|
||||
'perldll' string (default depends on the build)
|
||||
global
|
||||
{not in Vi}
|
||||
{only available when compiled with the |+perl/dyn|
|
||||
@@ -5704,7 +5716,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
|ins-completion-menu|.
|
||||
|
||||
*'pythondll'*
|
||||
'pythondll' string (default depends on the build)
|
||||
'pythondll' string (default depends on the build)
|
||||
global
|
||||
{not in Vi}
|
||||
{only available when compiled with the |+python/dyn|
|
||||
@@ -5945,7 +5957,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
The 'rightleft' option must be set for 'rightleftcmd' to take effect.
|
||||
|
||||
*'rubydll'*
|
||||
'rubydll' string (default: depends on the build)
|
||||
'rubydll' string (default: depends on the build)
|
||||
global
|
||||
{not in Vi}
|
||||
{only available when compiled with the |+ruby/dyn|
|
||||
@@ -6533,7 +6545,9 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
c don't give |ins-completion-menu| messages. For example,
|
||||
"-- XXX completion (YYY)", "match 1 of 2", "The only match",
|
||||
"Pattern not found", "Back at original", etc.
|
||||
q use "recording" instead of "recording @a"
|
||||
q use "recording" instead of "recording @a"
|
||||
F don't give the file info when editing a file, like `:silent`
|
||||
was used for the command
|
||||
|
||||
This gives you the opportunity to avoid that a change between buffers
|
||||
requires you to hit <Enter>, but still gives as useful a message as
|
||||
@@ -7437,7 +7451,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
mapping which should not change the tagstack.
|
||||
|
||||
*'tcldll'*
|
||||
'tcldll' string (default depends on the build)
|
||||
'tcldll' string (default depends on the build)
|
||||
global
|
||||
{not in Vi}
|
||||
{only available when compiled with the |+tcl/dyn|
|
||||
@@ -7492,7 +7506,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
{not in Vi}
|
||||
Encoding used for the terminal. This specifies what character
|
||||
encoding the keyboard produces and the display will understand. For
|
||||
the GUI it only applies to the keyboard ( 'encoding' is used for the
|
||||
the GUI it only applies to the keyboard ('encoding' is used for the
|
||||
display). Except for the Mac when 'macatsui' is off, then
|
||||
'termencoding' should be "macroman".
|
||||
*E617*
|
||||
@@ -7769,13 +7783,15 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
{not in Vi}
|
||||
{only in the GTK+ 2 GUI}
|
||||
Controls the size of toolbar icons. The possible values are:
|
||||
tiny Use tiny toolbar icons.
|
||||
small Use small toolbar icons (default).
|
||||
medium Use medium-sized toolbar icons.
|
||||
large Use large toolbar icons.
|
||||
tiny Use tiny icons.
|
||||
small Use small icons (default).
|
||||
medium Use medium-sized icons.
|
||||
large Use large icons.
|
||||
huge Use even larger icons.
|
||||
giant Use very big icons.
|
||||
The exact dimensions in pixels of the various icon sizes depend on
|
||||
the current theme. Common dimensions are large=32x32, medium=24x24,
|
||||
small=20x20 and tiny=16x16.
|
||||
the current theme. Common dimensions are giant=48x48, huge=32x32,
|
||||
large=24x24, medium=24x24, small=20x20 and tiny=16x16.
|
||||
|
||||
If 'toolbariconsize' is empty, the global default size as determined
|
||||
by user preferences or the current theme is used.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*os_win32.txt* For Vim version 7.4. Last change: 2014 Sep 25
|
||||
*os_win32.txt* For Vim version 7.4. Last change: 2016 Mar 05
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by George Reilly
|
||||
@@ -96,6 +96,31 @@ The directory of the Vim executable is appended to $PATH. This is mostly to
|
||||
make "!xxd" work, as it is in the Tools menu. And it also means that when
|
||||
executable() returns 1 the executable can actually be executed.
|
||||
|
||||
Quotes in file names *win32-quotes*
|
||||
|
||||
Quotes inside a file name (or any other command line argument) can be escaped
|
||||
with a backslash. E.g. >
|
||||
vim -c "echo 'foo\"bar'"
|
||||
|
||||
Alternatively use three quotes to get one: >
|
||||
vim -c "echo 'foo"""bar'"
|
||||
|
||||
The quotation rules are:
|
||||
|
||||
1. A `"` starts quotation.
|
||||
2. Another `"` or `""` ends quotation. If the quotation ends with `""`, a `"`
|
||||
is produced at the end of the quoted string.
|
||||
|
||||
Examples, with [] around an argument:
|
||||
"foo" -> [foo]
|
||||
"foo"" -> [foo"]
|
||||
"foo"bar -> [foobar]
|
||||
"foo" bar -> [foo], [bar]
|
||||
"foo""bar -> [foo"bar]
|
||||
"foo"" bar -> [foo"], [bar]
|
||||
"foo"""bar" -> [foo"bar]
|
||||
|
||||
|
||||
==============================================================================
|
||||
3. Restore screen contents *win32-restore*
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*quickfix.txt* For Vim version 7.4. Last change: 2016 Jan 21
|
||||
*quickfix.txt* For Vim version 7.4. Last change: 2016 Mar 23
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -56,6 +56,14 @@ The following quickfix commands can be used. The location list commands are
|
||||
similar to the quickfix commands, replacing the 'c' prefix in the quickfix
|
||||
command with 'l'.
|
||||
|
||||
*E924*
|
||||
If the current window was closed by an |autocommand| while processing a
|
||||
location list command, it will be aborted.
|
||||
|
||||
*E925* *E926*
|
||||
If the current quickfix or location list was changed by an |autocommand| while
|
||||
processing a quickfix or location list command, it will be aborted.
|
||||
|
||||
*:cc*
|
||||
:cc[!] [nr] Display error [nr]. If [nr] is omitted, the same
|
||||
error is displayed again. Without [!] this doesn't
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*repeat.txt* For Vim version 7.4. Last change: 2016 Feb 26
|
||||
*repeat.txt* For Vim version 7.4. Last change: 2016 Mar 26
|
||||
|
||||
|
||||
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*
|
||||
@@ -182,10 +183,12 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
|
||||
{not in Vi}
|
||||
|
||||
*:ru* *:runtime*
|
||||
:ru[ntime][!] {file} ..
|
||||
:ru[ntime][!] [where] {file} ..
|
||||
Read Ex commands from {file} in each directory given
|
||||
by 'runtimepath'. There is no error for non-existing
|
||||
files. Example: >
|
||||
by 'runtimepath' and/or 'packpath'. There is no error
|
||||
for non-existing files.
|
||||
|
||||
Example: >
|
||||
:runtime syntax/c.vim
|
||||
|
||||
< There can be multiple {file} arguments, separated by
|
||||
@@ -199,6 +202,15 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
|
||||
When it is not included only the first found file is
|
||||
sourced.
|
||||
|
||||
When [where] is omitted only 'runtimepath' is used.
|
||||
Other values:
|
||||
START search under "start" in 'packpath'
|
||||
OPT search under "opt" in 'packpath'
|
||||
PACK search under "start" and "opt" in
|
||||
'packpath'
|
||||
ALL first use 'runtimepath', then search
|
||||
under "start" and "opt" in 'packpath'
|
||||
|
||||
When {file} contains wildcards it is expanded to all
|
||||
matching files. Example: >
|
||||
:runtime! plugin/*.vim
|
||||
@@ -213,23 +225,44 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
|
||||
about each searched file.
|
||||
{not in Vi}
|
||||
|
||||
*:loadp* *:loadplugin*
|
||||
:loadp[lugin] {name} Search for an optional plugin directory and source the
|
||||
plugin files found. It is similar to: >
|
||||
:runtime pack/*/opt/{name}/plugin/*.vim
|
||||
< However, `:loadplugin` uses 'packpath' instead of
|
||||
'runtimepath'. And the directory found is added to
|
||||
'runtimepath'.
|
||||
|
||||
If you have a directory under 'packpath' that doesn't
|
||||
actually have a plugin file, just create an empty one.
|
||||
This will still add the directory to 'runtimepath'.
|
||||
*:pa* *:packadd* *E919*
|
||||
:pa[ckadd][!] {name} Search for an optional plugin directory in 'packpath'
|
||||
and source any plugin files found. The directory must
|
||||
match:
|
||||
pack/*/opt/{name} ~
|
||||
The directory is added to 'runtimepath' if it wasn't
|
||||
there yet.
|
||||
|
||||
Note that {name} is the directory name, not the name
|
||||
of the .vim file. If the "{name}/plugin" directory
|
||||
contains more than one file they are all sourced.
|
||||
|
||||
Also see |load-plugin|.
|
||||
If the filetype detection was not enabled yet (this
|
||||
is usually done with a "syntax enable" or "filetype
|
||||
on" command in your .vimrc file), this will also look
|
||||
for "{name}/ftdetect/*.vim" files.
|
||||
|
||||
When the optional ! is added no plugin files or
|
||||
ftdetect scripts are loaded, only the matching
|
||||
directories are added to 'runtimepath'. This is
|
||||
useful in your .vimrc. The plugins will then be
|
||||
loaded during initialization, see |load-plugins|.
|
||||
|
||||
Also see |pack-add|.
|
||||
|
||||
*:packl* *:packloadall*
|
||||
:packloadall[!] Load all packages in the "start" directories under
|
||||
'packpath'. The directories found are added to
|
||||
'runtimepath'.
|
||||
This is normally done automatically during startup,
|
||||
after loading your .vimrc file. With this command it
|
||||
can be done earlier.
|
||||
Packages will be loaded only once. After this command
|
||||
it won't happen again. When the optional ! is added
|
||||
this command will load packages even when done before.
|
||||
An Error only causes sourcing the script where it
|
||||
happens to be aborted, further plugins will be loaded.
|
||||
See |packages|.
|
||||
|
||||
:scripte[ncoding] [encoding] *:scripte* *:scriptencoding* *E167*
|
||||
Specify the character encoding used in the script.
|
||||
@@ -412,51 +445,162 @@ Rationale:
|
||||
A Vim package is a directory that contains one or more plugins. The
|
||||
advantages over normal plugins:
|
||||
- A package can be downloaded as an archive and unpacked in its own directory.
|
||||
That makes it easy to updated and/or remove.
|
||||
- A package can be a git, mercurial, etc. respository. That makes it really
|
||||
Thus the files are not mixed with files of other plugins. That makes it
|
||||
easy to update and remove.
|
||||
- A package can be a git, mercurial, etc. repository. That makes it really
|
||||
easy to update.
|
||||
- A package can contain multiple plugins that depend on each other.
|
||||
- A package can contain plugins that are automatically loaded on startup and
|
||||
ones that are only loaded when needed with `:loadplugin`.
|
||||
ones that are only loaded when needed with `:packadd`.
|
||||
|
||||
|
||||
Using a package and loading automatically ~
|
||||
|
||||
Let's assume your Vim files are in the "~/.vim" directory and you want to add a
|
||||
package from a zip archive "/tmp/mypack.zip":
|
||||
% mkdir -p ~/.vim/pack/my
|
||||
% cd ~/.vim/pack/my
|
||||
% unzip /tmp/mypack.zip
|
||||
package from a zip archive "/tmp/foopack.zip":
|
||||
% mkdir -p ~/.vim/pack/foo
|
||||
% cd ~/.vim/pack/foo
|
||||
% unzip /tmp/foopack.zip
|
||||
|
||||
The directory name "my" is arbitrary, you can pick anything you like.
|
||||
The directory name "foo" is arbitrary, you can pick anything you like.
|
||||
|
||||
You would now have these files under ~/.vim:
|
||||
pack/my/README.txt
|
||||
pack/my/ever/always/plugin/always.vim
|
||||
pack/my/ever/always/syntax/always.vim
|
||||
pack/my/opt/mydebug/plugin/debugger.vim
|
||||
pack/foo/README.txt
|
||||
pack/foo/start/foobar/plugin/foo.vim
|
||||
pack/foo/start/foobar/syntax/some.vim
|
||||
pack/foo/opt/foodebug/plugin/debugger.vim
|
||||
|
||||
When Vim starts up it scans all directories in 'packpath' for plugins under the
|
||||
"ever" directory and loads them. When found that directory is added to
|
||||
'runtimepath'.
|
||||
When Vim starts up, after processing your .vimrc, it scans all directories in
|
||||
'packpath' for plugins under the "pack/*/start" directory and loads them. The
|
||||
directory is added to 'runtimepath'.
|
||||
|
||||
In the example Vim will find "my/ever/always/plugin/always.vim" and adds
|
||||
"~/.vim/pack/my/ever/always" to 'runtimepath'.
|
||||
In the example Vim will find "pack/foo/start/foobar/plugin/foo.vim" and adds
|
||||
"~/.vim/pack/foo/start/foobar" to 'runtimepath'.
|
||||
|
||||
If the "always" plugin kicks in and sets the 'filetype' to "always", Vim will
|
||||
find the syntax/always.vim file, because its directory is in 'runtimepath'.
|
||||
If the "foobar" plugin kicks in and sets the 'filetype' to "some", Vim will
|
||||
find the syntax/some.vim file, because its directory is in 'runtimepath'.
|
||||
|
||||
*load-plugin*
|
||||
To load an optional plugin from a pack use the `:loadplugin` command: >
|
||||
:loadplugin mydebug
|
||||
This could be done inside always.vim, if some conditions are met.
|
||||
Or you could add this command to your |.vimrc|.
|
||||
Vim will also load ftdetect files, if there are any.
|
||||
|
||||
Note that the files under "pack/foo/opt" are not loaded automatically, only the
|
||||
ones under "pack/foo/start". See |pack-add| below for how the "opt" directory
|
||||
is used.
|
||||
|
||||
Loading packages automatically will not happen if loading plugins is disabled,
|
||||
see |load-plugins|.
|
||||
|
||||
To load packages earlier, so that 'runtimepath' gets updated: >
|
||||
:packloadall
|
||||
This also works when loading plugins is disabled. The automatic loading will
|
||||
only happen once.
|
||||
|
||||
|
||||
Using a single plugin and loading it automatically ~
|
||||
|
||||
If you don't have a package but a single plugin, you need to create the extra
|
||||
directory level:
|
||||
% mkdir -p ~/.vim/pack/foo/start/foobar
|
||||
% cd ~/.vim/pack/foo/start/foobar
|
||||
% unzip /tmp/someplugin.zip
|
||||
|
||||
You would now have these files:
|
||||
pack/foo/start/foobar/plugin/foo.vim
|
||||
pack/foo/start/foobar/syntax/some.vim
|
||||
|
||||
From here it works like above.
|
||||
|
||||
|
||||
Optional plugins ~
|
||||
*pack-add*
|
||||
To load an optional plugin from a pack use the `:packadd` command: >
|
||||
:packadd foodebug
|
||||
This searches for "pack/*/opt/foodebug" in 'packpath' and will find
|
||||
~/.vim/pack/foo/opt/foodebug/plugin/debugger.vim and source it.
|
||||
|
||||
This could be done 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.
|
||||
|
||||
Loading packages will not happen if loading plugins is disabled, see
|
||||
|load-plugins|.
|
||||
|
||||
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
|
||||
@@ -681,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 Feb 27
|
||||
*starting.txt* For Vim version 7.4. Last change: 2016 Mar 26
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -45,6 +45,7 @@ filename One or more file names. The first one will be the current
|
||||
vim -- -filename
|
||||
< All arguments after the "--" will be interpreted as file names,
|
||||
no other options or "+command" argument can follow.
|
||||
For behavior of quotes on MS-Windows, see |win32-quotes|.
|
||||
|
||||
*--*
|
||||
- This argument can mean two things, depending on whether Ex
|
||||
@@ -832,6 +833,8 @@ accordingly. Vim proceeds in this order:
|
||||
- The user exrc file(s). Same as for the user vimrc file, but with
|
||||
"vimrc" replaced by "exrc". But only one of ".exrc" and "_exrc" is
|
||||
used, depending on the system. And without the (*)!
|
||||
- You would usually have "syntax on" and/or "filetype on" commands,
|
||||
which trigger initializing filetype detection, see |syntax-loading|.
|
||||
|
||||
d. If the 'exrc' option is on (which is not the default), the current
|
||||
directory is searched for three files. The first that exists is used,
|
||||
@@ -863,8 +866,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
|
||||
@@ -902,8 +905,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:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*syntax.txt* For Vim version 7.4. Last change: 2016 Feb 25
|
||||
*syntax.txt* For Vim version 7.4. Last change: 2016 Mar 12
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -4534,9 +4534,9 @@ in their own color.
|
||||
:colo[rscheme] {name} Load color scheme {name}. This searches 'runtimepath'
|
||||
for the file "colors/{name}.vim". The first one that
|
||||
is found is loaded.
|
||||
To see the name of the currently active color scheme: >
|
||||
:colo
|
||||
< The name is also stored in the g:colors_name variable.
|
||||
Also searches all plugins in 'packpath', first below
|
||||
"start" and then under "opt".
|
||||
|
||||
Doesn't work recursively, thus you can't use
|
||||
":colorscheme" in a color scheme script.
|
||||
After the color scheme has been loaded the
|
||||
|
||||
@@ -207,6 +207,8 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
|
||||
'efm' options.txt /*'efm'*
|
||||
'ei' options.txt /*'ei'*
|
||||
'ek' options.txt /*'ek'*
|
||||
'emo' options.txt /*'emo'*
|
||||
'emoji' options.txt /*'emoji'*
|
||||
'enc' options.txt /*'enc'*
|
||||
'encoding' options.txt /*'encoding'*
|
||||
'endofline' options.txt /*'endofline'*
|
||||
@@ -1286,6 +1288,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
|
||||
+termresponse various.txt /*+termresponse*
|
||||
+textobjects various.txt /*+textobjects*
|
||||
+tgetent various.txt /*+tgetent*
|
||||
+timers various.txt /*+timers*
|
||||
+title various.txt /*+title*
|
||||
+toolbar various.txt /*+toolbar*
|
||||
+user_commands various.txt /*+user_commands*
|
||||
@@ -1634,6 +1637,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*
|
||||
@@ -2446,8 +2450,6 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
|
||||
:lo starting.txt /*:lo*
|
||||
:loadk mbyte.txt /*:loadk*
|
||||
:loadkeymap mbyte.txt /*:loadkeymap*
|
||||
:loadp repeat.txt /*:loadp*
|
||||
:loadplugin repeat.txt /*:loadplugin*
|
||||
:loadview starting.txt /*:loadview*
|
||||
:loc motion.txt /*:loc*
|
||||
:lockmarks motion.txt /*:lockmarks*
|
||||
@@ -2620,6 +2622,10 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
|
||||
:ounmenu gui.txt /*:ounmenu*
|
||||
:ownsyntax syntax.txt /*:ownsyntax*
|
||||
:p various.txt /*:p*
|
||||
:pa repeat.txt /*:pa*
|
||||
:packadd repeat.txt /*:packadd*
|
||||
:packl repeat.txt /*:packl*
|
||||
:packloadall repeat.txt /*:packloadall*
|
||||
:pc windows.txt /*:pc*
|
||||
:pclose windows.txt /*:pclose*
|
||||
:pe if_perl.txt /*:pe*
|
||||
@@ -4212,7 +4218,6 @@ E702 eval.txt /*E702*
|
||||
E703 eval.txt /*E703*
|
||||
E704 eval.txt /*E704*
|
||||
E705 eval.txt /*E705*
|
||||
E706 eval.txt /*E706*
|
||||
E707 eval.txt /*E707*
|
||||
E708 eval.txt /*E708*
|
||||
E709 eval.txt /*E709*
|
||||
@@ -4438,9 +4443,19 @@ E911 eval.txt /*E911*
|
||||
E912 eval.txt /*E912*
|
||||
E913 eval.txt /*E913*
|
||||
E914 eval.txt /*E914*
|
||||
E915 channel.txt /*E915*
|
||||
E916 eval.txt /*E916*
|
||||
E917 eval.txt /*E917*
|
||||
E918 channel.txt /*E918*
|
||||
E919 repeat.txt /*E919*
|
||||
E92 message.txt /*E92*
|
||||
E920 channel.txt /*E920*
|
||||
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*
|
||||
@@ -4874,6 +4889,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*
|
||||
@@ -5167,6 +5183,7 @@ ch_evalexpr() eval.txt /*ch_evalexpr()*
|
||||
ch_evalraw() eval.txt /*ch_evalraw()*
|
||||
ch_getbufnr() eval.txt /*ch_getbufnr()*
|
||||
ch_getjob() eval.txt /*ch_getjob()*
|
||||
ch_info() eval.txt /*ch_info()*
|
||||
ch_log() eval.txt /*ch_log()*
|
||||
ch_logfile() eval.txt /*ch_logfile()*
|
||||
ch_open() eval.txt /*ch_open()*
|
||||
@@ -5209,7 +5226,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*
|
||||
@@ -5223,6 +5242,7 @@ charity uganda.txt /*charity*
|
||||
charset mbyte.txt /*charset*
|
||||
charset-conversion mbyte.txt /*charset-conversion*
|
||||
chill.vim syntax.txt /*chill.vim*
|
||||
chmod eval.txt /*chmod*
|
||||
cindent() eval.txt /*cindent()*
|
||||
cinkeys-format indent.txt /*cinkeys-format*
|
||||
cino-# indent.txt /*cino-#*
|
||||
@@ -5274,7 +5294,7 @@ clipboard-html options.txt /*clipboard-html*
|
||||
clipboard-unnamed options.txt /*clipboard-unnamed*
|
||||
clipboard-unnamedplus options.txt /*clipboard-unnamedplus*
|
||||
clojure-indent indent.txt /*clojure-indent*
|
||||
close-cb channel.txt /*close-cb*
|
||||
close_cb channel.txt /*close_cb*
|
||||
cmdarg-variable eval.txt /*cmdarg-variable*
|
||||
cmdbang-variable eval.txt /*cmdbang-variable*
|
||||
cmdline-arguments vi_diff.txt /*cmdline-arguments*
|
||||
@@ -5639,8 +5659,11 @@ end intro.txt /*end*
|
||||
end-of-file pattern.txt /*end-of-file*
|
||||
enlightened-terminal syntax.txt /*enlightened-terminal*
|
||||
erlang.vim syntax.txt /*erlang.vim*
|
||||
err-cb channel.txt /*err-cb*
|
||||
err-timeout channel.txt /*err-timeout*
|
||||
err_buf channel.txt /*err_buf*
|
||||
err_cb channel.txt /*err_cb*
|
||||
err_mode channel.txt /*err_mode*
|
||||
err_name channel.txt /*err_name*
|
||||
err_timeout channel.txt /*err_timeout*
|
||||
errmsg-variable eval.txt /*errmsg-variable*
|
||||
error-file-format quickfix.txt /*error-file-format*
|
||||
error-messages message.txt /*error-messages*
|
||||
@@ -6759,6 +6782,11 @@ improved-viminfo version5.txt /*improved-viminfo*
|
||||
improvements-5 version5.txt /*improvements-5*
|
||||
improvements-6 version6.txt /*improvements-6*
|
||||
improvements-7 version7.txt /*improvements-7*
|
||||
in_bot channel.txt /*in_bot*
|
||||
in_buf channel.txt /*in_buf*
|
||||
in_mode channel.txt /*in_mode*
|
||||
in_name channel.txt /*in_name*
|
||||
in_top channel.txt /*in_top*
|
||||
inactive-buffer windows.txt /*inactive-buffer*
|
||||
include-search tagsrch.txt /*include-search*
|
||||
inclusive motion.txt /*inclusive*
|
||||
@@ -6836,21 +6864,23 @@ javascript-indenting indent.txt /*javascript-indenting*
|
||||
job channel.txt /*job*
|
||||
job-callback channel.txt /*job-callback*
|
||||
job-channel-overview channel.txt /*job-channel-overview*
|
||||
job-close-cb channel.txt /*job-close-cb*
|
||||
job-close_cb channel.txt /*job-close_cb*
|
||||
job-control channel.txt /*job-control*
|
||||
job-err-cb channel.txt /*job-err-cb*
|
||||
job-err-io channel.txt /*job-err-io*
|
||||
job-exit-cb channel.txt /*job-exit-cb*
|
||||
job-in-io channel.txt /*job-in-io*
|
||||
job-may-start channel.txt /*job-may-start*
|
||||
job-err_cb channel.txt /*job-err_cb*
|
||||
job-err_io channel.txt /*job-err_io*
|
||||
job-exit_cb channel.txt /*job-exit_cb*
|
||||
job-in_io channel.txt /*job-in_io*
|
||||
job-options channel.txt /*job-options*
|
||||
job-out-cb channel.txt /*job-out-cb*
|
||||
job-out-io channel.txt /*job-out-io*
|
||||
job-out_cb channel.txt /*job-out_cb*
|
||||
job-out_io channel.txt /*job-out_io*
|
||||
job-start channel.txt /*job-start*
|
||||
job-start-if-needed channel.txt /*job-start-if-needed*
|
||||
job-start-nochannel channel.txt /*job-start-nochannel*
|
||||
job-stoponexit channel.txt /*job-stoponexit*
|
||||
job-term channel.txt /*job-term*
|
||||
job-timeout channel.txt /*job-timeout*
|
||||
job_getchannel() eval.txt /*job_getchannel()*
|
||||
job_info() eval.txt /*job_info()*
|
||||
job_setoptions() eval.txt /*job_setoptions()*
|
||||
job_start() eval.txt /*job_start()*
|
||||
job_status() eval.txt /*job_status()*
|
||||
@@ -6942,7 +6972,6 @@ list-repeat windows.txt /*list-repeat*
|
||||
lite.vim syntax.txt /*lite.vim*
|
||||
literal-string eval.txt /*literal-string*
|
||||
lnum-variable eval.txt /*lnum-variable*
|
||||
load-plugin repeat.txt /*load-plugin*
|
||||
load-plugins starting.txt /*load-plugins*
|
||||
load-vim-script repeat.txt /*load-vim-script*
|
||||
local-additions help.txt /*local-additions*
|
||||
@@ -7502,6 +7531,7 @@ news intro.txt /*news*
|
||||
nextnonblank() eval.txt /*nextnonblank()*
|
||||
nice todo.txt /*nice*
|
||||
no-eval-feature eval.txt /*no-eval-feature*
|
||||
no-type-checking eval.txt /*no-type-checking*
|
||||
no_buffers_menu gui.txt /*no_buffers_menu*
|
||||
non-greedy pattern.txt /*non-greedy*
|
||||
non-zero-arg eval.txt /*non-zero-arg*
|
||||
@@ -7570,9 +7600,14 @@ os_unix.txt os_unix.txt /*os_unix.txt*
|
||||
os_vms.txt os_vms.txt /*os_vms.txt*
|
||||
os_win32.txt os_win32.txt /*os_win32.txt*
|
||||
other-features vi_diff.txt /*other-features*
|
||||
out-cb channel.txt /*out-cb*
|
||||
out-timeout channel.txt /*out-timeout*
|
||||
out_buf channel.txt /*out_buf*
|
||||
out_cb channel.txt /*out_cb*
|
||||
out_mode channel.txt /*out_mode*
|
||||
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*
|
||||
@@ -7976,6 +8011,7 @@ set-spc-auto spell.txt /*set-spc-auto*
|
||||
setbufvar() eval.txt /*setbufvar()*
|
||||
setcharsearch() eval.txt /*setcharsearch()*
|
||||
setcmdpos() eval.txt /*setcmdpos()*
|
||||
setfperm() eval.txt /*setfperm()*
|
||||
setline() eval.txt /*setline()*
|
||||
setloclist() eval.txt /*setloclist()*
|
||||
setmatches() eval.txt /*setmatches()*
|
||||
@@ -8186,7 +8222,6 @@ startup-terminal term.txt /*startup-terminal*
|
||||
static-tag tagsrch.txt /*static-tag*
|
||||
status-line windows.txt /*status-line*
|
||||
statusmsg-variable eval.txt /*statusmsg-variable*
|
||||
sticky-type-checking eval.txt /*sticky-type-checking*
|
||||
str2float() eval.txt /*str2float()*
|
||||
str2nr() eval.txt /*str2nr()*
|
||||
strcasestr() eval.txt /*strcasestr()*
|
||||
@@ -8567,6 +8602,8 @@ throw-from-catch eval.txt /*throw-from-catch*
|
||||
throw-variables eval.txt /*throw-variables*
|
||||
throwpoint-variable eval.txt /*throwpoint-variable*
|
||||
time-functions usr_41.txt /*time-functions*
|
||||
timer_start() eval.txt /*timer_start()*
|
||||
timer_stop() eval.txt /*timer_stop()*
|
||||
timestamp editing.txt /*timestamp*
|
||||
timestamps editing.txt /*timestamps*
|
||||
tips tips.txt /*tips*
|
||||
@@ -8738,6 +8775,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_!*
|
||||
@@ -8911,6 +8949,8 @@ 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_starting eval.txt /*vim_starting*
|
||||
vimball pi_vimball.txt /*vimball*
|
||||
vimball-contents pi_vimball.txt /*vimball-contents*
|
||||
vimball-extract pi_vimball.txt /*vimball-extract*
|
||||
@@ -9008,12 +9048,18 @@ win32-mouse os_win32.txt /*win32-mouse*
|
||||
win32-open-with-menu gui_w32.txt /*win32-open-with-menu*
|
||||
win32-popup-menu gui_w32.txt /*win32-popup-menu*
|
||||
win32-problems os_win32.txt /*win32-problems*
|
||||
win32-quotes os_win32.txt /*win32-quotes*
|
||||
win32-restore os_win32.txt /*win32-restore*
|
||||
win32-startup os_win32.txt /*win32-startup*
|
||||
win32-term os_win32.txt /*win32-term*
|
||||
win32-vimrun gui_w32.txt /*win32-vimrun*
|
||||
win32-win3.1 os_win32.txt /*win32-win3.1*
|
||||
win32s os_win32.txt /*win32s*
|
||||
win_findbuf() eval.txt /*win_findbuf()*
|
||||
win_getid() eval.txt /*win_getid()*
|
||||
win_gotoid() eval.txt /*win_gotoid()*
|
||||
win_id2tabwin() eval.txt /*win_id2tabwin()*
|
||||
win_id2win() eval.txt /*win_id2win()*
|
||||
winbufnr() eval.txt /*winbufnr()*
|
||||
wincol() eval.txt /*wincol()*
|
||||
window windows.txt /*window*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*todo.txt* For Vim version 7.4. Last change: 2016 Feb 27
|
||||
*todo.txt* For Vim version 7.4. Last change: 2016 Mar 26
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -34,88 +34,51 @@ not be repeated below, unless there is extra information.
|
||||
*known-bugs*
|
||||
-------------------- Known bugs and current work -----------------------
|
||||
|
||||
assert_matches('pattern', value)
|
||||
|
||||
+channel:
|
||||
- A callback on ch_sendraw() should be put at the end of the list of callback
|
||||
handlers. When a message arrives invoke the first one and remove it.
|
||||
- implement TODO items in ":help channel":
|
||||
- job_start() options:
|
||||
term
|
||||
in-io
|
||||
in-file
|
||||
out-io
|
||||
out-file
|
||||
out-buffer
|
||||
err-io
|
||||
err-file
|
||||
err-buffer
|
||||
existing channel to use
|
||||
- job_maystart()
|
||||
- add job_info(): process ID, run/dead, etc.
|
||||
- add ch_info(): in/out/err mode, timeout, callbacks, etc.
|
||||
- Move more details from eval.txt to channel.txt. Add tags in eval.txt.
|
||||
- When receiving malformed json starting with a quote it doesn't get
|
||||
discarded.
|
||||
- When decoding json, don't read all the typeahead at once, use the reader
|
||||
properly.
|
||||
- When a message in the queue but there is no callback, drop it after a while?
|
||||
Add timestamp to queued messages and callbacks with ID, remove after a
|
||||
minute.
|
||||
- cleanup on exit? in mch_getout() and getout().
|
||||
- Add more log calls, basically at every branch, before every callback, etc.
|
||||
- add remark about undo sync, is there a way to force it?
|
||||
minute. Option to set the droptime.
|
||||
- Add remark about undo sync, is there a way to force it?
|
||||
- When starting a job, have an option to open the server socket, so we know
|
||||
the port, and pass it to the command with --socket-fd {nr}. (Olaf Dabrunz,
|
||||
Feb 9) How to do this on MS-Windows?
|
||||
- Add more unit-testing in json_test.c
|
||||
- Add a test where ["eval","getline(123)"] gets a line with special
|
||||
characters (NUL, 0x80, etc.). Check that it isn't garbled.
|
||||
- make sure errors lead to a useful error msg. ["ex","foobar"]
|
||||
- Make sure errors lead to a useful error msg. ["ex","foobar"]
|
||||
- For connection to server, a "keep open" flag would be useful. Retry
|
||||
connecting in the main loop with zero timeout.
|
||||
Later
|
||||
- job_start(): run job in a newly opened terminal.
|
||||
With xterm could use -S{pty}.
|
||||
|
||||
For Win32 isinf() should be inline. (ZyX)
|
||||
Partial:
|
||||
- Maybe we also need VAR_PARTIAL support in if_mzsch.
|
||||
|
||||
Add ":packadd"? Like :loadplugin but only adds the dir to 'runtimepath'.
|
||||
Packages:
|
||||
- make package for editexisting, others?
|
||||
|
||||
emoji patch from Yasuhiro Matsumoto.
|
||||
|
||||
More plugin support:
|
||||
- Have a way to install a callback from the main loop. Called every second or
|
||||
so.
|
||||
- Need way to uniquely identify a window, no matter how windows are
|
||||
rearranged. Same for tab pages.
|
||||
getwinid() ID of current winow
|
||||
getwinid({nr}) ID of window {nr}
|
||||
getwinid({nr}, {tab}) ID of window {nr} in tab page {tab}
|
||||
getwinnr({id}) window nr of {id} or -1 if not open
|
||||
gettabnr({id}) tab page nr of {id} or -1 if not open
|
||||
gotowin({id})
|
||||
Make it so that the window ID can be used where currently a window nr is used
|
||||
Patch from Anton Lindqvist, 2016 Feb 21, to make bufwinnr() return a list.
|
||||
Perhaps add bufwinid() instead.
|
||||
|
||||
This difference is unexpected:
|
||||
echo v:true == 1
|
||||
1
|
||||
echo [v:true] == [1]
|
||||
0
|
||||
It's because tv_equal() works different.
|
||||
|
||||
Compiler warnings. (John Marriott, Feb 17)
|
||||
|
||||
Compiler warnings in if_ole.cpp. Patch by Ken Takata, Feb 18.
|
||||
|
||||
When running "make install" don't overwrite the doc/tags file, generate it
|
||||
elsewhere, so that the distributed file doesn't change.
|
||||
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)
|
||||
#658, #659) Also add "setlocal" at top of batch file?
|
||||
|
||||
Patch to add GTK 3 support. (Kazunobu Kuriyama, 2016 Feb 13)
|
||||
Patch to add matchstrpos(). (Ozaki Kiichi, 2016 Feb 28)
|
||||
|
||||
Why does this: echo "a" . 1.1
|
||||
result in: a11
|
||||
Should recognize float (so long as it's not ".1.1").
|
||||
|
||||
Allow for an empty dictionary key.
|
||||
Patch to make tag jump work on function({expr}). (Hirohito Higashi, 2016 Mar
|
||||
25)
|
||||
|
||||
Allow for an empty dictionary key?
|
||||
|
||||
Patch to improve I/O for Perl. (Damien, 2016 Jan 9, update Jan 22 2nd one)
|
||||
|
||||
Patch to fix ml_get error. (Alexander Freiherr von Buddenbrock, 2016 Mar 4,
|
||||
#676)
|
||||
|
||||
Regexp problems:
|
||||
- The regexp engines are not reentrant, causing havoc when interrupted by a
|
||||
@@ -159,29 +122,51 @@ 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.
|
||||
|
||||
Also include update_curswant() fix for getcurpos(). (Christian Brabandt, 2016
|
||||
Feb 9)
|
||||
|
||||
Patch to list some messages and clear messages. (Yasuhiro Matsumoto, 2016 Mar
|
||||
12)
|
||||
|
||||
Patch to fix escaping special characters for delete(). (tc-0, 2016 Mar 20,
|
||||
#700) Test fails on MS-Windows.
|
||||
|
||||
Patch to put undo options together in undo window.
|
||||
(Gary Johnson, 2016 Jan 28)
|
||||
|
||||
Patch to have better check for {action} argument of setqflist().
|
||||
Nikolai Pavlov, Feb 25, #661. Can be even more strict.
|
||||
|
||||
Patch for clearing history. (Yegappan Lakshmanan, 2016 Jan 31, second message
|
||||
has tests)
|
||||
Also see patch from Hirohito Higash, Feb 25.
|
||||
Updated patch, 2016 Mar 25.
|
||||
|
||||
Patch to update the GTK icon cache when installing. (Kazunobu Kuriyama, 2016
|
||||
Feb 3)
|
||||
|
||||
Patch for test86 and test87. (Roland Puntaier, #622)
|
||||
|
||||
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)
|
||||
@@ -190,15 +175,25 @@ Two patches now? New update Feb 24.
|
||||
Patch to support 64 bit ints for Number. (Ken Takata, 2016 Jan 21)
|
||||
Also in update of Feb 24?
|
||||
|
||||
After 7.5 is released:
|
||||
- Drop support for older MS-Windows systems, before XP.
|
||||
Patch from Ken Takata, 2016 Mar 8.
|
||||
|
||||
Add stronger encryption. Could use libsodium (NaCl).
|
||||
https://github.com/jedisct1/libsodium/
|
||||
Possibly include the needed code so that it can be build everywhere.
|
||||
|
||||
Patch to add setbufline(). (email from Yasuhiro Matsumoto, patch by Ozaki
|
||||
Kiichi, 2016 Feb 28)
|
||||
Update Mar 8: https://gist.github.com/mattn/23c1f50999084992ca98
|
||||
Update Mar 13: https://gist.github.com/mattn/23c1f50999084992ca98
|
||||
|
||||
Need to try out instructions in INSSTALLpc.txt about how to install all
|
||||
interfaces and how to build Vim with them.
|
||||
Appveyor build with self-installing executable, includes getting most
|
||||
interfaces: https://github.com/k-takata/vim/tree/chrisbra-appveyor-build
|
||||
result: https://ci.appveyor.com/project/k-takata/vim/history
|
||||
|
||||
Still using freed memory after using setloclist(). (lcd, 2014 Jul 23)
|
||||
More info Jul 24. Not clear why.
|
||||
|
||||
Duplication of completion suggestions for ":!hom". Issue 539.
|
||||
Patch by Christian, 2016 Jan 29
|
||||
>
|
||||
@@ -213,8 +208,6 @@ What if there is an invalid character?
|
||||
Should jsonencode()/jsondecode() restrict recursiveness?
|
||||
Or avoid recursiveness.
|
||||
|
||||
Patch to fix bug in statusline highlighting. (Christian Brabandt, 2016 Feb 2)
|
||||
|
||||
Use vim.vim syntax highlighting for help file examples, but without ":" in
|
||||
'iskeyword' for syntax.
|
||||
|
||||
@@ -223,6 +216,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?
|
||||
@@ -230,9 +227,6 @@ Should use /usr/local/share/applications or /usr/share/applications.
|
||||
Or use $XDG_DATA_DIRS.
|
||||
Also need to run update-desktop-database (Kuriyama Kazunobu, 2015 Nov 4)
|
||||
|
||||
Move the README files that are for including in archives to a subdirectory.
|
||||
"readmedir/" ?
|
||||
|
||||
Access to uninitialized memory in match_backref() regexp_nda.c:4882
|
||||
(Dominique Pelle, 2015 Nov 6)
|
||||
|
||||
@@ -244,6 +238,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,
|
||||
@@ -271,6 +267,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 26)
|
||||
|
||||
Patch to add TagNotFound autocommand. (Anton Lindqvist, 2016 Feb 3)
|
||||
|
||||
Patch to add Error autocommand. (Anton Lindqvist, 2016 Feb 17)
|
||||
@@ -294,7 +292,7 @@ set_color_count().
|
||||
|
||||
Python: ":py raw_input('prompt')" doesn't work. (Manu Hack)
|
||||
|
||||
Comparing nested structures with "==" uses a different comperator than when
|
||||
Comparing nested structures with "==" uses a different comparator than when
|
||||
comparing individual items.
|
||||
Also, "'' == 0" evaluates to true, which isn't nice.
|
||||
Add "===" to have a strict comparison (type and value match).
|
||||
@@ -321,6 +319,9 @@ Patch to add :mapgroup, put mappings in a group like augroup.
|
||||
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) Update Mar 21.
|
||||
|
||||
Can we cache the syntax attributes, so that updates for 'relativenumber' and
|
||||
'cursorline'/'cursorcolumn' are a lot faster?
|
||||
|
||||
@@ -332,6 +333,7 @@ Use v:none. var == v:none
|
||||
|
||||
Patch to add arguments to argc() and argv(). (Yegappan Lakshmanan, 2016 Jan
|
||||
24) Also need a way to get the global arg list? Update later on Jan 24
|
||||
Update Mar 5.
|
||||
|
||||
To support Thai (and other languages) word boundaries, include the ICU
|
||||
library: http://userguide.icu-project.org/boundaryanalysis
|
||||
@@ -382,8 +384,6 @@ Patch to add GUI colors to the terminal, when it supports it. (ZyX, 2013 Jan
|
||||
Patch for problem with restoring screen on Windows. (Nobuhiro Takasaki, 2015
|
||||
Sep 10)
|
||||
|
||||
Patch to improve I/O for Perl. (Damien, 2015 Jan 9, update Jan 22 2nd one)
|
||||
|
||||
Patch to set antialiasing style on Windows. (Ondrej Balaz, 2013 Mar 14)
|
||||
Needs a different check for CLEARTYPE_QUALITY.
|
||||
Problem mentioned by Christian Brabandt, 2016 Jan 4.
|
||||
@@ -401,8 +401,6 @@ Patch to fix checking global option value when not using it.
|
||||
When 'showbreak' is set repeating a Visual operation counts the size of the
|
||||
'showbreak' text as part of the operation. (Axel Bender, 2015 Jul 20)
|
||||
|
||||
Patch to apply 'fileformats' when starting Vim. (Mike Williams, 2015 Jul 22)
|
||||
|
||||
Patch for matchit plugin related to multibyte chars. (Ken Takata, 2015 Jul 22)
|
||||
|
||||
Patch for multi-byte characters in langmap and applying a mapping on them.
|
||||
@@ -460,6 +458,7 @@ Mixup of highlighting when there is a match and SpellBad. (ZyX, 2015 Jan 1)
|
||||
Patch for drag&drop reordering of GUI tab pages reordering.
|
||||
(Ken Takata, 2013 Nov 22, second one, also by Masamichi Abe)
|
||||
Now on Git: https://gist.github.com/nocd5/165286495c782b815b94
|
||||
Update 2016 Mar 15.
|
||||
|
||||
Patch on Issue 72: 'autochdir' causes problems for :vimgrep.
|
||||
|
||||
@@ -1750,9 +1749,6 @@ Fail to edit file after failed register access. Error flag remains set?
|
||||
Patch for redo register. (Ben Schmidt, 2007 Oct 19)
|
||||
Await response to question to make the register writable.
|
||||
|
||||
src/testdir/Make_dos.mak: not all tests are included, e.g., test49, without a
|
||||
remark why.
|
||||
|
||||
Problem with 'ts' set to 9 and 'showbreak' to ">>>". (Matthew Winn, 2007 Oct
|
||||
1)
|
||||
|
||||
@@ -2720,64 +2716,7 @@ GUI:
|
||||
currently. This is very obvious on a 66Mhz 486.
|
||||
|
||||
|
||||
MSDOS/DJGPP:
|
||||
9 Pressing CTRL-C often crashes the console Vim runs in. (Ken Liao)
|
||||
When 'bioskey' isn't set it doesn't happen. Could be a problem with the
|
||||
BIOS emulation of the console. Version 5.6 already had this problem.
|
||||
8 DJGPP: "cd c:" can take us to a directory that no longer exists.
|
||||
change_drive() doesn't check this. How to check for this error?
|
||||
9 The 16 bit version runs out of memory very quickly. Should find unused
|
||||
code and reduce static data. Resetting 'writebackup' helps to be able to
|
||||
write a file.
|
||||
9 Crash when running on Windows 98 in a console window and pressing CTRL-C.
|
||||
Happens now and then. When debugging Vim in gdb this also happens. Since
|
||||
the console crashes, might be a bug in the DOS console. Resetting
|
||||
'bioskey' avoids it, but then CTRL-C doesn't work.
|
||||
9 DOS: Make CTRL-Fx and ALT-Fx work.
|
||||
CTRL-F1 = CE-5E, CTRL-F2 = CE-5F, .., CTRL-F10 = CE-67
|
||||
ALT-F1 = CE-68, ALT-F2 = CE-69, .., ALT-F10 = CE-71
|
||||
Shifted cursor keys produce same codes as unshifted keys. Use bioskey(2)
|
||||
to get modifier mask for <S-C-M-Fx>.
|
||||
Use K_SPECIAL/KS_MODIFIER codes to insert modifier mask in input stream?
|
||||
Make this work like in Win32 console.
|
||||
Mapping things like <M-A> doesn't work, because it generates an extended
|
||||
key code. Use a translation table?
|
||||
9 Can't read an opened swap file when the "share" command has not been used.
|
||||
At least ignore the swap files that Vim has opened itself.
|
||||
8 Use DJGPP 2.03.
|
||||
8 The Dos32 version (DJGPP) can't use long file names on Windows NT.
|
||||
Check if new package can be used (v2misc/ntlfn08[bs].zip).
|
||||
8 setlocale() is bogus.
|
||||
8 Vim busy waits for new characters or mouse clicks. Should put in some
|
||||
sort of sleep, to avoid eating 50% of the CPU time. Test on an unpatched
|
||||
Windows 95 system!
|
||||
8 DJGPP: when shell is bash, make fails. (Donahoe)
|
||||
7 Hitting CTRL-P twice quickly (e.g., in keyword completion) on a 8088
|
||||
machine, starts printer echo! (John Mullin).
|
||||
7 MSDOS 16 bit version can't work with COMSPEC that has an argument, e.g.:
|
||||
COMSPEC=C:\WINDOWS\COMMAND.COM /E:4096 (Bradley)
|
||||
Caused by BCC system() function (Borland "make" has the same problem).
|
||||
8 Mouse: handle left&right button pressed as middle button pressed. Add
|
||||
modifier keys shift, ctrl and alt.
|
||||
7 When too many files are open (depends on FILES), strange things happen.
|
||||
The Dos16 version runs out of memory, in the Dos32 version "!ls" causes a
|
||||
crash. Another symptom: .swp files are not deleted, existing files are
|
||||
"[New file]".
|
||||
7 DJGPP version doesn't work with graphics display mode. Switch to a mode
|
||||
that is supported?
|
||||
8 DJGPP: ":mode" doesn't work for many modes. Disable them.
|
||||
8 DJGPP: When starting in Ex mode, shouldn't clear the screen. (Walter
|
||||
Briscoe)
|
||||
|
||||
|
||||
MSDOS, OS/2 and Win32:
|
||||
8 OS/2: Add backtick expansion. Undefine NO_EXPANDPATH and use
|
||||
gen_expand_wildcards().
|
||||
8 OS/2: Add clipboard support? See example clipbrd.exe from Alexander
|
||||
Wagner.
|
||||
8 OS/2: Add Extended Attributes support and define HAVE_ACL.
|
||||
8 OS/2: When editing a file name "foo.txt" that is actually called FOO.txt,
|
||||
writing uses "foo.txt". Should obtain the real file name.
|
||||
Win32 console:
|
||||
8 Should $USERPROFILE be preferred above $HOMEDRIVE/$HOMEPATH? No, but it's
|
||||
a good fallback, thus use:
|
||||
$HOME
|
||||
@@ -3781,7 +3720,7 @@ Syntax highlighting:
|
||||
unprintable char another color. Would be useful for ^M at end of line.
|
||||
|
||||
|
||||
Built-in script language:
|
||||
Vim script language:
|
||||
8 Make the filename and line number available to script functions, so that
|
||||
they can give useful debugging info. The whole call stack would be ideal.
|
||||
At least use this for error messages.
|
||||
@@ -3802,14 +3741,10 @@ Built-in script language:
|
||||
7 ":include" command: just like ":source" but doesn't start a new scriptID?
|
||||
Will be tricky for the list of script names.
|
||||
8 Have a look at VSEL. Would it be useful to include? (Bigham)
|
||||
8 Add ":fungroup" command, to group function definitions together. When
|
||||
encountered, all functions in the group are removed. Suggest using an
|
||||
obscure name to avoid name clashes. Require a ":fungroup END" in the same
|
||||
sourced file? Assume the group ends at the end of the file. Handle
|
||||
nested packages?
|
||||
Alternative: Support packages. {package-name}:{function-name}().
|
||||
Packages are loaded automatically when first used, from
|
||||
$VIMRUNTIME/packages (or use a search path).
|
||||
8 Have a prefix for a function to make it unique. When using packages it
|
||||
can be the plugin name.
|
||||
Perhaps also have a way to remove everything that the package added?
|
||||
including autocommands.
|
||||
7 Pre-parse or compile Vim scripts into a bytecode.
|
||||
1. Put the bytecode with the original script, with an ":if
|
||||
has('bytecode')" around it, so that it's only used with a Vim that
|
||||
@@ -3826,8 +3761,6 @@ Built-in script language:
|
||||
8 Add functions:
|
||||
has(":command") Check if ":command" works. compare function
|
||||
with "ex_ni". E.g. for ":simalt".
|
||||
system() With a List argument. Bypasses the shell, use
|
||||
exec() directly. (Bob Hiestand)
|
||||
escape() Add argument to specify what to escape with.
|
||||
modestack() Instead of just the current mode return the
|
||||
stack of Insert / CTRL-O / :normal things.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*usr_05.txt* For Vim version 7.4. Last change: 2012 Nov 20
|
||||
*usr_05.txt* For Vim version 7.4. Last change: 2016 Mar 25
|
||||
|
||||
VIM USER MANUAL - by Bram Moolenaar
|
||||
|
||||
@@ -12,10 +12,11 @@ Vim's capabilities. Or define your own macros.
|
||||
|05.1| The vimrc file
|
||||
|05.2| The example vimrc file explained
|
||||
|05.3| Simple mappings
|
||||
|05.4| Adding a plugin
|
||||
|05.5| Adding a help file
|
||||
|05.6| The option window
|
||||
|05.7| Often used options
|
||||
|05.4| Adding a package
|
||||
|05.5| Adding a plugin
|
||||
|05.6| Adding a help file
|
||||
|05.7| The option window
|
||||
|05.8| Often used options
|
||||
|
||||
Next chapter: |usr_06.txt| Using syntax highlighting
|
||||
Previous chapter: |usr_04.txt| Making small changes
|
||||
@@ -263,7 +264,45 @@ The ":map" command (with no arguments) lists your current mappings. At
|
||||
least the ones for Normal mode. More about mappings in section |40.1|.
|
||||
|
||||
==============================================================================
|
||||
*05.4* Adding a plugin *add-plugin* *plugin*
|
||||
*05.4* Adding a package *add-package* *matchit-install*
|
||||
|
||||
A package is a set of files that you can add to Vim. There are two kinds of
|
||||
packages: optional and automatically loaded on startup.
|
||||
|
||||
The Vim distribution comes with a few packages that you can optionally use.
|
||||
For example, the matchit plugin. This plugin makes the "%" command jump to
|
||||
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
|
||||
|
||||
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
|
||||
package directory in 'runtimepath', so that the help file can be found.
|
||||
|
||||
You can find packages on the Internet in various places. It usually comes as
|
||||
an archive or as a repository. For an archive you can follow these steps:
|
||||
1. create the package directory: >
|
||||
mkdir -p ~/.vim/pack/fancy
|
||||
< "fancy" can be any name of your liking. Use one that describes the
|
||||
package.
|
||||
2. unpack the archive in that directory. This assumes the top
|
||||
directory in the archive is "start": >
|
||||
cd ~/.vim/pack/fancy
|
||||
unzip /tmp/fancy.zip
|
||||
< If the archive layout is different make sure that you end up with a
|
||||
path like this:
|
||||
~/.vim/pack/fancy/start/fancytext/plugin/fancy.vim ~
|
||||
Here "fancytext" is the name of the package, it can be anything
|
||||
else.
|
||||
|
||||
More information about packages can be found here: |packages|.
|
||||
|
||||
==============================================================================
|
||||
*05.5* Adding a plugin *add-plugin* *plugin*
|
||||
|
||||
Vim's functionality can be extended by adding plugins. A plugin is nothing
|
||||
more than a Vim script file that is loaded automatically when Vim starts. You
|
||||
@@ -415,23 +454,19 @@ Further reading:
|
||||
|new-filetype| How to detect a new file type.
|
||||
|
||||
==============================================================================
|
||||
*05.5* Adding a help file *add-local-help* *matchit-install*
|
||||
*05.6* Adding a help file *add-local-help*
|
||||
|
||||
If you are lucky, the plugin you installed also comes with a help file. We
|
||||
will explain how to install the help file, so that you can easily find help
|
||||
for your new plugin.
|
||||
Let us use the "matchit.vim" plugin as an example (it is included with
|
||||
Vim). This plugin makes the "%" command jump to 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).
|
||||
This plugin comes with documentation: "matchit.txt". Let's first copy the
|
||||
plugin to the right directory. This time we will do it from inside Vim, so
|
||||
that we can use $VIMRUNTIME. (You may skip some of the "mkdir" commands if
|
||||
you already have the directory.) >
|
||||
Let us use the "doit.vim" plugin as an example. This plugin comes with
|
||||
documentation: "doit.txt". Let's first copy the plugin to the right
|
||||
directory. This time we will do it from inside Vim. (You may skip some of
|
||||
the "mkdir" commands if you already have the directory.) >
|
||||
|
||||
:!mkdir ~/.vim
|
||||
:!mkdir ~/.vim/plugin
|
||||
:!cp $VIMRUNTIME/macros/matchit.vim ~/.vim/plugin
|
||||
:!cp /tmp/doit.vim ~/.vim/plugin
|
||||
|
||||
The "cp" command is for Unix, on MS-DOS you can use "copy".
|
||||
|
||||
@@ -441,7 +476,7 @@ Now create a "doc" directory in one of the directories in 'runtimepath'. >
|
||||
|
||||
Copy the help file to the "doc" directory. >
|
||||
|
||||
:!cp $VIMRUNTIME/macros/matchit.txt ~/.vim/doc
|
||||
:!cp /tmp/doit.txt ~/.vim/doc
|
||||
|
||||
Now comes the trick, which allows you to jump to the subjects in the new help
|
||||
file: Generate the local tags file with the |:helptags| command. >
|
||||
@@ -450,10 +485,10 @@ file: Generate the local tags file with the |:helptags| command. >
|
||||
|
||||
Now you can use the >
|
||||
|
||||
:help g%
|
||||
:help doit
|
||||
|
||||
command to find help for "g%" in the help file you just added. You can see an
|
||||
entry for the local help file when you do: >
|
||||
command to find help for "doit" in the help file you just added. You can see
|
||||
an entry for the local help file when you do: >
|
||||
|
||||
:help local-additions
|
||||
|
||||
@@ -464,7 +499,7 @@ them through the tag.
|
||||
For writing a local help file, see |write-local-help|.
|
||||
|
||||
==============================================================================
|
||||
*05.6* The option window
|
||||
*05.7* The option window
|
||||
|
||||
If you are looking for an option that does what you want, you can search in
|
||||
the help files here: |options|. Another way is by using this command: >
|
||||
@@ -503,7 +538,7 @@ border. This is what the 'scrolloff' option does, it specifies an offset
|
||||
from the window border where scrolling starts.
|
||||
|
||||
==============================================================================
|
||||
*05.7* Often used options
|
||||
*05.8* Often used options
|
||||
|
||||
There are an awful lot of options. Most of them you will hardly ever use.
|
||||
Some of the more useful ones will be mentioned here. Don't forget you can
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*usr_41.txt* For Vim version 7.4. Last change: 2016 Feb 14
|
||||
*usr_41.txt* For Vim version 7.4. Last change: 2016 Mar 15
|
||||
|
||||
VIM USER MANUAL - by Bram Moolenaar
|
||||
|
||||
@@ -889,9 +889,11 @@ Mappings: *mapping-functions*
|
||||
wildmenumode() check if the wildmode is active
|
||||
|
||||
Testing: *test-functions*
|
||||
assert_equal() assert that two expressions values are equal
|
||||
assert_equal() assert that two expressions values are equal
|
||||
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
|
||||
assert_fails() assert that a function call fails
|
||||
|
||||
Inter-process communication:
|
||||
ch_open() open a channel
|
||||
@@ -932,7 +934,7 @@ Various: *various-functions*
|
||||
perleval() evaluate Perl expression (|+perl|)
|
||||
py3eval() evaluate Python expression (|+python3|)
|
||||
pyeval() evaluate Python expression (|+python|)
|
||||
wordcount() get byte/word/char count of buffer
|
||||
wordcount() get byte/word/char count of buffer
|
||||
|
||||
==============================================================================
|
||||
*41.7* Defining a function
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*usr_toc.txt* For Vim version 7.4. Last change: 2010 Jul 20
|
||||
*usr_toc.txt* For Vim version 7.4. Last change: 2016 Mar 25
|
||||
|
||||
VIM USER MANUAL - by Bram Moolenaar
|
||||
|
||||
@@ -104,10 +104,11 @@ Read this from start to end to learn the essential commands.
|
||||
|05.1| The vimrc file
|
||||
|05.2| The example vimrc file explained
|
||||
|05.3| Simple mappings
|
||||
|05.4| Adding a plugin
|
||||
|05.5| Adding a help file
|
||||
|05.6| The option window
|
||||
|05.7| Often used options
|
||||
|05.4| Adding a package
|
||||
|05.5| Adding a plugin
|
||||
|05.6| Adding a help file
|
||||
|05.7| The option window
|
||||
|05.8| Often used options
|
||||
|
||||
|usr_06.txt| Using syntax highlighting
|
||||
|06.1| Switching it on
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*various.txt* For Vim version 7.4. Last change: 2016 Feb 27
|
||||
*various.txt* For Vim version 7.4. Last change: 2016 Mar 20
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -426,6 +426,7 @@ m *+tcl/dyn* Tcl interface |tcl-dynamic| |/dyn|
|
||||
N *+termresponse* support for |t_RV| and |v:termresponse|
|
||||
N *+textobjects* |text-objects| selection
|
||||
*+tgetent* non-Unix only: able to use external termcap
|
||||
N *+timers* the |timer_start()| function
|
||||
N *+title* Setting the window 'title' and 'icon'
|
||||
N *+toolbar* |gui-toolbar|
|
||||
N *+user_commands* User-defined commands. |user-commands|
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: R
|
||||
" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
|
||||
" Last Change: Sun Feb 23, 2014 04:07PM
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Tue Apr 07, 2015 04:38PM
|
||||
|
||||
" Only do this when not yet done for this buffer
|
||||
if exists("b:did_ftplugin")
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: R help file
|
||||
" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
|
||||
" Last Change: Wed Jul 09, 2014 06:23PM
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Tue Apr 07, 2015 04:37PM
|
||||
|
||||
" Only do this when not yet done for this buffer
|
||||
if exists("b:did_ftplugin")
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: R help file
|
||||
" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
|
||||
" Last Change: Wed Jul 09, 2014 06:23PM
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Tue Apr 07, 2015 04:37PM
|
||||
" Original work by Alex Zvoleff (adjusted for rmd by Michel Kuhlmann)
|
||||
|
||||
" Only do this when not yet done for this buffer
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: Rnoweb
|
||||
" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
|
||||
" Last Change: Wed Jul 09, 2014 06:23PM
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Tue Apr 07, 2015 04:37PM
|
||||
|
||||
" Only do this when not yet done for this buffer
|
||||
if exists("b:did_ftplugin")
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: reStructuredText documentation format with R code
|
||||
" Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>
|
||||
" Last Change: Wed Jul 09, 2014 06:23PM
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Tue Apr 07, 2015 04:38PM
|
||||
" Original work by Alex Zvoleff
|
||||
|
||||
" Only do this when not yet done for this buffer
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
" Vim indent file
|
||||
" Language: R
|
||||
" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
|
||||
" Last Change: Thu Mar 26, 2015 05:36PM
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Thu Feb 18, 2016 06:32AM
|
||||
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
@@ -32,7 +33,7 @@ if ! exists("g:r_indent_ess_compatible")
|
||||
let g:r_indent_ess_compatible = 0
|
||||
endif
|
||||
if ! exists("g:r_indent_op_pattern")
|
||||
let g:r_indent_op_pattern = '\(+\|-\|\*\|/\|=\|\~\|%\)$'
|
||||
let g:r_indent_op_pattern = '\(&\||\|+\|-\|\*\|/\|=\|\~\|%\|->\)\s*$'
|
||||
endif
|
||||
|
||||
function s:RDelete_quotes(line)
|
||||
@@ -265,7 +266,7 @@ function GetRIndent()
|
||||
return 0
|
||||
endif
|
||||
|
||||
if cline =~ '^\s*{'
|
||||
if cline =~ '^\s*{' && s:Get_paren_balance(cline, '{', '}') > 0
|
||||
if g:r_indent_ess_compatible && line =~ ')$'
|
||||
let nlnum = lnum
|
||||
let nline = line
|
||||
@@ -283,7 +284,7 @@ function GetRIndent()
|
||||
endif
|
||||
|
||||
" line is an incomplete command:
|
||||
if line =~ '\<\(if\|while\|for\|function\)\s*()$' || line =~ '\<else$' || line =~ '<-$'
|
||||
if line =~ '\<\(if\|while\|for\|function\)\s*()$' || line =~ '\<else$' || line =~ '<-$' || line =~ '->$'
|
||||
return indent(lnum) + &sw
|
||||
endif
|
||||
|
||||
@@ -344,7 +345,7 @@ function GetRIndent()
|
||||
endif
|
||||
|
||||
let post_block = 0
|
||||
if line =~ '}$'
|
||||
if line =~ '}$' && s:Get_paren_balance(line, '{', '}') < 0
|
||||
let lnum = s:Get_matching_brace(lnum, '{', '}', 0)
|
||||
let line = SanitizeRLine(getline(lnum))
|
||||
if lnum > 0 && line =~ '^\s*{'
|
||||
@@ -359,14 +360,14 @@ function GetRIndent()
|
||||
let olnum = s:Get_prev_line(lnum)
|
||||
let oline = getline(olnum)
|
||||
if olnum > 0
|
||||
if line =~ g:r_indent_op_pattern
|
||||
if oline =~ g:r_indent_op_pattern
|
||||
if line =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
|
||||
if oline =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
|
||||
return indent(lnum)
|
||||
else
|
||||
return indent(lnum) + &sw
|
||||
endif
|
||||
else
|
||||
if oline =~ g:r_indent_op_pattern
|
||||
if oline =~ g:r_indent_op_pattern && s:Get_paren_balance(line, "(", ")") == 0
|
||||
return indent(lnum) - &sw
|
||||
endif
|
||||
endif
|
||||
@@ -471,7 +472,6 @@ function GetRIndent()
|
||||
endif
|
||||
|
||||
let ind = indent(lnum)
|
||||
let pind = indent(plnum)
|
||||
|
||||
if g:r_indent_align_args == 0 && pb != 0
|
||||
let ind += pb * &sw
|
||||
@@ -483,6 +483,12 @@ function GetRIndent()
|
||||
return ind
|
||||
endif
|
||||
|
||||
if plnum > 0
|
||||
let pind = indent(plnum)
|
||||
else
|
||||
let pind = 0
|
||||
endif
|
||||
|
||||
if ind == pind || (ind == (pind + &sw) && pline =~ '{$' && ppost_else == 0)
|
||||
return ind
|
||||
endif
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
" Vim indent file
|
||||
" Language: R Documentation (Help), *.Rd
|
||||
" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
|
||||
" Last Change: Thu Oct 16, 2014 07:07AM
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Tue Apr 07, 2015 04:38PM
|
||||
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
" Vim indent file
|
||||
" Language: Rmd
|
||||
" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
|
||||
" Last Change: Thu Jul 10, 2014 07:11PM
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Tue Apr 07, 2015 04:38PM
|
||||
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
" Vim indent file
|
||||
" Language: Rnoweb
|
||||
" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
|
||||
" Last Change: Sun Mar 22, 2015 09:28AM
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Tue Apr 07, 2015 04:38PM
|
||||
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
" Vim indent file
|
||||
" Language: Rrst
|
||||
" Author: Jakson Alves de Aquino <jalvesaq@gmail.com>
|
||||
" Last Change: Wed Jul 09, 2014 07:33PM
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Tue Apr 07, 2015 04:38PM
|
||||
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
" Language: LaTeX
|
||||
" Maintainer: YiChao Zhou <broken.zhou AT gmail.com>
|
||||
" Created: Sat, 16 Feb 2002 16:50:19 +0100
|
||||
" Last Change: 2012 Mar 18 19:19:50
|
||||
" Version: 0.7
|
||||
" Please email me if you found something we can do. Bug report and
|
||||
" feature request is welcome.
|
||||
" Version: 0.9.2
|
||||
" Please email me if you found something I can do. Comments, bug report and
|
||||
" feature request are welcome.
|
||||
|
||||
" Last Update: {{{
|
||||
" 25th Sep 2002, by LH :
|
||||
@@ -41,7 +40,7 @@
|
||||
" (*) Trust user when in "verbatim" and "lstlisting"
|
||||
" 2012/03/11 by Zhou Yichao <broken.zhou AT gmail.com>
|
||||
" (*) Modify "&" so that only indent when current line start with
|
||||
" "&".
|
||||
" "&".
|
||||
" 2012/03/12 by Zhou Yichao <broken.zhou AT gmail.com>
|
||||
" (*) Modify indentkeys.
|
||||
" 2012/03/18 by Zhou Yichao <broken.zhou AT gmail.com>
|
||||
@@ -49,6 +48,17 @@
|
||||
" 2013/05/02 by Zhou Yichao <broken.zhou AT gmail.com>
|
||||
" (*) Fix problem about GetTeXIndent checker. Thank Albert Netymk
|
||||
" for reporting this.
|
||||
" 2014/06/23 by Zhou Yichao <broken.zhou AT gmail.com>
|
||||
" (*) Remove the feature g:tex_indent_and because it is buggy.
|
||||
" (*) If there is not any obvious indentation hints, we do not
|
||||
" alert our user's current indentation.
|
||||
" (*) g:tex_indent_brace now only works if the open brace is the
|
||||
" last character of that line.
|
||||
" 2014/08/03 by Zhou Yichao <broken.zhou AT gmail.com>
|
||||
" (*) Indent current line if last line has larger indentation
|
||||
" 2014/08/09 by Zhou Yichao <broken.zhou AT gmail.com>
|
||||
" (*) Add missing return value for s:GetEndIndentation(...)
|
||||
"
|
||||
" }}}
|
||||
|
||||
" Document: {{{
|
||||
@@ -60,7 +70,17 @@
|
||||
" * g:tex_indent_brace
|
||||
"
|
||||
" If this variable is unset or non-zero, it will use smartindent-like style
|
||||
" for "{}" and "[]"
|
||||
" for "{}" and "[]". Now this only works if the open brace is the last
|
||||
" character of that line.
|
||||
"
|
||||
" % Example 1
|
||||
" \usetikzlibrary{
|
||||
" external
|
||||
" }
|
||||
"
|
||||
" % Example 2
|
||||
" \tikzexternalize[
|
||||
" prefix=tikz]
|
||||
"
|
||||
" * g:tex_indent_items
|
||||
"
|
||||
@@ -98,14 +118,6 @@
|
||||
"
|
||||
" A list of environment names. separated with '\|', where no indentation is
|
||||
" required. The default is 'document\|verbatim'.
|
||||
"
|
||||
" * g:tex_indent_and
|
||||
"
|
||||
" If this variable is unset or zero, vim will try to align the line with first
|
||||
" "&". This is pretty useful when you use environment like table or align.
|
||||
" Note that this feature need to search back some line, so vim may become
|
||||
" a little slow.
|
||||
"
|
||||
" }}}
|
||||
|
||||
" Only define the function once
|
||||
@@ -126,8 +138,8 @@ endif
|
||||
if !exists("g:tex_indent_brace")
|
||||
let g:tex_indent_brace = 1
|
||||
endif
|
||||
if !exists("g:tex_indent_and")
|
||||
let g:tex_indent_and = 1
|
||||
if !exists("g:tex_max_scan_line")
|
||||
let g:tex_max_scan_line = 60
|
||||
endif
|
||||
if g:tex_indent_items
|
||||
if !exists("g:tex_itemize_env")
|
||||
@@ -140,10 +152,6 @@ else
|
||||
let g:tex_items = ''
|
||||
endif
|
||||
|
||||
if !exists("g:tex_indent_paretheses")
|
||||
let g:tex_indent_paretheses = 1
|
||||
endif
|
||||
|
||||
if !exists("g:tex_noindent_env")
|
||||
let g:tex_noindent_env = 'document\|verbatim\|lstlisting'
|
||||
endif "}}}
|
||||
@@ -160,6 +168,7 @@ let g:tex_items = '^\s*' . substitute(g:tex_items, '^\(\^\\s\*\)*', '', '')
|
||||
function! GetTeXIndent() " {{{
|
||||
" Find a non-blank line above the current line.
|
||||
let lnum = prevnonblank(v:lnum - 1)
|
||||
let cnum = v:lnum
|
||||
|
||||
" Comment line is not what we need.
|
||||
while lnum != 0 && getline(lnum) =~ '^\s*%'
|
||||
@@ -171,8 +180,8 @@ function! GetTeXIndent() " {{{
|
||||
return 0
|
||||
endif
|
||||
|
||||
let line = substitute(getline(lnum), '%.*', ' ','g') " last line
|
||||
let cline = substitute(getline(v:lnum), '%.*', ' ', 'g') " current line
|
||||
let line = substitute(getline(lnum), '\s*%.*', '','g') " last line
|
||||
let cline = substitute(getline(v:lnum), '\s*%.*', '', 'g') " current line
|
||||
|
||||
" We are in verbatim, so do what our user what.
|
||||
if synIDattr(synID(v:lnum, indent(v:lnum), 1), "name") == "texZone"
|
||||
@@ -183,26 +192,12 @@ function! GetTeXIndent() " {{{
|
||||
end
|
||||
endif
|
||||
|
||||
" You want to align with "&"
|
||||
if g:tex_indent_and
|
||||
" Align only when current line start with "&"
|
||||
if line =~ '&.*\\\\' && cline =~ '^\s*&'
|
||||
return indent(v:lnum) + stridx(line, "&") - stridx(cline, "&")
|
||||
endif
|
||||
|
||||
" set line & lnum to the line which doesn't contain "&"
|
||||
while lnum != 0 && (stridx(line, "&") != -1 || line =~ '^\s*%')
|
||||
let lnum = prevnonblank(lnum - 1)
|
||||
let line = getline(lnum)
|
||||
endwhile
|
||||
endif
|
||||
|
||||
|
||||
if lnum == 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
let ind = indent(lnum)
|
||||
let stay = 1
|
||||
|
||||
" New code for comment: retain the indent of current line
|
||||
if cline =~ '^\s*%'
|
||||
@@ -216,77 +211,197 @@ function! GetTeXIndent() " {{{
|
||||
" ZYC modification : \end after \begin won't cause wrong indent anymore
|
||||
if line =~ '\\begin{.*}' && line !~ g:tex_noindent_env
|
||||
let ind = ind + &sw
|
||||
let stay = 0
|
||||
|
||||
if g:tex_indent_items
|
||||
" Add another sw for item-environments
|
||||
if line =~ g:tex_itemize_env
|
||||
let ind = ind + &sw
|
||||
let stay = 0
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
if cline =~ '\\end{.*}'
|
||||
let retn = s:GetEndIndentation(v:lnum)
|
||||
if retn != -1
|
||||
return retn
|
||||
endif
|
||||
end
|
||||
" Subtract a 'shiftwidth' when an environment ends
|
||||
if cline =~ '\\end{.*}' && cline !~ g:tex_noindent_env
|
||||
|
||||
if cline =~ '\\end{.*}'
|
||||
\ && cline !~ g:tex_noindent_env
|
||||
\ && cline !~ '\\begin{.*}.*\\end{.*}'
|
||||
if g:tex_indent_items
|
||||
" Remove another sw for item-environments
|
||||
if cline =~ g:tex_itemize_env
|
||||
let ind = ind - &sw
|
||||
let stay = 0
|
||||
endif
|
||||
endif
|
||||
|
||||
let ind = ind - &sw
|
||||
let stay = 0
|
||||
endif
|
||||
|
||||
if g:tex_indent_brace
|
||||
let sum1 = 0
|
||||
for i in range(0, strlen(line)-1)
|
||||
if line[i] == "}" || line[i] == "]" ||
|
||||
\ strpart(line, i, 7) == '\right)'
|
||||
let sum1 = max([0, sum1-1])
|
||||
endif
|
||||
if line[i] == "{" || line[i] == "[" ||
|
||||
\ strpart(line, i, 6) == '\left('
|
||||
let sum1 += 1
|
||||
let char = line[strlen(line)-1]
|
||||
if char == '[' || char == '{'
|
||||
let ind += &sw
|
||||
let stay = 0
|
||||
endif
|
||||
|
||||
let cind = indent(v:lnum)
|
||||
let char = cline[cind]
|
||||
if (char == ']' || char == '}') &&
|
||||
\ s:CheckPairedIsLastCharacter(v:lnum, cind)
|
||||
let ind -= &sw
|
||||
let stay = 0
|
||||
endif
|
||||
|
||||
for i in range(indent(lnum)+1, strlen(line)-1)
|
||||
let char = line[i]
|
||||
if char == ']' || char == '}'
|
||||
if s:CheckPairedIsLastCharacter(lnum, i)
|
||||
let ind -= &sw
|
||||
let stay = 0
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
|
||||
let sum2 = 0
|
||||
for i in reverse(range(0, strlen(cline)-1))
|
||||
if cline[i] == "{" || cline[i] == "[" ||
|
||||
\ strpart(cline, i, 6) == '\left('
|
||||
let sum2 = max([0, sum2-1])
|
||||
endif
|
||||
if cline[i] == "}" || cline[i] == "]" ||
|
||||
\ strpart(cline, i, 7) == '\right)'
|
||||
let sum2 += 1
|
||||
endif
|
||||
endfor
|
||||
|
||||
let ind += (sum1 - sum2) * &sw
|
||||
endif
|
||||
|
||||
if g:tex_indent_paretheses
|
||||
endif
|
||||
|
||||
" Special treatment for 'item'
|
||||
" ----------------------------
|
||||
|
||||
if g:tex_indent_items
|
||||
|
||||
" '\item' or '\bibitem' itself:
|
||||
if cline =~ g:tex_items
|
||||
let ind = ind - &sw
|
||||
let stay = 0
|
||||
endif
|
||||
|
||||
" lines following to '\item' are intented once again:
|
||||
if line =~ g:tex_items
|
||||
let ind = ind + &sw
|
||||
let stay = 0
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
return ind
|
||||
if stay
|
||||
" If there is no obvious indentation hint, we trust our user.
|
||||
if empty(cline)
|
||||
return ind
|
||||
else
|
||||
return max([indent(v:lnum), s:GetLastBeginIndentation(v:lnum)])
|
||||
endif
|
||||
else
|
||||
return ind
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
function! s:GetLastBeginIndentation(lnum) " {{{
|
||||
let matchend = 1
|
||||
for lnum in range(a:lnum-1, max([a:lnum - g:tex_max_scan_line, 1]), -1)
|
||||
let line = getline(lnum)
|
||||
if line =~ '\\end{.*}'
|
||||
let matchend += 1
|
||||
endif
|
||||
if line =~ '\\begin{.*}'
|
||||
let matchend -= 1
|
||||
endif
|
||||
if matchend == 0
|
||||
if line =~ g:tex_itemize_env
|
||||
return indent(lnum) + 2 * &sw
|
||||
endif
|
||||
if line =~ g:tex_noindent_env
|
||||
return indent(lnum)
|
||||
endif
|
||||
return indent(lnum) + &sw
|
||||
endif
|
||||
endfor
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
function! s:GetEndIndentation(lnum) " {{{
|
||||
if getline(a:lnum) =~ '\\begin{.*}.*\\end{.*}'
|
||||
return -1
|
||||
endif
|
||||
|
||||
let min_indent = 100
|
||||
let matchend = 1
|
||||
for lnum in range(a:lnum-1, max([a:lnum-g:tex_max_scan_line, 1]), -1)
|
||||
let line = getline(lnum)
|
||||
if line =~ '\\end{.*}'
|
||||
let matchend += 1
|
||||
endif
|
||||
if line =~ '\\begin{.*}'
|
||||
let matchend -= 1
|
||||
endif
|
||||
if matchend == 0
|
||||
return indent(lnum)
|
||||
endif
|
||||
if !empty(line)
|
||||
let min_indent = min([min_indent, indent(lnum)])
|
||||
endif
|
||||
endfor
|
||||
return min_indent - &sw
|
||||
endfunction
|
||||
|
||||
" Most of the code is from matchparen.vim
|
||||
function! s:CheckPairedIsLastCharacter(lnum, col) "{{{
|
||||
" Get the character under the cursor and check if it's in 'matchpairs'.
|
||||
let c_lnum = a:lnum
|
||||
let c_col = a:col+1
|
||||
|
||||
|
||||
let c = getline(c_lnum)[c_col-1]
|
||||
let plist = split(&matchpairs, '.\zs[:,]')
|
||||
let i = index(plist, c)
|
||||
if i < 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
" Figure out the arguments for searchpairpos().
|
||||
if i % 2 == 0
|
||||
let s_flags = 'nW'
|
||||
let c2 = plist[i + 1]
|
||||
else
|
||||
let s_flags = 'nbW'
|
||||
let c2 = c
|
||||
let c = plist[i - 1]
|
||||
endif
|
||||
if c == '['
|
||||
let c = '\['
|
||||
let c2 = '\]'
|
||||
endif
|
||||
|
||||
" Find the match. When it was just before the cursor move it there for a
|
||||
" moment.
|
||||
let save_cursor = winsaveview()
|
||||
call cursor(c_lnum, c_col)
|
||||
|
||||
" When not in a string or comment ignore matches inside them.
|
||||
" We match "escape" for special items, such as lispEscapeSpecial.
|
||||
let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' .
|
||||
\ '=~? "string\\|character\\|singlequote\\|escape\\|comment"'
|
||||
execute 'if' s_skip '| let s_skip = 0 | endif'
|
||||
|
||||
let stopline = max([0, c_lnum - g:tex_max_scan_line])
|
||||
|
||||
" Limit the search time to 300 msec to avoid a hang on very long lines.
|
||||
" This fails when a timeout is not supported.
|
||||
try
|
||||
let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline, 100)
|
||||
catch /E118/
|
||||
endtry
|
||||
|
||||
call winrestview(save_cursor)
|
||||
|
||||
if m_lnum > 0
|
||||
let line = getline(m_lnum)
|
||||
return strlen(line) == m_col
|
||||
endif
|
||||
|
||||
return 0
|
||||
endfunction "}}}
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
|
||||
@@ -15,8 +15,6 @@ dvorak for when you use a Dvorak keyboard
|
||||
|
||||
justify.vim user function for justifying text
|
||||
|
||||
matchit.vim + matchit.txt make % match if-fi, HTML tags, and much more
|
||||
|
||||
less.sh + less.vim make Vim work like less (or more)
|
||||
|
||||
shellmenu.vim menus for editing shell scripts in the GUI version
|
||||
@@ -26,5 +24,9 @@ swapmous.vim swap left and right mouse buttons
|
||||
editexisting.vim when editing a file that is already edited with
|
||||
another Vim instance
|
||||
|
||||
This one is only for Unix. It can be found in the extra archive:
|
||||
This one is only for Unix.
|
||||
file_select.vim macros that make a handy file selector
|
||||
|
||||
The matchit plugin has been moved to an optional package. To load it put this
|
||||
line in your vimrc file:
|
||||
:packadd matchit
|
||||
|
||||
@@ -1,813 +1,3 @@
|
||||
" matchit.vim: (global plugin) Extended "%" matching
|
||||
" Last Change: Fri Jan 25 10:00 AM 2008 EST
|
||||
" Maintainer: Benji Fisher PhD <benji@member.AMS.org>
|
||||
" Version: 1.13.2, for Vim 6.3+
|
||||
" URL: http://www.vim.org/script.php?script_id=39
|
||||
|
||||
" Documentation:
|
||||
" The documentation is in a separate file, matchit.txt .
|
||||
|
||||
" Credits:
|
||||
" Vim editor by Bram Moolenaar (Thanks, Bram!)
|
||||
" Original script and design by Raul Segura Acevedo
|
||||
" Support for comments by Douglas Potts
|
||||
" Support for back references and other improvements by Benji Fisher
|
||||
" Support for many languages by Johannes Zellner
|
||||
" Suggestions for improvement, bug reports, and support for additional
|
||||
" languages by Jordi-Albert Batalla, Neil Bird, Servatius Brandt, Mark
|
||||
" Collett, Stephen Wall, Dany St-Amant, Yuheng Xie, and Johannes Zellner.
|
||||
|
||||
" Debugging:
|
||||
" If you'd like to try the built-in debugging commands...
|
||||
" :MatchDebug to activate debugging for the current buffer
|
||||
" This saves the values of several key script variables as buffer-local
|
||||
" variables. See the MatchDebug() function, below, for details.
|
||||
|
||||
" TODO: I should think about multi-line patterns for b:match_words.
|
||||
" This would require an option: how many lines to scan (default 1).
|
||||
" This would be useful for Python, maybe also for *ML.
|
||||
" TODO: Maybe I should add a menu so that people will actually use some of
|
||||
" the features that I have implemented.
|
||||
" TODO: Eliminate the MultiMatch function. Add yet another argument to
|
||||
" Match_wrapper() instead.
|
||||
" TODO: Allow :let b:match_words = '\(\(foo\)\(bar\)\):\3\2:end\1'
|
||||
" TODO: Make backrefs safer by using '\V' (very no-magic).
|
||||
" TODO: Add a level of indirection, so that custom % scripts can use my
|
||||
" work but extend it.
|
||||
|
||||
" allow user to prevent loading
|
||||
" and prevent duplicate loading
|
||||
if exists("loaded_matchit") || &cp
|
||||
finish
|
||||
endif
|
||||
let loaded_matchit = 1
|
||||
let s:last_mps = ""
|
||||
let s:last_words = ":"
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
nnoremap <silent> % :<C-U>call <SID>Match_wrapper('',1,'n') <CR>
|
||||
nnoremap <silent> g% :<C-U>call <SID>Match_wrapper('',0,'n') <CR>
|
||||
vnoremap <silent> % :<C-U>call <SID>Match_wrapper('',1,'v') <CR>m'gv``
|
||||
vnoremap <silent> g% :<C-U>call <SID>Match_wrapper('',0,'v') <CR>m'gv``
|
||||
onoremap <silent> % v:<C-U>call <SID>Match_wrapper('',1,'o') <CR>
|
||||
onoremap <silent> g% v:<C-U>call <SID>Match_wrapper('',0,'o') <CR>
|
||||
|
||||
" Analogues of [{ and ]} using matching patterns:
|
||||
nnoremap <silent> [% :<C-U>call <SID>MultiMatch("bW", "n") <CR>
|
||||
nnoremap <silent> ]% :<C-U>call <SID>MultiMatch("W", "n") <CR>
|
||||
vmap [% <Esc>[%m'gv``
|
||||
vmap ]% <Esc>]%m'gv``
|
||||
" vnoremap <silent> [% :<C-U>call <SID>MultiMatch("bW", "v") <CR>m'gv``
|
||||
" vnoremap <silent> ]% :<C-U>call <SID>MultiMatch("W", "v") <CR>m'gv``
|
||||
onoremap <silent> [% v:<C-U>call <SID>MultiMatch("bW", "o") <CR>
|
||||
onoremap <silent> ]% v:<C-U>call <SID>MultiMatch("W", "o") <CR>
|
||||
|
||||
" text object:
|
||||
vmap a% <Esc>[%v]%
|
||||
|
||||
" Auto-complete mappings: (not yet "ready for prime time")
|
||||
" TODO Read :help write-plugin for the "right" way to let the user
|
||||
" specify a key binding.
|
||||
" let g:match_auto = '<C-]>'
|
||||
" let g:match_autoCR = '<C-CR>'
|
||||
" if exists("g:match_auto")
|
||||
" execute "inoremap " . g:match_auto . ' x<Esc>"=<SID>Autocomplete()<CR>Pls'
|
||||
" endif
|
||||
" if exists("g:match_autoCR")
|
||||
" execute "inoremap " . g:match_autoCR . ' <CR><C-R>=<SID>Autocomplete()<CR>'
|
||||
" endif
|
||||
" if exists("g:match_gthhoh")
|
||||
" execute "inoremap " . g:match_gthhoh . ' <C-O>:call <SID>Gthhoh()<CR>'
|
||||
" endif " gthhoh = "Get the heck out of here!"
|
||||
|
||||
let s:notslash = '\\\@<!\%(\\\\\)*'
|
||||
|
||||
function! s:Match_wrapper(word, forward, mode) range
|
||||
" In s:CleanUp(), :execute "set" restore_options .
|
||||
let restore_options = (&ic ? " " : " no") . "ignorecase"
|
||||
if exists("b:match_ignorecase")
|
||||
let &ignorecase = b:match_ignorecase
|
||||
endif
|
||||
let restore_options = " ve=" . &ve . restore_options
|
||||
set ve=
|
||||
" If this function was called from Visual mode, make sure that the cursor
|
||||
" is at the correct end of the Visual range:
|
||||
if a:mode == "v"
|
||||
execute "normal! gv\<Esc>"
|
||||
endif
|
||||
" In s:CleanUp(), we may need to check whether the cursor moved forward.
|
||||
let startline = line(".")
|
||||
let startcol = col(".")
|
||||
" Use default behavior if called with a count.
|
||||
if v:count
|
||||
exe "normal! " . v:count . "%"
|
||||
return s:CleanUp(restore_options, a:mode, startline, startcol)
|
||||
end
|
||||
|
||||
" First step: if not already done, set the script variables
|
||||
" s:do_BR flag for whether there are backrefs
|
||||
" s:pat parsed version of b:match_words
|
||||
" s:all regexp based on s:pat and the default groups
|
||||
"
|
||||
if !exists("b:match_words") || b:match_words == ""
|
||||
let match_words = ""
|
||||
" Allow b:match_words = "GetVimMatchWords()" .
|
||||
elseif b:match_words =~ ":"
|
||||
let match_words = b:match_words
|
||||
else
|
||||
execute "let match_words =" b:match_words
|
||||
endif
|
||||
" Thanks to Preben "Peppe" Guldberg and Bram Moolenaar for this suggestion!
|
||||
if (match_words != s:last_words) || (&mps != s:last_mps) ||
|
||||
\ exists("b:match_debug")
|
||||
let s:last_words = match_words
|
||||
let s:last_mps = &mps
|
||||
" The next several lines were here before
|
||||
" BF started messing with this script.
|
||||
" quote the special chars in 'matchpairs', replace [,:] with \| and then
|
||||
" append the builtin pairs (/*, */, #if, #ifdef, #else, #elif, #endif)
|
||||
" let default = substitute(escape(&mps, '[$^.*~\\/?]'), '[,:]\+',
|
||||
" \ '\\|', 'g').'\|\/\*\|\*\/\|#if\>\|#ifdef\>\|#else\>\|#elif\>\|#endif\>'
|
||||
let default = escape(&mps, '[$^.*~\\/?]') . (strlen(&mps) ? "," : "") .
|
||||
\ '\/\*:\*\/,#\s*if\%(def\)\=:#\s*else\>:#\s*elif\>:#\s*endif\>'
|
||||
" s:all = pattern with all the keywords
|
||||
let match_words = match_words . (strlen(match_words) ? "," : "") . default
|
||||
if match_words !~ s:notslash . '\\\d'
|
||||
let s:do_BR = 0
|
||||
let s:pat = match_words
|
||||
else
|
||||
let s:do_BR = 1
|
||||
let s:pat = s:ParseWords(match_words)
|
||||
endif
|
||||
let s:all = substitute(s:pat, s:notslash . '\zs[,:]\+', '\\|', 'g')
|
||||
let s:all = '\%(' . s:all . '\)'
|
||||
" let s:all = '\%(' . substitute(s:all, '\\\ze[,:]', '', 'g') . '\)'
|
||||
if exists("b:match_debug")
|
||||
let b:match_pat = s:pat
|
||||
endif
|
||||
endif
|
||||
|
||||
" Second step: set the following local variables:
|
||||
" matchline = line on which the cursor started
|
||||
" curcol = number of characters before match
|
||||
" prefix = regexp for start of line to start of match
|
||||
" suffix = regexp for end of match to end of line
|
||||
" Require match to end on or after the cursor and prefer it to
|
||||
" start on or before the cursor.
|
||||
let matchline = getline(startline)
|
||||
if a:word != ''
|
||||
" word given
|
||||
if a:word !~ s:all
|
||||
echohl WarningMsg|echo 'Missing rule for word:"'.a:word.'"'|echohl NONE
|
||||
return s:CleanUp(restore_options, a:mode, startline, startcol)
|
||||
endif
|
||||
let matchline = a:word
|
||||
let curcol = 0
|
||||
let prefix = '^\%('
|
||||
let suffix = '\)$'
|
||||
" Now the case when "word" is not given
|
||||
else " Find the match that ends on or after the cursor and set curcol.
|
||||
let regexp = s:Wholematch(matchline, s:all, startcol-1)
|
||||
let curcol = match(matchline, regexp)
|
||||
" If there is no match, give up.
|
||||
if curcol == -1
|
||||
return s:CleanUp(restore_options, a:mode, startline, startcol)
|
||||
endif
|
||||
let endcol = matchend(matchline, regexp)
|
||||
let suf = strlen(matchline) - endcol
|
||||
let prefix = (curcol ? '^.*\%' . (curcol + 1) . 'c\%(' : '^\%(')
|
||||
let suffix = (suf ? '\)\%' . (endcol + 1) . 'c.*$' : '\)$')
|
||||
endif
|
||||
if exists("b:match_debug")
|
||||
let b:match_match = matchstr(matchline, regexp)
|
||||
let b:match_col = curcol+1
|
||||
endif
|
||||
|
||||
" Third step: Find the group and single word that match, and the original
|
||||
" (backref) versions of these. Then, resolve the backrefs.
|
||||
" Set the following local variable:
|
||||
" group = colon-separated list of patterns, one of which matches
|
||||
" = ini:mid:fin or ini:fin
|
||||
"
|
||||
" Reconstruct the version with unresolved backrefs.
|
||||
let patBR = substitute(match_words.',',
|
||||
\ s:notslash.'\zs[,:]*,[,:]*', ',', 'g')
|
||||
let patBR = substitute(patBR, s:notslash.'\zs:\{2,}', ':', 'g')
|
||||
" Now, set group and groupBR to the matching group: 'if:endif' or
|
||||
" 'while:endwhile' or whatever. A bit of a kluge: s:Choose() returns
|
||||
" group . "," . groupBR, and we pick it apart.
|
||||
let group = s:Choose(s:pat, matchline, ",", ":", prefix, suffix, patBR)
|
||||
let i = matchend(group, s:notslash . ",")
|
||||
let groupBR = strpart(group, i)
|
||||
let group = strpart(group, 0, i-1)
|
||||
" Now, matchline =~ prefix . substitute(group,':','\|','g') . suffix
|
||||
if s:do_BR " Do the hard part: resolve those backrefs!
|
||||
let group = s:InsertRefs(groupBR, prefix, group, suffix, matchline)
|
||||
endif
|
||||
if exists("b:match_debug")
|
||||
let b:match_wholeBR = groupBR
|
||||
let i = matchend(groupBR, s:notslash . ":")
|
||||
let b:match_iniBR = strpart(groupBR, 0, i-1)
|
||||
endif
|
||||
|
||||
" Fourth step: Set the arguments for searchpair().
|
||||
let i = matchend(group, s:notslash . ":")
|
||||
let j = matchend(group, '.*' . s:notslash . ":")
|
||||
let ini = strpart(group, 0, i-1)
|
||||
let mid = substitute(strpart(group, i,j-i-1), s:notslash.'\zs:', '\\|', 'g')
|
||||
let fin = strpart(group, j)
|
||||
"Un-escape the remaining , and : characters.
|
||||
let ini = substitute(ini, s:notslash . '\zs\\\(:\|,\)', '\1', 'g')
|
||||
let mid = substitute(mid, s:notslash . '\zs\\\(:\|,\)', '\1', 'g')
|
||||
let fin = substitute(fin, s:notslash . '\zs\\\(:\|,\)', '\1', 'g')
|
||||
" searchpair() requires that these patterns avoid \(\) groups.
|
||||
let ini = substitute(ini, s:notslash . '\zs\\(', '\\%(', 'g')
|
||||
let mid = substitute(mid, s:notslash . '\zs\\(', '\\%(', 'g')
|
||||
let fin = substitute(fin, s:notslash . '\zs\\(', '\\%(', 'g')
|
||||
" Set mid. This is optimized for readability, not micro-efficiency!
|
||||
if a:forward && matchline =~ prefix . fin . suffix
|
||||
\ || !a:forward && matchline =~ prefix . ini . suffix
|
||||
let mid = ""
|
||||
endif
|
||||
" Set flag. This is optimized for readability, not micro-efficiency!
|
||||
if a:forward && matchline =~ prefix . fin . suffix
|
||||
\ || !a:forward && matchline !~ prefix . ini . suffix
|
||||
let flag = "bW"
|
||||
else
|
||||
let flag = "W"
|
||||
endif
|
||||
" Set skip.
|
||||
if exists("b:match_skip")
|
||||
let skip = b:match_skip
|
||||
elseif exists("b:match_comment") " backwards compatibility and testing!
|
||||
let skip = "r:" . b:match_comment
|
||||
else
|
||||
let skip = 's:comment\|string'
|
||||
endif
|
||||
let skip = s:ParseSkip(skip)
|
||||
if exists("b:match_debug")
|
||||
let b:match_ini = ini
|
||||
let b:match_tail = (strlen(mid) ? mid.'\|' : '') . fin
|
||||
endif
|
||||
|
||||
" Fifth step: actually start moving the cursor and call searchpair().
|
||||
" Later, :execute restore_cursor to get to the original screen.
|
||||
let restore_cursor = virtcol(".") . "|"
|
||||
normal! g0
|
||||
let restore_cursor = line(".") . "G" . virtcol(".") . "|zs" . restore_cursor
|
||||
normal! H
|
||||
let restore_cursor = "normal!" . line(".") . "Gzt" . restore_cursor
|
||||
execute restore_cursor
|
||||
call cursor(0, curcol + 1)
|
||||
" normal! 0
|
||||
" if curcol
|
||||
" execute "normal!" . curcol . "l"
|
||||
" endif
|
||||
if skip =~ 'synID' && !(has("syntax") && exists("g:syntax_on"))
|
||||
let skip = "0"
|
||||
else
|
||||
execute "if " . skip . "| let skip = '0' | endif"
|
||||
endif
|
||||
let sp_return = searchpair(ini, mid, fin, flag, skip)
|
||||
let final_position = "call cursor(" . line(".") . "," . col(".") . ")"
|
||||
" Restore cursor position and original screen.
|
||||
execute restore_cursor
|
||||
normal! m'
|
||||
if sp_return > 0
|
||||
execute final_position
|
||||
endif
|
||||
return s:CleanUp(restore_options, a:mode, startline, startcol, mid.'\|'.fin)
|
||||
endfun
|
||||
|
||||
" Restore options and do some special handling for Operator-pending mode.
|
||||
" The optional argument is the tail of the matching group.
|
||||
fun! s:CleanUp(options, mode, startline, startcol, ...)
|
||||
execute "set" a:options
|
||||
" Open folds, if appropriate.
|
||||
if a:mode != "o"
|
||||
if &foldopen =~ "percent"
|
||||
normal! zv
|
||||
endif
|
||||
" In Operator-pending mode, we want to include the whole match
|
||||
" (for example, d%).
|
||||
" This is only a problem if we end up moving in the forward direction.
|
||||
elseif (a:startline < line(".")) ||
|
||||
\ (a:startline == line(".") && a:startcol < col("."))
|
||||
if a:0
|
||||
" Check whether the match is a single character. If not, move to the
|
||||
" end of the match.
|
||||
let matchline = getline(".")
|
||||
let currcol = col(".")
|
||||
let regexp = s:Wholematch(matchline, a:1, currcol-1)
|
||||
let endcol = matchend(matchline, regexp)
|
||||
if endcol > currcol " This is NOT off by one!
|
||||
call cursor(0, endcol)
|
||||
endif
|
||||
endif " a:0
|
||||
endif " a:mode != "o" && etc.
|
||||
return 0
|
||||
endfun
|
||||
|
||||
" Example (simplified HTML patterns): if
|
||||
" a:groupBR = '<\(\k\+\)>:</\1>'
|
||||
" a:prefix = '^.\{3}\('
|
||||
" a:group = '<\(\k\+\)>:</\(\k\+\)>'
|
||||
" a:suffix = '\).\{2}$'
|
||||
" a:matchline = "123<tag>12" or "123</tag>12"
|
||||
" then extract "tag" from a:matchline and return "<tag>:</tag>" .
|
||||
fun! s:InsertRefs(groupBR, prefix, group, suffix, matchline)
|
||||
if a:matchline !~ a:prefix .
|
||||
\ substitute(a:group, s:notslash . '\zs:', '\\|', 'g') . a:suffix
|
||||
return a:group
|
||||
endif
|
||||
let i = matchend(a:groupBR, s:notslash . ':')
|
||||
let ini = strpart(a:groupBR, 0, i-1)
|
||||
let tailBR = strpart(a:groupBR, i)
|
||||
let word = s:Choose(a:group, a:matchline, ":", "", a:prefix, a:suffix,
|
||||
\ a:groupBR)
|
||||
let i = matchend(word, s:notslash . ":")
|
||||
let wordBR = strpart(word, i)
|
||||
let word = strpart(word, 0, i-1)
|
||||
" Now, a:matchline =~ a:prefix . word . a:suffix
|
||||
if wordBR != ini
|
||||
let table = s:Resolve(ini, wordBR, "table")
|
||||
else
|
||||
" let table = "----------"
|
||||
let table = ""
|
||||
let d = 0
|
||||
while d < 10
|
||||
if tailBR =~ s:notslash . '\\' . d
|
||||
" let table[d] = d
|
||||
let table = table . d
|
||||
else
|
||||
let table = table . "-"
|
||||
endif
|
||||
let d = d + 1
|
||||
endwhile
|
||||
endif
|
||||
let d = 9
|
||||
while d
|
||||
if table[d] != "-"
|
||||
let backref = substitute(a:matchline, a:prefix.word.a:suffix,
|
||||
\ '\'.table[d], "")
|
||||
" Are there any other characters that should be escaped?
|
||||
let backref = escape(backref, '*,:')
|
||||
execute s:Ref(ini, d, "start", "len")
|
||||
let ini = strpart(ini, 0, start) . backref . strpart(ini, start+len)
|
||||
let tailBR = substitute(tailBR, s:notslash . '\zs\\' . d,
|
||||
\ escape(backref, '\\&'), 'g')
|
||||
endif
|
||||
let d = d-1
|
||||
endwhile
|
||||
if exists("b:match_debug")
|
||||
if s:do_BR
|
||||
let b:match_table = table
|
||||
let b:match_word = word
|
||||
else
|
||||
let b:match_table = ""
|
||||
let b:match_word = ""
|
||||
endif
|
||||
endif
|
||||
return ini . ":" . tailBR
|
||||
endfun
|
||||
|
||||
" Input a comma-separated list of groups with backrefs, such as
|
||||
" a:groups = '\(foo\):end\1,\(bar\):end\1'
|
||||
" and return a comma-separated list of groups with backrefs replaced:
|
||||
" return '\(foo\):end\(foo\),\(bar\):end\(bar\)'
|
||||
fun! s:ParseWords(groups)
|
||||
let groups = substitute(a:groups.",", s:notslash.'\zs[,:]*,[,:]*', ',', 'g')
|
||||
let groups = substitute(groups, s:notslash . '\zs:\{2,}', ':', 'g')
|
||||
let parsed = ""
|
||||
while groups =~ '[^,:]'
|
||||
let i = matchend(groups, s:notslash . ':')
|
||||
let j = matchend(groups, s:notslash . ',')
|
||||
let ini = strpart(groups, 0, i-1)
|
||||
let tail = strpart(groups, i, j-i-1) . ":"
|
||||
let groups = strpart(groups, j)
|
||||
let parsed = parsed . ini
|
||||
let i = matchend(tail, s:notslash . ':')
|
||||
while i != -1
|
||||
" In 'if:else:endif', ini='if' and word='else' and then word='endif'.
|
||||
let word = strpart(tail, 0, i-1)
|
||||
let tail = strpart(tail, i)
|
||||
let i = matchend(tail, s:notslash . ':')
|
||||
let parsed = parsed . ":" . s:Resolve(ini, word, "word")
|
||||
endwhile " Now, tail has been used up.
|
||||
let parsed = parsed . ","
|
||||
endwhile " groups =~ '[^,:]'
|
||||
let parsed = substitute(parsed, ',$', '', '')
|
||||
return parsed
|
||||
endfun
|
||||
|
||||
" TODO I think this can be simplified and/or made more efficient.
|
||||
" TODO What should I do if a:start is out of range?
|
||||
" Return a regexp that matches all of a:string, such that
|
||||
" matchstr(a:string, regexp) represents the match for a:pat that starts
|
||||
" as close to a:start as possible, before being preferred to after, and
|
||||
" ends after a:start .
|
||||
" Usage:
|
||||
" let regexp = s:Wholematch(getline("."), 'foo\|bar', col(".")-1)
|
||||
" let i = match(getline("."), regexp)
|
||||
" let j = matchend(getline("."), regexp)
|
||||
" let match = matchstr(getline("."), regexp)
|
||||
fun! s:Wholematch(string, pat, start)
|
||||
let group = '\%(' . a:pat . '\)'
|
||||
let prefix = (a:start ? '\(^.*\%<' . (a:start + 2) . 'c\)\zs' : '^')
|
||||
let len = strlen(a:string)
|
||||
let suffix = (a:start+1 < len ? '\(\%>'.(a:start+1).'c.*$\)\@=' : '$')
|
||||
if a:string !~ prefix . group . suffix
|
||||
let prefix = ''
|
||||
endif
|
||||
return prefix . group . suffix
|
||||
endfun
|
||||
|
||||
" No extra arguments: s:Ref(string, d) will
|
||||
" find the d'th occurrence of '\(' and return it, along with everything up
|
||||
" to and including the matching '\)'.
|
||||
" One argument: s:Ref(string, d, "start") returns the index of the start
|
||||
" of the d'th '\(' and any other argument returns the length of the group.
|
||||
" Two arguments: s:Ref(string, d, "foo", "bar") returns a string to be
|
||||
" executed, having the effect of
|
||||
" :let foo = s:Ref(string, d, "start")
|
||||
" :let bar = s:Ref(string, d, "len")
|
||||
fun! s:Ref(string, d, ...)
|
||||
let len = strlen(a:string)
|
||||
if a:d == 0
|
||||
let start = 0
|
||||
else
|
||||
let cnt = a:d
|
||||
let match = a:string
|
||||
while cnt
|
||||
let cnt = cnt - 1
|
||||
let index = matchend(match, s:notslash . '\\(')
|
||||
if index == -1
|
||||
return ""
|
||||
endif
|
||||
let match = strpart(match, index)
|
||||
endwhile
|
||||
let start = len - strlen(match)
|
||||
if a:0 == 1 && a:1 == "start"
|
||||
return start - 2
|
||||
endif
|
||||
let cnt = 1
|
||||
while cnt
|
||||
let index = matchend(match, s:notslash . '\\(\|\\)') - 1
|
||||
if index == -2
|
||||
return ""
|
||||
endif
|
||||
" Increment if an open, decrement if a ')':
|
||||
let cnt = cnt + (match[index]=="(" ? 1 : -1) " ')'
|
||||
" let cnt = stridx('0(', match[index]) + cnt
|
||||
let match = strpart(match, index+1)
|
||||
endwhile
|
||||
let start = start - 2
|
||||
let len = len - start - strlen(match)
|
||||
endif
|
||||
if a:0 == 1
|
||||
return len
|
||||
elseif a:0 == 2
|
||||
return "let " . a:1 . "=" . start . "| let " . a:2 . "=" . len
|
||||
else
|
||||
return strpart(a:string, start, len)
|
||||
endif
|
||||
endfun
|
||||
|
||||
" Count the number of disjoint copies of pattern in string.
|
||||
" If the pattern is a literal string and contains no '0' or '1' characters
|
||||
" then s:Count(string, pattern, '0', '1') should be faster than
|
||||
" s:Count(string, pattern).
|
||||
fun! s:Count(string, pattern, ...)
|
||||
let pat = escape(a:pattern, '\\')
|
||||
if a:0 > 1
|
||||
let foo = substitute(a:string, '[^'.a:pattern.']', "a:1", "g")
|
||||
let foo = substitute(a:string, pat, a:2, "g")
|
||||
let foo = substitute(foo, '[^' . a:2 . ']', "", "g")
|
||||
return strlen(foo)
|
||||
endif
|
||||
let result = 0
|
||||
let foo = a:string
|
||||
let index = matchend(foo, pat)
|
||||
while index != -1
|
||||
let result = result + 1
|
||||
let foo = strpart(foo, index)
|
||||
let index = matchend(foo, pat)
|
||||
endwhile
|
||||
return result
|
||||
endfun
|
||||
|
||||
" s:Resolve('\(a\)\(b\)', '\(c\)\2\1\1\2') should return table.word, where
|
||||
" word = '\(c\)\(b\)\(a\)\3\2' and table = '-32-------'. That is, the first
|
||||
" '\1' in target is replaced by '\(a\)' in word, table[1] = 3, and this
|
||||
" indicates that all other instances of '\1' in target are to be replaced
|
||||
" by '\3'. The hard part is dealing with nesting...
|
||||
" Note that ":" is an illegal character for source and target,
|
||||
" unless it is preceded by "\".
|
||||
fun! s:Resolve(source, target, output)
|
||||
let word = a:target
|
||||
let i = matchend(word, s:notslash . '\\\d') - 1
|
||||
let table = "----------"
|
||||
while i != -2 " There are back references to be replaced.
|
||||
let d = word[i]
|
||||
let backref = s:Ref(a:source, d)
|
||||
" The idea is to replace '\d' with backref. Before we do this,
|
||||
" replace any \(\) groups in backref with :1, :2, ... if they
|
||||
" correspond to the first, second, ... group already inserted
|
||||
" into backref. Later, replace :1 with \1 and so on. The group
|
||||
" number w+b within backref corresponds to the group number
|
||||
" s within a:source.
|
||||
" w = number of '\(' in word before the current one
|
||||
let w = s:Count(
|
||||
\ substitute(strpart(word, 0, i-1), '\\\\', '', 'g'), '\(', '1')
|
||||
let b = 1 " number of the current '\(' in backref
|
||||
let s = d " number of the current '\(' in a:source
|
||||
while b <= s:Count(substitute(backref, '\\\\', '', 'g'), '\(', '1')
|
||||
\ && s < 10
|
||||
if table[s] == "-"
|
||||
if w + b < 10
|
||||
" let table[s] = w + b
|
||||
let table = strpart(table, 0, s) . (w+b) . strpart(table, s+1)
|
||||
endif
|
||||
let b = b + 1
|
||||
let s = s + 1
|
||||
else
|
||||
execute s:Ref(backref, b, "start", "len")
|
||||
let ref = strpart(backref, start, len)
|
||||
let backref = strpart(backref, 0, start) . ":". table[s]
|
||||
\ . strpart(backref, start+len)
|
||||
let s = s + s:Count(substitute(ref, '\\\\', '', 'g'), '\(', '1')
|
||||
endif
|
||||
endwhile
|
||||
let word = strpart(word, 0, i-1) . backref . strpart(word, i+1)
|
||||
let i = matchend(word, s:notslash . '\\\d') - 1
|
||||
endwhile
|
||||
let word = substitute(word, s:notslash . '\zs:', '\\', 'g')
|
||||
if a:output == "table"
|
||||
return table
|
||||
elseif a:output == "word"
|
||||
return word
|
||||
else
|
||||
return table . word
|
||||
endif
|
||||
endfun
|
||||
|
||||
" Assume a:comma = ",". Then the format for a:patterns and a:1 is
|
||||
" a:patterns = "<pat1>,<pat2>,..."
|
||||
" a:1 = "<alt1>,<alt2>,..."
|
||||
" If <patn> is the first pattern that matches a:string then return <patn>
|
||||
" if no optional arguments are given; return <patn>,<altn> if a:1 is given.
|
||||
fun! s:Choose(patterns, string, comma, branch, prefix, suffix, ...)
|
||||
let tail = (a:patterns =~ a:comma."$" ? a:patterns : a:patterns . a:comma)
|
||||
let i = matchend(tail, s:notslash . a:comma)
|
||||
if a:0
|
||||
let alttail = (a:1 =~ a:comma."$" ? a:1 : a:1 . a:comma)
|
||||
let j = matchend(alttail, s:notslash . a:comma)
|
||||
endif
|
||||
let current = strpart(tail, 0, i-1)
|
||||
if a:branch == ""
|
||||
let currpat = current
|
||||
else
|
||||
let currpat = substitute(current, s:notslash . a:branch, '\\|', 'g')
|
||||
endif
|
||||
while a:string !~ a:prefix . currpat . a:suffix
|
||||
let tail = strpart(tail, i)
|
||||
let i = matchend(tail, s:notslash . a:comma)
|
||||
if i == -1
|
||||
return -1
|
||||
endif
|
||||
let current = strpart(tail, 0, i-1)
|
||||
if a:branch == ""
|
||||
let currpat = current
|
||||
else
|
||||
let currpat = substitute(current, s:notslash . a:branch, '\\|', 'g')
|
||||
endif
|
||||
if a:0
|
||||
let alttail = strpart(alttail, j)
|
||||
let j = matchend(alttail, s:notslash . a:comma)
|
||||
endif
|
||||
endwhile
|
||||
if a:0
|
||||
let current = current . a:comma . strpart(alttail, 0, j-1)
|
||||
endif
|
||||
return current
|
||||
endfun
|
||||
|
||||
" Call this function to turn on debugging information. Every time the main
|
||||
" script is run, buffer variables will be saved. These can be used directly
|
||||
" or viewed using the menu items below.
|
||||
if !exists(":MatchDebug")
|
||||
command! -nargs=0 MatchDebug call s:Match_debug()
|
||||
endif
|
||||
|
||||
fun! s:Match_debug()
|
||||
let b:match_debug = 1 " Save debugging information.
|
||||
" pat = all of b:match_words with backrefs parsed
|
||||
amenu &Matchit.&pat :echo b:match_pat<CR>
|
||||
" match = bit of text that is recognized as a match
|
||||
amenu &Matchit.&match :echo b:match_match<CR>
|
||||
" curcol = cursor column of the start of the matching text
|
||||
amenu &Matchit.&curcol :echo b:match_col<CR>
|
||||
" wholeBR = matching group, original version
|
||||
amenu &Matchit.wh&oleBR :echo b:match_wholeBR<CR>
|
||||
" iniBR = 'if' piece, original version
|
||||
amenu &Matchit.ini&BR :echo b:match_iniBR<CR>
|
||||
" ini = 'if' piece, with all backrefs resolved from match
|
||||
amenu &Matchit.&ini :echo b:match_ini<CR>
|
||||
" tail = 'else\|endif' piece, with all backrefs resolved from match
|
||||
amenu &Matchit.&tail :echo b:match_tail<CR>
|
||||
" fin = 'endif' piece, with all backrefs resolved from match
|
||||
amenu &Matchit.&word :echo b:match_word<CR>
|
||||
" '\'.d in ini refers to the same thing as '\'.table[d] in word.
|
||||
amenu &Matchit.t&able :echo '0:' . b:match_table . ':9'<CR>
|
||||
endfun
|
||||
|
||||
" Jump to the nearest unmatched "(" or "if" or "<tag>" if a:spflag == "bW"
|
||||
" or the nearest unmatched "</tag>" or "endif" or ")" if a:spflag == "W".
|
||||
" Return a "mark" for the original position, so that
|
||||
" let m = MultiMatch("bW", "n") ... execute m
|
||||
" will return to the original position. If there is a problem, do not
|
||||
" move the cursor and return "", unless a count is given, in which case
|
||||
" go up or down as many levels as possible and again return "".
|
||||
" TODO This relies on the same patterns as % matching. It might be a good
|
||||
" idea to give it its own matching patterns.
|
||||
fun! s:MultiMatch(spflag, mode)
|
||||
if !exists("b:match_words") || b:match_words == ""
|
||||
return ""
|
||||
end
|
||||
let restore_options = (&ic ? "" : "no") . "ignorecase"
|
||||
if exists("b:match_ignorecase")
|
||||
let &ignorecase = b:match_ignorecase
|
||||
endif
|
||||
let startline = line(".")
|
||||
let startcol = col(".")
|
||||
|
||||
" First step: if not already done, set the script variables
|
||||
" s:do_BR flag for whether there are backrefs
|
||||
" s:pat parsed version of b:match_words
|
||||
" s:all regexp based on s:pat and the default groups
|
||||
" This part is copied and slightly modified from s:Match_wrapper().
|
||||
let default = escape(&mps, '[$^.*~\\/?]') . (strlen(&mps) ? "," : "") .
|
||||
\ '\/\*:\*\/,#\s*if\%(def\)\=:#\s*else\>:#\s*elif\>:#\s*endif\>'
|
||||
" Allow b:match_words = "GetVimMatchWords()" .
|
||||
if b:match_words =~ ":"
|
||||
let match_words = b:match_words
|
||||
else
|
||||
execute "let match_words =" b:match_words
|
||||
endif
|
||||
if (match_words != s:last_words) || (&mps != s:last_mps) ||
|
||||
\ exists("b:match_debug")
|
||||
let s:last_words = match_words
|
||||
let s:last_mps = &mps
|
||||
if match_words !~ s:notslash . '\\\d'
|
||||
let s:do_BR = 0
|
||||
let s:pat = match_words
|
||||
else
|
||||
let s:do_BR = 1
|
||||
let s:pat = s:ParseWords(match_words)
|
||||
endif
|
||||
let s:all = '\%(' . substitute(s:pat . (strlen(s:pat)?",":"") . default,
|
||||
\ '[,:]\+','\\|','g') . '\)'
|
||||
if exists("b:match_debug")
|
||||
let b:match_pat = s:pat
|
||||
endif
|
||||
endif
|
||||
|
||||
" Second step: figure out the patterns for searchpair()
|
||||
" and save the screen, cursor position, and 'ignorecase'.
|
||||
" - TODO: A lot of this is copied from s:Match_wrapper().
|
||||
" - maybe even more functionality should be split off
|
||||
" - into separate functions!
|
||||
let cdefault = (s:pat =~ '[^,]$' ? "," : "") . default
|
||||
let open = substitute(s:pat . cdefault,
|
||||
\ s:notslash . '\zs:.\{-}' . s:notslash . ',', '\\),\\(', 'g')
|
||||
let open = '\(' . substitute(open, s:notslash . '\zs:.*$', '\\)', '')
|
||||
let close = substitute(s:pat . cdefault,
|
||||
\ s:notslash . '\zs,.\{-}' . s:notslash . ':', '\\),\\(', 'g')
|
||||
let close = substitute(close, '^.\{-}' . s:notslash . ':', '\\(', '') . '\)'
|
||||
if exists("b:match_skip")
|
||||
let skip = b:match_skip
|
||||
elseif exists("b:match_comment") " backwards compatibility and testing!
|
||||
let skip = "r:" . b:match_comment
|
||||
else
|
||||
let skip = 's:comment\|string'
|
||||
endif
|
||||
let skip = s:ParseSkip(skip)
|
||||
" let restore_cursor = line(".") . "G" . virtcol(".") . "|"
|
||||
" normal! H
|
||||
" let restore_cursor = "normal!" . line(".") . "Gzt" . restore_cursor
|
||||
let restore_cursor = virtcol(".") . "|"
|
||||
normal! g0
|
||||
let restore_cursor = line(".") . "G" . virtcol(".") . "|zs" . restore_cursor
|
||||
normal! H
|
||||
let restore_cursor = "normal!" . line(".") . "Gzt" . restore_cursor
|
||||
execute restore_cursor
|
||||
|
||||
" Third step: call searchpair().
|
||||
" Replace '\('--but not '\\('--with '\%(' and ',' with '\|'.
|
||||
let openpat = substitute(open, '\(\\\@<!\(\\\\\)*\)\@<=\\(', '\\%(', 'g')
|
||||
let openpat = substitute(openpat, ',', '\\|', 'g')
|
||||
let closepat = substitute(close, '\(\\\@<!\(\\\\\)*\)\@<=\\(', '\\%(', 'g')
|
||||
let closepat = substitute(closepat, ',', '\\|', 'g')
|
||||
if skip =~ 'synID' && !(has("syntax") && exists("g:syntax_on"))
|
||||
let skip = '0'
|
||||
else
|
||||
execute "if " . skip . "| let skip = '0' | endif"
|
||||
endif
|
||||
mark '
|
||||
let level = v:count1
|
||||
while level
|
||||
if searchpair(openpat, '', closepat, a:spflag, skip) < 1
|
||||
call s:CleanUp(restore_options, a:mode, startline, startcol)
|
||||
return ""
|
||||
endif
|
||||
let level = level - 1
|
||||
endwhile
|
||||
|
||||
" Restore options and return a string to restore the original position.
|
||||
call s:CleanUp(restore_options, a:mode, startline, startcol)
|
||||
return restore_cursor
|
||||
endfun
|
||||
|
||||
" Search backwards for "if" or "while" or "<tag>" or ...
|
||||
" and return "endif" or "endwhile" or "</tag>" or ... .
|
||||
" For now, this uses b:match_words and the same script variables
|
||||
" as s:Match_wrapper() . Later, it may get its own patterns,
|
||||
" either from a buffer variable or passed as arguments.
|
||||
" fun! s:Autocomplete()
|
||||
" echo "autocomplete not yet implemented :-("
|
||||
" if !exists("b:match_words") || b:match_words == ""
|
||||
" return ""
|
||||
" end
|
||||
" let startpos = s:MultiMatch("bW")
|
||||
"
|
||||
" if startpos == ""
|
||||
" return ""
|
||||
" endif
|
||||
" " - TODO: figure out whether 'if' or '<tag>' matched, and construct
|
||||
" " - the appropriate closing.
|
||||
" let matchline = getline(".")
|
||||
" let curcol = col(".") - 1
|
||||
" " - TODO: Change the s:all argument if there is a new set of match pats.
|
||||
" let regexp = s:Wholematch(matchline, s:all, curcol)
|
||||
" let suf = strlen(matchline) - matchend(matchline, regexp)
|
||||
" let prefix = (curcol ? '^.\{' . curcol . '}\%(' : '^\%(')
|
||||
" let suffix = (suf ? '\).\{' . suf . '}$' : '\)$')
|
||||
" " Reconstruct the version with unresolved backrefs.
|
||||
" let patBR = substitute(b:match_words.',', '[,:]*,[,:]*', ',', 'g')
|
||||
" let patBR = substitute(patBR, ':\{2,}', ':', "g")
|
||||
" " Now, set group and groupBR to the matching group: 'if:endif' or
|
||||
" " 'while:endwhile' or whatever.
|
||||
" let group = s:Choose(s:pat, matchline, ",", ":", prefix, suffix, patBR)
|
||||
" let i = matchend(group, s:notslash . ",")
|
||||
" let groupBR = strpart(group, i)
|
||||
" let group = strpart(group, 0, i-1)
|
||||
" " Now, matchline =~ prefix . substitute(group,':','\|','g') . suffix
|
||||
" if s:do_BR
|
||||
" let group = s:InsertRefs(groupBR, prefix, group, suffix, matchline)
|
||||
" endif
|
||||
" " let g:group = group
|
||||
"
|
||||
" " - TODO: Construct the closing from group.
|
||||
" let fake = "end" . expand("<cword>")
|
||||
" execute startpos
|
||||
" return fake
|
||||
" endfun
|
||||
|
||||
" Close all open structures. "Get the heck out of here!"
|
||||
" fun! s:Gthhoh()
|
||||
" let close = s:Autocomplete()
|
||||
" while strlen(close)
|
||||
" put=close
|
||||
" let close = s:Autocomplete()
|
||||
" endwhile
|
||||
" endfun
|
||||
|
||||
" Parse special strings as typical skip arguments for searchpair():
|
||||
" s:foo becomes (current syntax item) =~ foo
|
||||
" S:foo becomes (current syntax item) !~ foo
|
||||
" r:foo becomes (line before cursor) =~ foo
|
||||
" R:foo becomes (line before cursor) !~ foo
|
||||
fun! s:ParseSkip(str)
|
||||
let skip = a:str
|
||||
if skip[1] == ":"
|
||||
if skip[0] == "s"
|
||||
let skip = "synIDattr(synID(line('.'),col('.'),1),'name') =~? '" .
|
||||
\ strpart(skip,2) . "'"
|
||||
elseif skip[0] == "S"
|
||||
let skip = "synIDattr(synID(line('.'),col('.'),1),'name') !~? '" .
|
||||
\ strpart(skip,2) . "'"
|
||||
elseif skip[0] == "r"
|
||||
let skip = "strpart(getline('.'),0,col('.'))=~'" . strpart(skip,2). "'"
|
||||
elseif skip[0] == "R"
|
||||
let skip = "strpart(getline('.'),0,col('.'))!~'" . strpart(skip,2). "'"
|
||||
endif
|
||||
endif
|
||||
return skip
|
||||
endfun
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim:sts=2:sw=2:
|
||||
" Load the matchit package.
|
||||
" For those users who were loading the matchit plugin from here.
|
||||
packadd matchit
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" These commands create the option window.
|
||||
"
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2016 Feb 21
|
||||
" Last Change: 2016 Mar 19
|
||||
|
||||
" If there already is an option window, jump to that one.
|
||||
if bufwinnr("option-window") > 0
|
||||
@@ -1254,6 +1254,8 @@ if has("multi_byte")
|
||||
endif
|
||||
call append("$", "ambiwidth\twidth of ambiguous width characters")
|
||||
call <SID>OptionG("ambw", &ambw)
|
||||
call append("$", "emoji\temoji characters are full width")
|
||||
call <SID>BinOptionG("emo", &emo)
|
||||
endif
|
||||
|
||||
|
||||
|
||||
50
runtime/pack/dist/opt/matchit/doc/tags
vendored
Normal file
50
runtime/pack/dist/opt/matchit/doc/tags
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
:MatchDebug matchit.txt /*:MatchDebug*
|
||||
MatchError matchit.txt /*MatchError*
|
||||
[% matchit.txt /*[%*
|
||||
]% matchit.txt /*]%*
|
||||
b:match_col matchit.txt /*b:match_col*
|
||||
b:match_debug matchit.txt /*b:match_debug*
|
||||
b:match_ignorecase matchit.txt /*b:match_ignorecase*
|
||||
b:match_ini matchit.txt /*b:match_ini*
|
||||
b:match_iniBR matchit.txt /*b:match_iniBR*
|
||||
b:match_match matchit.txt /*b:match_match*
|
||||
b:match_pat matchit.txt /*b:match_pat*
|
||||
b:match_skip matchit.txt /*b:match_skip*
|
||||
b:match_table matchit.txt /*b:match_table*
|
||||
b:match_tail matchit.txt /*b:match_tail*
|
||||
b:match_wholeBR matchit.txt /*b:match_wholeBR*
|
||||
b:match_word matchit.txt /*b:match_word*
|
||||
b:match_words matchit.txt /*b:match_words*
|
||||
g% matchit.txt /*g%*
|
||||
matchit matchit.txt /*matchit*
|
||||
matchit-% matchit.txt /*matchit-%*
|
||||
matchit-\1 matchit.txt /*matchit-\\1*
|
||||
matchit-activate matchit.txt /*matchit-activate*
|
||||
matchit-backref matchit.txt /*matchit-backref*
|
||||
matchit-bugs matchit.txt /*matchit-bugs*
|
||||
matchit-choose matchit.txt /*matchit-choose*
|
||||
matchit-configure matchit.txt /*matchit-configure*
|
||||
matchit-debug matchit.txt /*matchit-debug*
|
||||
matchit-details matchit.txt /*matchit-details*
|
||||
matchit-highlight matchit.txt /*matchit-highlight*
|
||||
matchit-hl matchit.txt /*matchit-hl*
|
||||
matchit-intro matchit.txt /*matchit-intro*
|
||||
matchit-languages matchit.txt /*matchit-languages*
|
||||
matchit-modes matchit.txt /*matchit-modes*
|
||||
matchit-newlang matchit.txt /*matchit-newlang*
|
||||
matchit-o_% matchit.txt /*matchit-o_%*
|
||||
matchit-parse matchit.txt /*matchit-parse*
|
||||
matchit-s:notend matchit.txt /*matchit-s:notend*
|
||||
matchit-s:sol matchit.txt /*matchit-s:sol*
|
||||
matchit-spaces matchit.txt /*matchit-spaces*
|
||||
matchit-troubleshoot matchit.txt /*matchit-troubleshoot*
|
||||
matchit-v_% matchit.txt /*matchit-v_%*
|
||||
matchit.txt matchit.txt /*matchit.txt*
|
||||
matchit.vim matchit.txt /*matchit.vim*
|
||||
o_[% matchit.txt /*o_[%*
|
||||
o_]% matchit.txt /*o_]%*
|
||||
o_g% matchit.txt /*o_g%*
|
||||
v_[% matchit.txt /*v_[%*
|
||||
v_]% matchit.txt /*v_]%*
|
||||
v_a% matchit.txt /*v_a%*
|
||||
v_g% matchit.txt /*v_g%*
|
||||
813
runtime/pack/dist/opt/matchit/plugin/matchit.vim
vendored
Normal file
813
runtime/pack/dist/opt/matchit/plugin/matchit.vim
vendored
Normal file
@@ -0,0 +1,813 @@
|
||||
" matchit.vim: (global plugin) Extended "%" matching
|
||||
" Last Change: Fri Jan 25 10:00 AM 2008 EST
|
||||
" Maintainer: Benji Fisher PhD <benji@member.AMS.org>
|
||||
" Version: 1.13.2, for Vim 6.3+
|
||||
" URL: http://www.vim.org/script.php?script_id=39
|
||||
|
||||
" Documentation:
|
||||
" The documentation is in a separate file, matchit.txt .
|
||||
|
||||
" Credits:
|
||||
" Vim editor by Bram Moolenaar (Thanks, Bram!)
|
||||
" Original script and design by Raul Segura Acevedo
|
||||
" Support for comments by Douglas Potts
|
||||
" Support for back references and other improvements by Benji Fisher
|
||||
" Support for many languages by Johannes Zellner
|
||||
" Suggestions for improvement, bug reports, and support for additional
|
||||
" languages by Jordi-Albert Batalla, Neil Bird, Servatius Brandt, Mark
|
||||
" Collett, Stephen Wall, Dany St-Amant, Yuheng Xie, and Johannes Zellner.
|
||||
|
||||
" Debugging:
|
||||
" If you'd like to try the built-in debugging commands...
|
||||
" :MatchDebug to activate debugging for the current buffer
|
||||
" This saves the values of several key script variables as buffer-local
|
||||
" variables. See the MatchDebug() function, below, for details.
|
||||
|
||||
" TODO: I should think about multi-line patterns for b:match_words.
|
||||
" This would require an option: how many lines to scan (default 1).
|
||||
" This would be useful for Python, maybe also for *ML.
|
||||
" TODO: Maybe I should add a menu so that people will actually use some of
|
||||
" the features that I have implemented.
|
||||
" TODO: Eliminate the MultiMatch function. Add yet another argument to
|
||||
" Match_wrapper() instead.
|
||||
" TODO: Allow :let b:match_words = '\(\(foo\)\(bar\)\):\3\2:end\1'
|
||||
" TODO: Make backrefs safer by using '\V' (very no-magic).
|
||||
" TODO: Add a level of indirection, so that custom % scripts can use my
|
||||
" work but extend it.
|
||||
|
||||
" allow user to prevent loading
|
||||
" and prevent duplicate loading
|
||||
if exists("loaded_matchit") || &cp
|
||||
finish
|
||||
endif
|
||||
let loaded_matchit = 1
|
||||
let s:last_mps = ""
|
||||
let s:last_words = ":"
|
||||
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
nnoremap <silent> % :<C-U>call <SID>Match_wrapper('',1,'n') <CR>
|
||||
nnoremap <silent> g% :<C-U>call <SID>Match_wrapper('',0,'n') <CR>
|
||||
vnoremap <silent> % :<C-U>call <SID>Match_wrapper('',1,'v') <CR>m'gv``
|
||||
vnoremap <silent> g% :<C-U>call <SID>Match_wrapper('',0,'v') <CR>m'gv``
|
||||
onoremap <silent> % v:<C-U>call <SID>Match_wrapper('',1,'o') <CR>
|
||||
onoremap <silent> g% v:<C-U>call <SID>Match_wrapper('',0,'o') <CR>
|
||||
|
||||
" Analogues of [{ and ]} using matching patterns:
|
||||
nnoremap <silent> [% :<C-U>call <SID>MultiMatch("bW", "n") <CR>
|
||||
nnoremap <silent> ]% :<C-U>call <SID>MultiMatch("W", "n") <CR>
|
||||
vmap [% <Esc>[%m'gv``
|
||||
vmap ]% <Esc>]%m'gv``
|
||||
" vnoremap <silent> [% :<C-U>call <SID>MultiMatch("bW", "v") <CR>m'gv``
|
||||
" vnoremap <silent> ]% :<C-U>call <SID>MultiMatch("W", "v") <CR>m'gv``
|
||||
onoremap <silent> [% v:<C-U>call <SID>MultiMatch("bW", "o") <CR>
|
||||
onoremap <silent> ]% v:<C-U>call <SID>MultiMatch("W", "o") <CR>
|
||||
|
||||
" text object:
|
||||
vmap a% <Esc>[%v]%
|
||||
|
||||
" Auto-complete mappings: (not yet "ready for prime time")
|
||||
" TODO Read :help write-plugin for the "right" way to let the user
|
||||
" specify a key binding.
|
||||
" let g:match_auto = '<C-]>'
|
||||
" let g:match_autoCR = '<C-CR>'
|
||||
" if exists("g:match_auto")
|
||||
" execute "inoremap " . g:match_auto . ' x<Esc>"=<SID>Autocomplete()<CR>Pls'
|
||||
" endif
|
||||
" if exists("g:match_autoCR")
|
||||
" execute "inoremap " . g:match_autoCR . ' <CR><C-R>=<SID>Autocomplete()<CR>'
|
||||
" endif
|
||||
" if exists("g:match_gthhoh")
|
||||
" execute "inoremap " . g:match_gthhoh . ' <C-O>:call <SID>Gthhoh()<CR>'
|
||||
" endif " gthhoh = "Get the heck out of here!"
|
||||
|
||||
let s:notslash = '\\\@<!\%(\\\\\)*'
|
||||
|
||||
function! s:Match_wrapper(word, forward, mode) range
|
||||
" In s:CleanUp(), :execute "set" restore_options .
|
||||
let restore_options = (&ic ? " " : " no") . "ignorecase"
|
||||
if exists("b:match_ignorecase")
|
||||
let &ignorecase = b:match_ignorecase
|
||||
endif
|
||||
let restore_options = " ve=" . &ve . restore_options
|
||||
set ve=
|
||||
" If this function was called from Visual mode, make sure that the cursor
|
||||
" is at the correct end of the Visual range:
|
||||
if a:mode == "v"
|
||||
execute "normal! gv\<Esc>"
|
||||
endif
|
||||
" In s:CleanUp(), we may need to check whether the cursor moved forward.
|
||||
let startline = line(".")
|
||||
let startcol = col(".")
|
||||
" Use default behavior if called with a count.
|
||||
if v:count
|
||||
exe "normal! " . v:count . "%"
|
||||
return s:CleanUp(restore_options, a:mode, startline, startcol)
|
||||
end
|
||||
|
||||
" First step: if not already done, set the script variables
|
||||
" s:do_BR flag for whether there are backrefs
|
||||
" s:pat parsed version of b:match_words
|
||||
" s:all regexp based on s:pat and the default groups
|
||||
"
|
||||
if !exists("b:match_words") || b:match_words == ""
|
||||
let match_words = ""
|
||||
" Allow b:match_words = "GetVimMatchWords()" .
|
||||
elseif b:match_words =~ ":"
|
||||
let match_words = b:match_words
|
||||
else
|
||||
execute "let match_words =" b:match_words
|
||||
endif
|
||||
" Thanks to Preben "Peppe" Guldberg and Bram Moolenaar for this suggestion!
|
||||
if (match_words != s:last_words) || (&mps != s:last_mps) ||
|
||||
\ exists("b:match_debug")
|
||||
let s:last_words = match_words
|
||||
let s:last_mps = &mps
|
||||
" The next several lines were here before
|
||||
" BF started messing with this script.
|
||||
" quote the special chars in 'matchpairs', replace [,:] with \| and then
|
||||
" append the builtin pairs (/*, */, #if, #ifdef, #else, #elif, #endif)
|
||||
" let default = substitute(escape(&mps, '[$^.*~\\/?]'), '[,:]\+',
|
||||
" \ '\\|', 'g').'\|\/\*\|\*\/\|#if\>\|#ifdef\>\|#else\>\|#elif\>\|#endif\>'
|
||||
let default = escape(&mps, '[$^.*~\\/?]') . (strlen(&mps) ? "," : "") .
|
||||
\ '\/\*:\*\/,#\s*if\%(def\)\=:#\s*else\>:#\s*elif\>:#\s*endif\>'
|
||||
" s:all = pattern with all the keywords
|
||||
let match_words = match_words . (strlen(match_words) ? "," : "") . default
|
||||
if match_words !~ s:notslash . '\\\d'
|
||||
let s:do_BR = 0
|
||||
let s:pat = match_words
|
||||
else
|
||||
let s:do_BR = 1
|
||||
let s:pat = s:ParseWords(match_words)
|
||||
endif
|
||||
let s:all = substitute(s:pat, s:notslash . '\zs[,:]\+', '\\|', 'g')
|
||||
let s:all = '\%(' . s:all . '\)'
|
||||
" let s:all = '\%(' . substitute(s:all, '\\\ze[,:]', '', 'g') . '\)'
|
||||
if exists("b:match_debug")
|
||||
let b:match_pat = s:pat
|
||||
endif
|
||||
endif
|
||||
|
||||
" Second step: set the following local variables:
|
||||
" matchline = line on which the cursor started
|
||||
" curcol = number of characters before match
|
||||
" prefix = regexp for start of line to start of match
|
||||
" suffix = regexp for end of match to end of line
|
||||
" Require match to end on or after the cursor and prefer it to
|
||||
" start on or before the cursor.
|
||||
let matchline = getline(startline)
|
||||
if a:word != ''
|
||||
" word given
|
||||
if a:word !~ s:all
|
||||
echohl WarningMsg|echo 'Missing rule for word:"'.a:word.'"'|echohl NONE
|
||||
return s:CleanUp(restore_options, a:mode, startline, startcol)
|
||||
endif
|
||||
let matchline = a:word
|
||||
let curcol = 0
|
||||
let prefix = '^\%('
|
||||
let suffix = '\)$'
|
||||
" Now the case when "word" is not given
|
||||
else " Find the match that ends on or after the cursor and set curcol.
|
||||
let regexp = s:Wholematch(matchline, s:all, startcol-1)
|
||||
let curcol = match(matchline, regexp)
|
||||
" If there is no match, give up.
|
||||
if curcol == -1
|
||||
return s:CleanUp(restore_options, a:mode, startline, startcol)
|
||||
endif
|
||||
let endcol = matchend(matchline, regexp)
|
||||
let suf = strlen(matchline) - endcol
|
||||
let prefix = (curcol ? '^.*\%' . (curcol + 1) . 'c\%(' : '^\%(')
|
||||
let suffix = (suf ? '\)\%' . (endcol + 1) . 'c.*$' : '\)$')
|
||||
endif
|
||||
if exists("b:match_debug")
|
||||
let b:match_match = matchstr(matchline, regexp)
|
||||
let b:match_col = curcol+1
|
||||
endif
|
||||
|
||||
" Third step: Find the group and single word that match, and the original
|
||||
" (backref) versions of these. Then, resolve the backrefs.
|
||||
" Set the following local variable:
|
||||
" group = colon-separated list of patterns, one of which matches
|
||||
" = ini:mid:fin or ini:fin
|
||||
"
|
||||
" Reconstruct the version with unresolved backrefs.
|
||||
let patBR = substitute(match_words.',',
|
||||
\ s:notslash.'\zs[,:]*,[,:]*', ',', 'g')
|
||||
let patBR = substitute(patBR, s:notslash.'\zs:\{2,}', ':', 'g')
|
||||
" Now, set group and groupBR to the matching group: 'if:endif' or
|
||||
" 'while:endwhile' or whatever. A bit of a kluge: s:Choose() returns
|
||||
" group . "," . groupBR, and we pick it apart.
|
||||
let group = s:Choose(s:pat, matchline, ",", ":", prefix, suffix, patBR)
|
||||
let i = matchend(group, s:notslash . ",")
|
||||
let groupBR = strpart(group, i)
|
||||
let group = strpart(group, 0, i-1)
|
||||
" Now, matchline =~ prefix . substitute(group,':','\|','g') . suffix
|
||||
if s:do_BR " Do the hard part: resolve those backrefs!
|
||||
let group = s:InsertRefs(groupBR, prefix, group, suffix, matchline)
|
||||
endif
|
||||
if exists("b:match_debug")
|
||||
let b:match_wholeBR = groupBR
|
||||
let i = matchend(groupBR, s:notslash . ":")
|
||||
let b:match_iniBR = strpart(groupBR, 0, i-1)
|
||||
endif
|
||||
|
||||
" Fourth step: Set the arguments for searchpair().
|
||||
let i = matchend(group, s:notslash . ":")
|
||||
let j = matchend(group, '.*' . s:notslash . ":")
|
||||
let ini = strpart(group, 0, i-1)
|
||||
let mid = substitute(strpart(group, i,j-i-1), s:notslash.'\zs:', '\\|', 'g')
|
||||
let fin = strpart(group, j)
|
||||
"Un-escape the remaining , and : characters.
|
||||
let ini = substitute(ini, s:notslash . '\zs\\\(:\|,\)', '\1', 'g')
|
||||
let mid = substitute(mid, s:notslash . '\zs\\\(:\|,\)', '\1', 'g')
|
||||
let fin = substitute(fin, s:notslash . '\zs\\\(:\|,\)', '\1', 'g')
|
||||
" searchpair() requires that these patterns avoid \(\) groups.
|
||||
let ini = substitute(ini, s:notslash . '\zs\\(', '\\%(', 'g')
|
||||
let mid = substitute(mid, s:notslash . '\zs\\(', '\\%(', 'g')
|
||||
let fin = substitute(fin, s:notslash . '\zs\\(', '\\%(', 'g')
|
||||
" Set mid. This is optimized for readability, not micro-efficiency!
|
||||
if a:forward && matchline =~ prefix . fin . suffix
|
||||
\ || !a:forward && matchline =~ prefix . ini . suffix
|
||||
let mid = ""
|
||||
endif
|
||||
" Set flag. This is optimized for readability, not micro-efficiency!
|
||||
if a:forward && matchline =~ prefix . fin . suffix
|
||||
\ || !a:forward && matchline !~ prefix . ini . suffix
|
||||
let flag = "bW"
|
||||
else
|
||||
let flag = "W"
|
||||
endif
|
||||
" Set skip.
|
||||
if exists("b:match_skip")
|
||||
let skip = b:match_skip
|
||||
elseif exists("b:match_comment") " backwards compatibility and testing!
|
||||
let skip = "r:" . b:match_comment
|
||||
else
|
||||
let skip = 's:comment\|string'
|
||||
endif
|
||||
let skip = s:ParseSkip(skip)
|
||||
if exists("b:match_debug")
|
||||
let b:match_ini = ini
|
||||
let b:match_tail = (strlen(mid) ? mid.'\|' : '') . fin
|
||||
endif
|
||||
|
||||
" Fifth step: actually start moving the cursor and call searchpair().
|
||||
" Later, :execute restore_cursor to get to the original screen.
|
||||
let restore_cursor = virtcol(".") . "|"
|
||||
normal! g0
|
||||
let restore_cursor = line(".") . "G" . virtcol(".") . "|zs" . restore_cursor
|
||||
normal! H
|
||||
let restore_cursor = "normal!" . line(".") . "Gzt" . restore_cursor
|
||||
execute restore_cursor
|
||||
call cursor(0, curcol + 1)
|
||||
" normal! 0
|
||||
" if curcol
|
||||
" execute "normal!" . curcol . "l"
|
||||
" endif
|
||||
if skip =~ 'synID' && !(has("syntax") && exists("g:syntax_on"))
|
||||
let skip = "0"
|
||||
else
|
||||
execute "if " . skip . "| let skip = '0' | endif"
|
||||
endif
|
||||
let sp_return = searchpair(ini, mid, fin, flag, skip)
|
||||
let final_position = "call cursor(" . line(".") . "," . col(".") . ")"
|
||||
" Restore cursor position and original screen.
|
||||
execute restore_cursor
|
||||
normal! m'
|
||||
if sp_return > 0
|
||||
execute final_position
|
||||
endif
|
||||
return s:CleanUp(restore_options, a:mode, startline, startcol, mid.'\|'.fin)
|
||||
endfun
|
||||
|
||||
" Restore options and do some special handling for Operator-pending mode.
|
||||
" The optional argument is the tail of the matching group.
|
||||
fun! s:CleanUp(options, mode, startline, startcol, ...)
|
||||
execute "set" a:options
|
||||
" Open folds, if appropriate.
|
||||
if a:mode != "o"
|
||||
if &foldopen =~ "percent"
|
||||
normal! zv
|
||||
endif
|
||||
" In Operator-pending mode, we want to include the whole match
|
||||
" (for example, d%).
|
||||
" This is only a problem if we end up moving in the forward direction.
|
||||
elseif (a:startline < line(".")) ||
|
||||
\ (a:startline == line(".") && a:startcol < col("."))
|
||||
if a:0
|
||||
" Check whether the match is a single character. If not, move to the
|
||||
" end of the match.
|
||||
let matchline = getline(".")
|
||||
let currcol = col(".")
|
||||
let regexp = s:Wholematch(matchline, a:1, currcol-1)
|
||||
let endcol = matchend(matchline, regexp)
|
||||
if endcol > currcol " This is NOT off by one!
|
||||
call cursor(0, endcol)
|
||||
endif
|
||||
endif " a:0
|
||||
endif " a:mode != "o" && etc.
|
||||
return 0
|
||||
endfun
|
||||
|
||||
" Example (simplified HTML patterns): if
|
||||
" a:groupBR = '<\(\k\+\)>:</\1>'
|
||||
" a:prefix = '^.\{3}\('
|
||||
" a:group = '<\(\k\+\)>:</\(\k\+\)>'
|
||||
" a:suffix = '\).\{2}$'
|
||||
" a:matchline = "123<tag>12" or "123</tag>12"
|
||||
" then extract "tag" from a:matchline and return "<tag>:</tag>" .
|
||||
fun! s:InsertRefs(groupBR, prefix, group, suffix, matchline)
|
||||
if a:matchline !~ a:prefix .
|
||||
\ substitute(a:group, s:notslash . '\zs:', '\\|', 'g') . a:suffix
|
||||
return a:group
|
||||
endif
|
||||
let i = matchend(a:groupBR, s:notslash . ':')
|
||||
let ini = strpart(a:groupBR, 0, i-1)
|
||||
let tailBR = strpart(a:groupBR, i)
|
||||
let word = s:Choose(a:group, a:matchline, ":", "", a:prefix, a:suffix,
|
||||
\ a:groupBR)
|
||||
let i = matchend(word, s:notslash . ":")
|
||||
let wordBR = strpart(word, i)
|
||||
let word = strpart(word, 0, i-1)
|
||||
" Now, a:matchline =~ a:prefix . word . a:suffix
|
||||
if wordBR != ini
|
||||
let table = s:Resolve(ini, wordBR, "table")
|
||||
else
|
||||
" let table = "----------"
|
||||
let table = ""
|
||||
let d = 0
|
||||
while d < 10
|
||||
if tailBR =~ s:notslash . '\\' . d
|
||||
" let table[d] = d
|
||||
let table = table . d
|
||||
else
|
||||
let table = table . "-"
|
||||
endif
|
||||
let d = d + 1
|
||||
endwhile
|
||||
endif
|
||||
let d = 9
|
||||
while d
|
||||
if table[d] != "-"
|
||||
let backref = substitute(a:matchline, a:prefix.word.a:suffix,
|
||||
\ '\'.table[d], "")
|
||||
" Are there any other characters that should be escaped?
|
||||
let backref = escape(backref, '*,:')
|
||||
execute s:Ref(ini, d, "start", "len")
|
||||
let ini = strpart(ini, 0, start) . backref . strpart(ini, start+len)
|
||||
let tailBR = substitute(tailBR, s:notslash . '\zs\\' . d,
|
||||
\ escape(backref, '\\&'), 'g')
|
||||
endif
|
||||
let d = d-1
|
||||
endwhile
|
||||
if exists("b:match_debug")
|
||||
if s:do_BR
|
||||
let b:match_table = table
|
||||
let b:match_word = word
|
||||
else
|
||||
let b:match_table = ""
|
||||
let b:match_word = ""
|
||||
endif
|
||||
endif
|
||||
return ini . ":" . tailBR
|
||||
endfun
|
||||
|
||||
" Input a comma-separated list of groups with backrefs, such as
|
||||
" a:groups = '\(foo\):end\1,\(bar\):end\1'
|
||||
" and return a comma-separated list of groups with backrefs replaced:
|
||||
" return '\(foo\):end\(foo\),\(bar\):end\(bar\)'
|
||||
fun! s:ParseWords(groups)
|
||||
let groups = substitute(a:groups.",", s:notslash.'\zs[,:]*,[,:]*', ',', 'g')
|
||||
let groups = substitute(groups, s:notslash . '\zs:\{2,}', ':', 'g')
|
||||
let parsed = ""
|
||||
while groups =~ '[^,:]'
|
||||
let i = matchend(groups, s:notslash . ':')
|
||||
let j = matchend(groups, s:notslash . ',')
|
||||
let ini = strpart(groups, 0, i-1)
|
||||
let tail = strpart(groups, i, j-i-1) . ":"
|
||||
let groups = strpart(groups, j)
|
||||
let parsed = parsed . ini
|
||||
let i = matchend(tail, s:notslash . ':')
|
||||
while i != -1
|
||||
" In 'if:else:endif', ini='if' and word='else' and then word='endif'.
|
||||
let word = strpart(tail, 0, i-1)
|
||||
let tail = strpart(tail, i)
|
||||
let i = matchend(tail, s:notslash . ':')
|
||||
let parsed = parsed . ":" . s:Resolve(ini, word, "word")
|
||||
endwhile " Now, tail has been used up.
|
||||
let parsed = parsed . ","
|
||||
endwhile " groups =~ '[^,:]'
|
||||
let parsed = substitute(parsed, ',$', '', '')
|
||||
return parsed
|
||||
endfun
|
||||
|
||||
" TODO I think this can be simplified and/or made more efficient.
|
||||
" TODO What should I do if a:start is out of range?
|
||||
" Return a regexp that matches all of a:string, such that
|
||||
" matchstr(a:string, regexp) represents the match for a:pat that starts
|
||||
" as close to a:start as possible, before being preferred to after, and
|
||||
" ends after a:start .
|
||||
" Usage:
|
||||
" let regexp = s:Wholematch(getline("."), 'foo\|bar', col(".")-1)
|
||||
" let i = match(getline("."), regexp)
|
||||
" let j = matchend(getline("."), regexp)
|
||||
" let match = matchstr(getline("."), regexp)
|
||||
fun! s:Wholematch(string, pat, start)
|
||||
let group = '\%(' . a:pat . '\)'
|
||||
let prefix = (a:start ? '\(^.*\%<' . (a:start + 2) . 'c\)\zs' : '^')
|
||||
let len = strlen(a:string)
|
||||
let suffix = (a:start+1 < len ? '\(\%>'.(a:start+1).'c.*$\)\@=' : '$')
|
||||
if a:string !~ prefix . group . suffix
|
||||
let prefix = ''
|
||||
endif
|
||||
return prefix . group . suffix
|
||||
endfun
|
||||
|
||||
" No extra arguments: s:Ref(string, d) will
|
||||
" find the d'th occurrence of '\(' and return it, along with everything up
|
||||
" to and including the matching '\)'.
|
||||
" One argument: s:Ref(string, d, "start") returns the index of the start
|
||||
" of the d'th '\(' and any other argument returns the length of the group.
|
||||
" Two arguments: s:Ref(string, d, "foo", "bar") returns a string to be
|
||||
" executed, having the effect of
|
||||
" :let foo = s:Ref(string, d, "start")
|
||||
" :let bar = s:Ref(string, d, "len")
|
||||
fun! s:Ref(string, d, ...)
|
||||
let len = strlen(a:string)
|
||||
if a:d == 0
|
||||
let start = 0
|
||||
else
|
||||
let cnt = a:d
|
||||
let match = a:string
|
||||
while cnt
|
||||
let cnt = cnt - 1
|
||||
let index = matchend(match, s:notslash . '\\(')
|
||||
if index == -1
|
||||
return ""
|
||||
endif
|
||||
let match = strpart(match, index)
|
||||
endwhile
|
||||
let start = len - strlen(match)
|
||||
if a:0 == 1 && a:1 == "start"
|
||||
return start - 2
|
||||
endif
|
||||
let cnt = 1
|
||||
while cnt
|
||||
let index = matchend(match, s:notslash . '\\(\|\\)') - 1
|
||||
if index == -2
|
||||
return ""
|
||||
endif
|
||||
" Increment if an open, decrement if a ')':
|
||||
let cnt = cnt + (match[index]=="(" ? 1 : -1) " ')'
|
||||
" let cnt = stridx('0(', match[index]) + cnt
|
||||
let match = strpart(match, index+1)
|
||||
endwhile
|
||||
let start = start - 2
|
||||
let len = len - start - strlen(match)
|
||||
endif
|
||||
if a:0 == 1
|
||||
return len
|
||||
elseif a:0 == 2
|
||||
return "let " . a:1 . "=" . start . "| let " . a:2 . "=" . len
|
||||
else
|
||||
return strpart(a:string, start, len)
|
||||
endif
|
||||
endfun
|
||||
|
||||
" Count the number of disjoint copies of pattern in string.
|
||||
" If the pattern is a literal string and contains no '0' or '1' characters
|
||||
" then s:Count(string, pattern, '0', '1') should be faster than
|
||||
" s:Count(string, pattern).
|
||||
fun! s:Count(string, pattern, ...)
|
||||
let pat = escape(a:pattern, '\\')
|
||||
if a:0 > 1
|
||||
let foo = substitute(a:string, '[^'.a:pattern.']', "a:1", "g")
|
||||
let foo = substitute(a:string, pat, a:2, "g")
|
||||
let foo = substitute(foo, '[^' . a:2 . ']', "", "g")
|
||||
return strlen(foo)
|
||||
endif
|
||||
let result = 0
|
||||
let foo = a:string
|
||||
let index = matchend(foo, pat)
|
||||
while index != -1
|
||||
let result = result + 1
|
||||
let foo = strpart(foo, index)
|
||||
let index = matchend(foo, pat)
|
||||
endwhile
|
||||
return result
|
||||
endfun
|
||||
|
||||
" s:Resolve('\(a\)\(b\)', '\(c\)\2\1\1\2') should return table.word, where
|
||||
" word = '\(c\)\(b\)\(a\)\3\2' and table = '-32-------'. That is, the first
|
||||
" '\1' in target is replaced by '\(a\)' in word, table[1] = 3, and this
|
||||
" indicates that all other instances of '\1' in target are to be replaced
|
||||
" by '\3'. The hard part is dealing with nesting...
|
||||
" Note that ":" is an illegal character for source and target,
|
||||
" unless it is preceded by "\".
|
||||
fun! s:Resolve(source, target, output)
|
||||
let word = a:target
|
||||
let i = matchend(word, s:notslash . '\\\d') - 1
|
||||
let table = "----------"
|
||||
while i != -2 " There are back references to be replaced.
|
||||
let d = word[i]
|
||||
let backref = s:Ref(a:source, d)
|
||||
" The idea is to replace '\d' with backref. Before we do this,
|
||||
" replace any \(\) groups in backref with :1, :2, ... if they
|
||||
" correspond to the first, second, ... group already inserted
|
||||
" into backref. Later, replace :1 with \1 and so on. The group
|
||||
" number w+b within backref corresponds to the group number
|
||||
" s within a:source.
|
||||
" w = number of '\(' in word before the current one
|
||||
let w = s:Count(
|
||||
\ substitute(strpart(word, 0, i-1), '\\\\', '', 'g'), '\(', '1')
|
||||
let b = 1 " number of the current '\(' in backref
|
||||
let s = d " number of the current '\(' in a:source
|
||||
while b <= s:Count(substitute(backref, '\\\\', '', 'g'), '\(', '1')
|
||||
\ && s < 10
|
||||
if table[s] == "-"
|
||||
if w + b < 10
|
||||
" let table[s] = w + b
|
||||
let table = strpart(table, 0, s) . (w+b) . strpart(table, s+1)
|
||||
endif
|
||||
let b = b + 1
|
||||
let s = s + 1
|
||||
else
|
||||
execute s:Ref(backref, b, "start", "len")
|
||||
let ref = strpart(backref, start, len)
|
||||
let backref = strpart(backref, 0, start) . ":". table[s]
|
||||
\ . strpart(backref, start+len)
|
||||
let s = s + s:Count(substitute(ref, '\\\\', '', 'g'), '\(', '1')
|
||||
endif
|
||||
endwhile
|
||||
let word = strpart(word, 0, i-1) . backref . strpart(word, i+1)
|
||||
let i = matchend(word, s:notslash . '\\\d') - 1
|
||||
endwhile
|
||||
let word = substitute(word, s:notslash . '\zs:', '\\', 'g')
|
||||
if a:output == "table"
|
||||
return table
|
||||
elseif a:output == "word"
|
||||
return word
|
||||
else
|
||||
return table . word
|
||||
endif
|
||||
endfun
|
||||
|
||||
" Assume a:comma = ",". Then the format for a:patterns and a:1 is
|
||||
" a:patterns = "<pat1>,<pat2>,..."
|
||||
" a:1 = "<alt1>,<alt2>,..."
|
||||
" If <patn> is the first pattern that matches a:string then return <patn>
|
||||
" if no optional arguments are given; return <patn>,<altn> if a:1 is given.
|
||||
fun! s:Choose(patterns, string, comma, branch, prefix, suffix, ...)
|
||||
let tail = (a:patterns =~ a:comma."$" ? a:patterns : a:patterns . a:comma)
|
||||
let i = matchend(tail, s:notslash . a:comma)
|
||||
if a:0
|
||||
let alttail = (a:1 =~ a:comma."$" ? a:1 : a:1 . a:comma)
|
||||
let j = matchend(alttail, s:notslash . a:comma)
|
||||
endif
|
||||
let current = strpart(tail, 0, i-1)
|
||||
if a:branch == ""
|
||||
let currpat = current
|
||||
else
|
||||
let currpat = substitute(current, s:notslash . a:branch, '\\|', 'g')
|
||||
endif
|
||||
while a:string !~ a:prefix . currpat . a:suffix
|
||||
let tail = strpart(tail, i)
|
||||
let i = matchend(tail, s:notslash . a:comma)
|
||||
if i == -1
|
||||
return -1
|
||||
endif
|
||||
let current = strpart(tail, 0, i-1)
|
||||
if a:branch == ""
|
||||
let currpat = current
|
||||
else
|
||||
let currpat = substitute(current, s:notslash . a:branch, '\\|', 'g')
|
||||
endif
|
||||
if a:0
|
||||
let alttail = strpart(alttail, j)
|
||||
let j = matchend(alttail, s:notslash . a:comma)
|
||||
endif
|
||||
endwhile
|
||||
if a:0
|
||||
let current = current . a:comma . strpart(alttail, 0, j-1)
|
||||
endif
|
||||
return current
|
||||
endfun
|
||||
|
||||
" Call this function to turn on debugging information. Every time the main
|
||||
" script is run, buffer variables will be saved. These can be used directly
|
||||
" or viewed using the menu items below.
|
||||
if !exists(":MatchDebug")
|
||||
command! -nargs=0 MatchDebug call s:Match_debug()
|
||||
endif
|
||||
|
||||
fun! s:Match_debug()
|
||||
let b:match_debug = 1 " Save debugging information.
|
||||
" pat = all of b:match_words with backrefs parsed
|
||||
amenu &Matchit.&pat :echo b:match_pat<CR>
|
||||
" match = bit of text that is recognized as a match
|
||||
amenu &Matchit.&match :echo b:match_match<CR>
|
||||
" curcol = cursor column of the start of the matching text
|
||||
amenu &Matchit.&curcol :echo b:match_col<CR>
|
||||
" wholeBR = matching group, original version
|
||||
amenu &Matchit.wh&oleBR :echo b:match_wholeBR<CR>
|
||||
" iniBR = 'if' piece, original version
|
||||
amenu &Matchit.ini&BR :echo b:match_iniBR<CR>
|
||||
" ini = 'if' piece, with all backrefs resolved from match
|
||||
amenu &Matchit.&ini :echo b:match_ini<CR>
|
||||
" tail = 'else\|endif' piece, with all backrefs resolved from match
|
||||
amenu &Matchit.&tail :echo b:match_tail<CR>
|
||||
" fin = 'endif' piece, with all backrefs resolved from match
|
||||
amenu &Matchit.&word :echo b:match_word<CR>
|
||||
" '\'.d in ini refers to the same thing as '\'.table[d] in word.
|
||||
amenu &Matchit.t&able :echo '0:' . b:match_table . ':9'<CR>
|
||||
endfun
|
||||
|
||||
" Jump to the nearest unmatched "(" or "if" or "<tag>" if a:spflag == "bW"
|
||||
" or the nearest unmatched "</tag>" or "endif" or ")" if a:spflag == "W".
|
||||
" Return a "mark" for the original position, so that
|
||||
" let m = MultiMatch("bW", "n") ... execute m
|
||||
" will return to the original position. If there is a problem, do not
|
||||
" move the cursor and return "", unless a count is given, in which case
|
||||
" go up or down as many levels as possible and again return "".
|
||||
" TODO This relies on the same patterns as % matching. It might be a good
|
||||
" idea to give it its own matching patterns.
|
||||
fun! s:MultiMatch(spflag, mode)
|
||||
if !exists("b:match_words") || b:match_words == ""
|
||||
return ""
|
||||
end
|
||||
let restore_options = (&ic ? "" : "no") . "ignorecase"
|
||||
if exists("b:match_ignorecase")
|
||||
let &ignorecase = b:match_ignorecase
|
||||
endif
|
||||
let startline = line(".")
|
||||
let startcol = col(".")
|
||||
|
||||
" First step: if not already done, set the script variables
|
||||
" s:do_BR flag for whether there are backrefs
|
||||
" s:pat parsed version of b:match_words
|
||||
" s:all regexp based on s:pat and the default groups
|
||||
" This part is copied and slightly modified from s:Match_wrapper().
|
||||
let default = escape(&mps, '[$^.*~\\/?]') . (strlen(&mps) ? "," : "") .
|
||||
\ '\/\*:\*\/,#\s*if\%(def\)\=:#\s*else\>:#\s*elif\>:#\s*endif\>'
|
||||
" Allow b:match_words = "GetVimMatchWords()" .
|
||||
if b:match_words =~ ":"
|
||||
let match_words = b:match_words
|
||||
else
|
||||
execute "let match_words =" b:match_words
|
||||
endif
|
||||
if (match_words != s:last_words) || (&mps != s:last_mps) ||
|
||||
\ exists("b:match_debug")
|
||||
let s:last_words = match_words
|
||||
let s:last_mps = &mps
|
||||
if match_words !~ s:notslash . '\\\d'
|
||||
let s:do_BR = 0
|
||||
let s:pat = match_words
|
||||
else
|
||||
let s:do_BR = 1
|
||||
let s:pat = s:ParseWords(match_words)
|
||||
endif
|
||||
let s:all = '\%(' . substitute(s:pat . (strlen(s:pat)?",":"") . default,
|
||||
\ '[,:]\+','\\|','g') . '\)'
|
||||
if exists("b:match_debug")
|
||||
let b:match_pat = s:pat
|
||||
endif
|
||||
endif
|
||||
|
||||
" Second step: figure out the patterns for searchpair()
|
||||
" and save the screen, cursor position, and 'ignorecase'.
|
||||
" - TODO: A lot of this is copied from s:Match_wrapper().
|
||||
" - maybe even more functionality should be split off
|
||||
" - into separate functions!
|
||||
let cdefault = (s:pat =~ '[^,]$' ? "," : "") . default
|
||||
let open = substitute(s:pat . cdefault,
|
||||
\ s:notslash . '\zs:.\{-}' . s:notslash . ',', '\\),\\(', 'g')
|
||||
let open = '\(' . substitute(open, s:notslash . '\zs:.*$', '\\)', '')
|
||||
let close = substitute(s:pat . cdefault,
|
||||
\ s:notslash . '\zs,.\{-}' . s:notslash . ':', '\\),\\(', 'g')
|
||||
let close = substitute(close, '^.\{-}' . s:notslash . ':', '\\(', '') . '\)'
|
||||
if exists("b:match_skip")
|
||||
let skip = b:match_skip
|
||||
elseif exists("b:match_comment") " backwards compatibility and testing!
|
||||
let skip = "r:" . b:match_comment
|
||||
else
|
||||
let skip = 's:comment\|string'
|
||||
endif
|
||||
let skip = s:ParseSkip(skip)
|
||||
" let restore_cursor = line(".") . "G" . virtcol(".") . "|"
|
||||
" normal! H
|
||||
" let restore_cursor = "normal!" . line(".") . "Gzt" . restore_cursor
|
||||
let restore_cursor = virtcol(".") . "|"
|
||||
normal! g0
|
||||
let restore_cursor = line(".") . "G" . virtcol(".") . "|zs" . restore_cursor
|
||||
normal! H
|
||||
let restore_cursor = "normal!" . line(".") . "Gzt" . restore_cursor
|
||||
execute restore_cursor
|
||||
|
||||
" Third step: call searchpair().
|
||||
" Replace '\('--but not '\\('--with '\%(' and ',' with '\|'.
|
||||
let openpat = substitute(open, '\(\\\@<!\(\\\\\)*\)\@<=\\(', '\\%(', 'g')
|
||||
let openpat = substitute(openpat, ',', '\\|', 'g')
|
||||
let closepat = substitute(close, '\(\\\@<!\(\\\\\)*\)\@<=\\(', '\\%(', 'g')
|
||||
let closepat = substitute(closepat, ',', '\\|', 'g')
|
||||
if skip =~ 'synID' && !(has("syntax") && exists("g:syntax_on"))
|
||||
let skip = '0'
|
||||
else
|
||||
execute "if " . skip . "| let skip = '0' | endif"
|
||||
endif
|
||||
mark '
|
||||
let level = v:count1
|
||||
while level
|
||||
if searchpair(openpat, '', closepat, a:spflag, skip) < 1
|
||||
call s:CleanUp(restore_options, a:mode, startline, startcol)
|
||||
return ""
|
||||
endif
|
||||
let level = level - 1
|
||||
endwhile
|
||||
|
||||
" Restore options and return a string to restore the original position.
|
||||
call s:CleanUp(restore_options, a:mode, startline, startcol)
|
||||
return restore_cursor
|
||||
endfun
|
||||
|
||||
" Search backwards for "if" or "while" or "<tag>" or ...
|
||||
" and return "endif" or "endwhile" or "</tag>" or ... .
|
||||
" For now, this uses b:match_words and the same script variables
|
||||
" as s:Match_wrapper() . Later, it may get its own patterns,
|
||||
" either from a buffer variable or passed as arguments.
|
||||
" fun! s:Autocomplete()
|
||||
" echo "autocomplete not yet implemented :-("
|
||||
" if !exists("b:match_words") || b:match_words == ""
|
||||
" return ""
|
||||
" end
|
||||
" let startpos = s:MultiMatch("bW")
|
||||
"
|
||||
" if startpos == ""
|
||||
" return ""
|
||||
" endif
|
||||
" " - TODO: figure out whether 'if' or '<tag>' matched, and construct
|
||||
" " - the appropriate closing.
|
||||
" let matchline = getline(".")
|
||||
" let curcol = col(".") - 1
|
||||
" " - TODO: Change the s:all argument if there is a new set of match pats.
|
||||
" let regexp = s:Wholematch(matchline, s:all, curcol)
|
||||
" let suf = strlen(matchline) - matchend(matchline, regexp)
|
||||
" let prefix = (curcol ? '^.\{' . curcol . '}\%(' : '^\%(')
|
||||
" let suffix = (suf ? '\).\{' . suf . '}$' : '\)$')
|
||||
" " Reconstruct the version with unresolved backrefs.
|
||||
" let patBR = substitute(b:match_words.',', '[,:]*,[,:]*', ',', 'g')
|
||||
" let patBR = substitute(patBR, ':\{2,}', ':', "g")
|
||||
" " Now, set group and groupBR to the matching group: 'if:endif' or
|
||||
" " 'while:endwhile' or whatever.
|
||||
" let group = s:Choose(s:pat, matchline, ",", ":", prefix, suffix, patBR)
|
||||
" let i = matchend(group, s:notslash . ",")
|
||||
" let groupBR = strpart(group, i)
|
||||
" let group = strpart(group, 0, i-1)
|
||||
" " Now, matchline =~ prefix . substitute(group,':','\|','g') . suffix
|
||||
" if s:do_BR
|
||||
" let group = s:InsertRefs(groupBR, prefix, group, suffix, matchline)
|
||||
" endif
|
||||
" " let g:group = group
|
||||
"
|
||||
" " - TODO: Construct the closing from group.
|
||||
" let fake = "end" . expand("<cword>")
|
||||
" execute startpos
|
||||
" return fake
|
||||
" endfun
|
||||
|
||||
" Close all open structures. "Get the heck out of here!"
|
||||
" fun! s:Gthhoh()
|
||||
" let close = s:Autocomplete()
|
||||
" while strlen(close)
|
||||
" put=close
|
||||
" let close = s:Autocomplete()
|
||||
" endwhile
|
||||
" endfun
|
||||
|
||||
" Parse special strings as typical skip arguments for searchpair():
|
||||
" s:foo becomes (current syntax item) =~ foo
|
||||
" S:foo becomes (current syntax item) !~ foo
|
||||
" r:foo becomes (line before cursor) =~ foo
|
||||
" R:foo becomes (line before cursor) !~ foo
|
||||
fun! s:ParseSkip(str)
|
||||
let skip = a:str
|
||||
if skip[1] == ":"
|
||||
if skip[0] == "s"
|
||||
let skip = "synIDattr(synID(line('.'),col('.'),1),'name') =~? '" .
|
||||
\ strpart(skip,2) . "'"
|
||||
elseif skip[0] == "S"
|
||||
let skip = "synIDattr(synID(line('.'),col('.'),1),'name') !~? '" .
|
||||
\ strpart(skip,2) . "'"
|
||||
elseif skip[0] == "r"
|
||||
let skip = "strpart(getline('.'),0,col('.'))=~'" . strpart(skip,2). "'"
|
||||
elseif skip[0] == "R"
|
||||
let skip = "strpart(getline('.'),0,col('.'))!~'" . strpart(skip,2). "'"
|
||||
endif
|
||||
endif
|
||||
return skip
|
||||
endfun
|
||||
|
||||
let &cpo = s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
||||
" vim:sts=2:sw=2:
|
||||
@@ -1,7 +1,7 @@
|
||||
" Vim syntax file
|
||||
" Language: Python
|
||||
" Maintainer: Zvezdan Petkovic <zpetkovic@acm.org>
|
||||
" Last Change: 2015 Sep 15
|
||||
" Last Change: 2016 Feb 20
|
||||
" Credits: Neil Schemenauer <nas@python.ca>
|
||||
" Dmitry Vasiliev
|
||||
"
|
||||
@@ -199,6 +199,8 @@ if !exists("python_no_builtin_highlight")
|
||||
syn keyword pythonBuiltin ascii bytes exec
|
||||
" non-essential built-in functions; Python 2 only
|
||||
syn keyword pythonBuiltin apply buffer coerce intern
|
||||
" avoid highlighting attributes as builtins
|
||||
syn match pythonAttribute /\.\h\w*/hs=s+1 contains=ALLBUT,pythonBuiltin transparent
|
||||
endif
|
||||
|
||||
" From the 'Python Library Reference' class hierarchy at the bottom.
|
||||
|
||||
@@ -5,17 +5,21 @@
|
||||
" Tom Payne <tom@tompayne.org>
|
||||
" Contributor: Johannes Ranke <jranke@uni-bremen.de>
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Wed Oct 21, 2015 06:33AM
|
||||
" Last Change: Thu Mar 10, 2016 12:26PM
|
||||
" Filenames: *.R *.r *.Rhistory *.Rt
|
||||
"
|
||||
" NOTE: The highlighting of R functions is defined in
|
||||
" runtime files created by a filetype plugin, if installed.
|
||||
"
|
||||
" CONFIGURATION:
|
||||
" syntax folding can be turned on by
|
||||
" Syntax folding can be turned on by
|
||||
"
|
||||
" let r_syntax_folding = 1
|
||||
"
|
||||
" ROxygen highlighting can be turned off by
|
||||
"
|
||||
" let r_hl_roxygen = 0
|
||||
"
|
||||
" Some lines of code were borrowed from Zhuojun Chen.
|
||||
|
||||
if exists("b:current_syntax")
|
||||
@@ -24,9 +28,12 @@ endif
|
||||
|
||||
setlocal iskeyword=@,48-57,_,.
|
||||
|
||||
if exists("g:r_syntax_folding")
|
||||
if exists("g:r_syntax_folding") && g:r_syntax_folding
|
||||
setlocal foldmethod=syntax
|
||||
endif
|
||||
if !exists("g:r_hl_roxygen")
|
||||
let g:r_hl_roxygen = 1
|
||||
endif
|
||||
|
||||
syn case match
|
||||
|
||||
@@ -35,18 +42,20 @@ syn match rCommentTodo contained "\(BUG\|FIXME\|NOTE\|TODO\):"
|
||||
syn match rComment contains=@Spell,rCommentTodo,rOBlock "#.*"
|
||||
|
||||
" Roxygen
|
||||
syn region rOBlock start="^\s*\n#\{1,2}' " start="\%^#\{1,2}' " end="^\(#\{1,2}'\)\@!" contains=rOTitle,rOKeyword,rOExamples,@Spell keepend
|
||||
syn region rOTitle start="^\s*\n#\{1,2}' " start="\%^#\{1,2}' " end="^\(#\{1,2}'\s*$\)\@=" contained contains=rOCommentKey
|
||||
syn match rOCommentKey "#\{1,2}'" containedin=rOTitle contained
|
||||
if g:r_hl_roxygen
|
||||
syn region rOBlock start="^\s*\n#\{1,2}' " start="\%^#\{1,2}' " end="^\(#\{1,2}'\)\@!" contains=rOTitle,rOKeyword,rOExamples,@Spell keepend
|
||||
syn region rOTitle start="^\s*\n#\{1,2}' " start="\%^#\{1,2}' " end="^\(#\{1,2}'\s*$\)\@=" contained contains=rOCommentKey
|
||||
syn match rOCommentKey "#\{1,2}'" containedin=rOTitle contained
|
||||
|
||||
syn region rOExamples start="^#\{1,2}' @examples.*"rs=e+1,hs=e+1 end="^\(#\{1,2}' @.*\)\@=" end="^\(#\{1,2}'\)\@!" contained contains=rOKeyword
|
||||
syn region rOExamples start="^#\{1,2}' @examples.*"rs=e+1,hs=e+1 end="^\(#\{1,2}' @.*\)\@=" end="^\(#\{1,2}'\)\@!" contained contains=rOKeyword
|
||||
|
||||
syn match rOKeyword contained "@\(param\|return\|name\|rdname\|examples\|example\|include\|docType\)"
|
||||
syn match rOKeyword contained "@\(S3method\|TODO\|aliases\|alias\|assignee\|author\|callGraphDepth\|callGraph\)"
|
||||
syn match rOKeyword contained "@\(callGraphPrimitives\|concept\|exportClass\|exportMethod\|exportPattern\|export\|formals\)"
|
||||
syn match rOKeyword contained "@\(format\|importClassesFrom\|importFrom\|importMethodsFrom\|import\|keywords\|useDynLib\)"
|
||||
syn match rOKeyword contained "@\(method\|noRd\|note\|references\|seealso\|setClass\|slot\|source\|title\|usage\)"
|
||||
syn match rOKeyword contained "@\(family\|template\|templateVar\|description\|details\|inheritParams\|field\)"
|
||||
syn match rOKeyword contained "@\(param\|return\|name\|rdname\|examples\|example\|include\|docType\)"
|
||||
syn match rOKeyword contained "@\(S3method\|TODO\|aliases\|alias\|assignee\|author\|callGraphDepth\|callGraph\)"
|
||||
syn match rOKeyword contained "@\(callGraphPrimitives\|concept\|exportClass\|exportMethod\|exportPattern\|export\|formals\)"
|
||||
syn match rOKeyword contained "@\(format\|importClassesFrom\|importFrom\|importMethodsFrom\|import\|keywords\|useDynLib\)"
|
||||
syn match rOKeyword contained "@\(method\|noRd\|note\|references\|seealso\|setClass\|slot\|source\|title\|usage\)"
|
||||
syn match rOKeyword contained "@\(family\|template\|templateVar\|description\|details\|inheritParams\|field\)"
|
||||
endif
|
||||
|
||||
|
||||
if &filetype == "rhelp"
|
||||
@@ -159,12 +168,13 @@ syn match rBraceError "[)}]" contained
|
||||
syn match rCurlyError "[)\]]" contained
|
||||
syn match rParenError "[\]}]" contained
|
||||
|
||||
" Source list of R functions produced by a filetype plugin (if installed)
|
||||
if has("nvim")
|
||||
" Nvim-R
|
||||
if !exists("g:R_hi_fun")
|
||||
let g:R_hi_fun = 1
|
||||
endif
|
||||
if g:R_hi_fun
|
||||
" Nvim-R:
|
||||
runtime R/functions.vim
|
||||
else
|
||||
" Vim-R-plugin
|
||||
" Vim-R-plugin:
|
||||
runtime r-plugin/functions.vim
|
||||
endif
|
||||
|
||||
@@ -235,11 +245,13 @@ hi def link rStatement Statement
|
||||
hi def link rString String
|
||||
hi def link rStrError Error
|
||||
hi def link rType Type
|
||||
hi def link rOKeyword Title
|
||||
hi def link rOBlock Comment
|
||||
hi def link rOTitle Title
|
||||
hi def link rOCommentKey Comment
|
||||
hi def link rOExamples SpecialComment
|
||||
if g:r_hl_roxygen
|
||||
hi def link rOKeyword Title
|
||||
hi def link rOBlock Comment
|
||||
hi def link rOTitle Title
|
||||
hi def link rOCommentKey Comment
|
||||
hi def link rOExamples SpecialComment
|
||||
endif
|
||||
|
||||
|
||||
let b:current_syntax="r"
|
||||
|
||||
@@ -2,25 +2,21 @@
|
||||
" Language: R Help File
|
||||
" Maintainer: Jakson Aquino <jalvesaq@gmail.com>
|
||||
" Former Maintainer: Johannes Ranke <jranke@uni-bremen.de>
|
||||
" Last Change: Wed Jul 09, 2014 10:28PM
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Sat Feb 06, 2016 11:34AM
|
||||
" Remarks: - Includes R syntax highlighting in the appropriate
|
||||
" sections if an r.vim file is in the same directory or in the
|
||||
" default debian location.
|
||||
" - There is no Latex markup in equations
|
||||
" - Thanks to Will Gray for finding and fixing a bug
|
||||
" - No support for \if, \ifelse and \out as I don't understand
|
||||
" them and have no examples at hand (help welcome).
|
||||
" - No support for \var tag within quoted string (dito)
|
||||
" - No support for \var tag within quoted string
|
||||
|
||||
" Version Clears: {{{1
|
||||
" For version 5.x: Clear all syntax items
|
||||
" For version 6.x and 7.x: Quit when a syntax file was already loaded
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
scriptencoding utf-8
|
||||
setlocal iskeyword=@,48-57,_,.
|
||||
|
||||
syn case match
|
||||
@@ -29,9 +25,11 @@ syn case match
|
||||
syn region rhelpIdentifier matchgroup=rhelpSection start="\\name{" end="}"
|
||||
syn region rhelpIdentifier matchgroup=rhelpSection start="\\alias{" end="}"
|
||||
syn region rhelpIdentifier matchgroup=rhelpSection start="\\pkg{" end="}" contains=rhelpLink
|
||||
syn region rhelpIdentifier matchgroup=rhelpSection start="\\CRANpkg{" end="}" contains=rhelpLink
|
||||
syn region rhelpIdentifier matchgroup=rhelpSection start="\\method{" end="}" contained
|
||||
syn region rhelpIdentifier matchgroup=rhelpSection start="\\Rdversion{" end="}"
|
||||
|
||||
|
||||
" Highlighting of R code using an existing r.vim syntax file if available {{{1
|
||||
syn include @R syntax/r.vim
|
||||
|
||||
@@ -69,76 +67,115 @@ syn match rhelpDelimiter "\\cr"
|
||||
syn match rhelpDelimiter "\\tab "
|
||||
|
||||
" Keywords {{{1
|
||||
syn match rhelpKeyword "\\R"
|
||||
syn match rhelpKeyword "\\ldots"
|
||||
syn match rhelpKeyword "\\R\>"
|
||||
syn match rhelpKeyword "\\ldots\>"
|
||||
syn match rhelpKeyword "\\sspace\>"
|
||||
syn match rhelpKeyword "--"
|
||||
syn match rhelpKeyword "---"
|
||||
syn match rhelpKeyword "<"
|
||||
syn match rhelpKeyword ">"
|
||||
syn match rhelpKeyword "\\ge"
|
||||
syn match rhelpKeyword "\\le"
|
||||
syn match rhelpKeyword "\\alpha"
|
||||
syn match rhelpKeyword "\\beta"
|
||||
syn match rhelpKeyword "\\gamma"
|
||||
syn match rhelpKeyword "\\delta"
|
||||
syn match rhelpKeyword "\\epsilon"
|
||||
syn match rhelpKeyword "\\zeta"
|
||||
syn match rhelpKeyword "\\eta"
|
||||
syn match rhelpKeyword "\\theta"
|
||||
syn match rhelpKeyword "\\iota"
|
||||
syn match rhelpKeyword "\\kappa"
|
||||
syn match rhelpKeyword "\\lambda"
|
||||
syn match rhelpKeyword "\\mu"
|
||||
syn match rhelpKeyword "\\nu"
|
||||
syn match rhelpKeyword "\\xi"
|
||||
syn match rhelpKeyword "\\omicron"
|
||||
syn match rhelpKeyword "\\pi"
|
||||
syn match rhelpKeyword "\\rho"
|
||||
syn match rhelpKeyword "\\sigma"
|
||||
syn match rhelpKeyword "\\tau"
|
||||
syn match rhelpKeyword "\\upsilon"
|
||||
syn match rhelpKeyword "\\phi"
|
||||
syn match rhelpKeyword "\\chi"
|
||||
syn match rhelpKeyword "\\psi"
|
||||
syn match rhelpKeyword "\\omega"
|
||||
syn match rhelpKeyword "\\Alpha"
|
||||
syn match rhelpKeyword "\\Beta"
|
||||
syn match rhelpKeyword "\\Gamma"
|
||||
syn match rhelpKeyword "\\Delta"
|
||||
syn match rhelpKeyword "\\Epsilon"
|
||||
syn match rhelpKeyword "\\Zeta"
|
||||
syn match rhelpKeyword "\\Eta"
|
||||
syn match rhelpKeyword "\\Theta"
|
||||
syn match rhelpKeyword "\\Iota"
|
||||
syn match rhelpKeyword "\\Kappa"
|
||||
syn match rhelpKeyword "\\Lambda"
|
||||
syn match rhelpKeyword "\\Mu"
|
||||
syn match rhelpKeyword "\\Nu"
|
||||
syn match rhelpKeyword "\\Xi"
|
||||
syn match rhelpKeyword "\\Omicron"
|
||||
syn match rhelpKeyword "\\Pi"
|
||||
syn match rhelpKeyword "\\Rho"
|
||||
syn match rhelpKeyword "\\Sigma"
|
||||
syn match rhelpKeyword "\\Tau"
|
||||
syn match rhelpKeyword "\\Upsilon"
|
||||
syn match rhelpKeyword "\\Phi"
|
||||
syn match rhelpKeyword "\\Chi"
|
||||
syn match rhelpKeyword "\\Psi"
|
||||
syn match rhelpKeyword "\\Omega"
|
||||
|
||||
" Condition Keywords {{{2
|
||||
syn match rhelpKeyword "\\if\>"
|
||||
syn match rhelpKeyword "\\ifelse\>"
|
||||
syn match rhelpKeyword "\\out\>"
|
||||
" Examples of usage:
|
||||
" \ifelse{latex}{\eqn{p = 5 + 6 - 7 \times 8}}{\eqn{p = 5 + 6 - 7 * 8}}
|
||||
" \ifelse{latex}{\out{$\alpha$}}{\ifelse{html}{\out{α}}{alpha}}
|
||||
|
||||
" Keywords and operators valid only if in math mode {{{2
|
||||
syn match rhelpMathOp "<" contained
|
||||
syn match rhelpMathOp ">" contained
|
||||
syn match rhelpMathOp "+" contained
|
||||
syn match rhelpMathOp "-" contained
|
||||
syn match rhelpMathOp "=" contained
|
||||
|
||||
" Conceal function based on syntax/tex.vim {{{2
|
||||
if exists("g:tex_conceal")
|
||||
let s:tex_conceal = g:tex_conceal
|
||||
else
|
||||
let s:tex_conceal = 'gm'
|
||||
endif
|
||||
function s:HideSymbol(pat, cchar, hide)
|
||||
if a:hide
|
||||
exe "syn match rhelpMathSymb '" . a:pat . "' contained conceal cchar=" . a:cchar
|
||||
else
|
||||
exe "syn match rhelpMathSymb '" . a:pat . "' contained"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Math symbols {{{2
|
||||
if s:tex_conceal =~ 'm'
|
||||
let s:hd = 1
|
||||
else
|
||||
let s:hd = 0
|
||||
endif
|
||||
call s:HideSymbol('\\infty\>', '∞', s:hd)
|
||||
call s:HideSymbol('\\ge\>', '≥', s:hd)
|
||||
call s:HideSymbol('\\le\>', '≤', s:hd)
|
||||
call s:HideSymbol('\\prod\>', '∏', s:hd)
|
||||
call s:HideSymbol('\\sum\>', '∑', s:hd)
|
||||
syn match rhelpMathSymb "\\sqrt\>" contained
|
||||
|
||||
" Greek letters {{{2
|
||||
if s:tex_conceal =~ 'g'
|
||||
let s:hd = 1
|
||||
else
|
||||
let s:hd = 0
|
||||
endif
|
||||
call s:HideSymbol('\\alpha\>', 'α', s:hd)
|
||||
call s:HideSymbol('\\beta\>', 'β', s:hd)
|
||||
call s:HideSymbol('\\gamma\>', 'γ', s:hd)
|
||||
call s:HideSymbol('\\delta\>', 'δ', s:hd)
|
||||
call s:HideSymbol('\\epsilon\>', 'ϵ', s:hd)
|
||||
call s:HideSymbol('\\zeta\>', 'ζ', s:hd)
|
||||
call s:HideSymbol('\\eta\>', 'η', s:hd)
|
||||
call s:HideSymbol('\\theta\>', 'θ', s:hd)
|
||||
call s:HideSymbol('\\iota\>', 'ι', s:hd)
|
||||
call s:HideSymbol('\\kappa\>', 'κ', s:hd)
|
||||
call s:HideSymbol('\\lambda\>', 'λ', s:hd)
|
||||
call s:HideSymbol('\\mu\>', 'μ', s:hd)
|
||||
call s:HideSymbol('\\nu\>', 'ν', s:hd)
|
||||
call s:HideSymbol('\\xi\>', 'ξ', s:hd)
|
||||
call s:HideSymbol('\\pi\>', 'π', s:hd)
|
||||
call s:HideSymbol('\\rho\>', 'ρ', s:hd)
|
||||
call s:HideSymbol('\\sigma\>', 'σ', s:hd)
|
||||
call s:HideSymbol('\\tau\>', 'τ', s:hd)
|
||||
call s:HideSymbol('\\upsilon\>', 'υ', s:hd)
|
||||
call s:HideSymbol('\\phi\>', 'ϕ', s:hd)
|
||||
call s:HideSymbol('\\chi\>', 'χ', s:hd)
|
||||
call s:HideSymbol('\\psi\>', 'ψ', s:hd)
|
||||
call s:HideSymbol('\\omega\>', 'ω', s:hd)
|
||||
call s:HideSymbol('\\Gamma\>', 'Γ', s:hd)
|
||||
call s:HideSymbol('\\Delta\>', 'Δ', s:hd)
|
||||
call s:HideSymbol('\\Theta\>', 'Θ', s:hd)
|
||||
call s:HideSymbol('\\Lambda\>', 'Λ', s:hd)
|
||||
call s:HideSymbol('\\Xi\>', 'Ξ', s:hd)
|
||||
call s:HideSymbol('\\Pi\>', 'Π', s:hd)
|
||||
call s:HideSymbol('\\Sigma\>', 'Σ', s:hd)
|
||||
call s:HideSymbol('\\Upsilon\>', 'Υ', s:hd)
|
||||
call s:HideSymbol('\\Phi\>', 'Φ', s:hd)
|
||||
call s:HideSymbol('\\Psi\>', 'Ψ', s:hd)
|
||||
call s:HideSymbol('\\Omega\>', 'Ω', s:hd)
|
||||
delfunction s:HideSymbol
|
||||
" Note: The letters 'omicron', 'Alpha', 'Beta', 'Epsilon', 'Zeta', 'Eta',
|
||||
" 'Iota', 'Kappa', 'Mu', 'Nu', 'Omicron', 'Rho', 'Tau' and 'Chi' are listed
|
||||
" at src/library/tools/R/Rd2txt.R because they are valid in HTML, although
|
||||
" they do not make valid LaTeX code (e.g. Α versus \Alpha).
|
||||
|
||||
" Links {{{1
|
||||
syn region rhelpLink matchgroup=rhelpSection start="\\link{" end="}" contained keepend extend
|
||||
syn region rhelpLink matchgroup=rhelpSection start="\\link\[.\{-}\]{" end="}" contained keepend extend
|
||||
syn region rhelpLink matchgroup=rhelpSection start="\\linkS4class{" end="}" contained keepend extend
|
||||
syn region rhelpLink matchgroup=rhelpType start="\\link{" end="}" contained keepend extend
|
||||
syn region rhelpLink matchgroup=rhelpType start="\\link\[.\{-}\]{" end="}" contained keepend extend
|
||||
syn region rhelpLink matchgroup=rhelpType start="\\linkS4class{" end="}" contained keepend extend
|
||||
syn region rhelpLink matchgroup=rhelpType start="\\url{" end="}" contained keepend extend
|
||||
syn region rhelpLink matchgroup=rhelpType start="\\href{" end="}" contained keepend extend
|
||||
syn region rhelpLink matchgroup=rhelpType start="\\figure{" end="}" contained keepend extend
|
||||
|
||||
" Verbatim like {{{1
|
||||
if v:version > 703
|
||||
syn region rhelpVerbatim matchgroup=rhelpType start="\\samp{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpSpecialChar,rhelpComment
|
||||
syn region rhelpVerbatim matchgroup=rhelpType start="\\verb{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpSpecialChar,rhelpComment
|
||||
else
|
||||
syn region rhelpVerbatim matchgroup=rhelpType start="\\samp{" skip='\\\@<!{.\{-}\\\@<!}' end="}" contains=rhelpSpecialChar,rhelpComment
|
||||
syn region rhelpVerbatim matchgroup=rhelpType start="\\verb{" skip='\\\@<!{.\{-}\\\@<!}' end="}" contains=rhelpSpecialChar,rhelpComment
|
||||
endif
|
||||
syn region rhelpVerbatim matchgroup=rhelpType start="\\samp{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpSpecialChar,rhelpComment
|
||||
syn region rhelpVerbatim matchgroup=rhelpType start="\\verb{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpSpecialChar,rhelpComment
|
||||
|
||||
" Equation {{{1
|
||||
syn region rhelpEquation matchgroup=rhelpType start="\\eqn{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpMathSymb,rhelpMathOp,rhelpRegion contained keepend extend
|
||||
syn region rhelpEquation matchgroup=rhelpType start="\\deqn{" skip='\\\@1<!{.\{-}\\\@1<!}' end="}" contains=rhelpMathSymb,rhelpMathOp,rhelpRegion contained keepend extend
|
||||
|
||||
" Type Styles {{{1
|
||||
syn match rhelpType "\\emph\>"
|
||||
@@ -148,12 +185,9 @@ syn match rhelpType "\\sQuote\>"
|
||||
syn match rhelpType "\\dQuote\>"
|
||||
syn match rhelpType "\\preformatted\>"
|
||||
syn match rhelpType "\\kbd\>"
|
||||
syn match rhelpType "\\eqn\>"
|
||||
syn match rhelpType "\\deqn\>"
|
||||
syn match rhelpType "\\file\>"
|
||||
syn match rhelpType "\\email\>"
|
||||
syn match rhelpType "\\url\>"
|
||||
syn match rhelpType "\\href\>"
|
||||
syn match rhelpType "\\enc\>"
|
||||
syn match rhelpType "\\var\>"
|
||||
syn match rhelpType "\\env\>"
|
||||
syn match rhelpType "\\option\>"
|
||||
@@ -163,6 +197,7 @@ syn match rhelpType "\\renewcommand\>"
|
||||
syn match rhelpType "\\dfn\>"
|
||||
syn match rhelpType "\\cite\>"
|
||||
syn match rhelpType "\\acronym\>"
|
||||
syn match rhelpType "\\doi\>"
|
||||
|
||||
" rhelp sections {{{1
|
||||
syn match rhelpSection "\\encoding\>"
|
||||
@@ -202,9 +237,9 @@ syn match rhelpDelimiter "{\|\[\|(\|)\|\]\|}"
|
||||
syn match rhelpComment /%.*$/
|
||||
|
||||
" Error {{{1
|
||||
syn region rhelpRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim
|
||||
syn region rhelpRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim
|
||||
syn region rhelpRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim
|
||||
syn region rhelpRegion matchgroup=Delimiter start=/(/ matchgroup=Delimiter end=/)/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim,rhelpEquation
|
||||
syn region rhelpRegion matchgroup=Delimiter start=/{/ matchgroup=Delimiter end=/}/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim,rhelpEquation
|
||||
syn region rhelpRegion matchgroup=Delimiter start=/\[/ matchgroup=Delimiter end=/]/ contains=@Spell,rhelpCodeSpecial,rhelpComment,rhelpDelimiter,rhelpDots,rhelpFreesec,rhelpFreesubsec,rhelpIdentifier,rhelpKeyword,rhelpLink,rhelpPreProc,rhelpRComment,rhelpRcode,rhelpRegion,rhelpS4method,rhelpSection,rhelpSexpr,rhelpSpecialChar,rhelpString,rhelpType,rhelpVerbatim,rhelpEquation
|
||||
syn match rhelpError /[)\]}]/
|
||||
syn match rhelpBraceError /[)}]/ contained
|
||||
syn match rhelpCurlyError /[)\]]/ contained
|
||||
@@ -213,36 +248,27 @@ syn match rhelpParenError /[\]}]/ contained
|
||||
syntax sync match rhelpSyncRcode grouphere rhelpRcode "\\examples{"
|
||||
|
||||
" Define the default highlighting {{{1
|
||||
" For version 5.7 and earlier: only when not done already
|
||||
" For version 5.8 and later: only when an item doesn't have highlighting yet
|
||||
if version >= 508 || !exists("did_rhelp_syntax_inits")
|
||||
if version < 508
|
||||
let did_rhelp_syntax_inits = 1
|
||||
command -nargs=+ HiLink hi link <args>
|
||||
else
|
||||
command -nargs=+ HiLink hi def link <args>
|
||||
endif
|
||||
HiLink rhelpVerbatim String
|
||||
HiLink rhelpDelimiter Delimiter
|
||||
HiLink rhelpIdentifier Identifier
|
||||
HiLink rhelpString String
|
||||
HiLink rhelpCodeSpecial Special
|
||||
HiLink rhelpKeyword Keyword
|
||||
HiLink rhelpDots Keyword
|
||||
HiLink rhelpLink Underlined
|
||||
HiLink rhelpType Type
|
||||
HiLink rhelpSection PreCondit
|
||||
HiLink rhelpError Error
|
||||
HiLink rhelpBraceError Error
|
||||
HiLink rhelpCurlyError Error
|
||||
HiLink rhelpParenError Error
|
||||
HiLink rhelpPreProc PreProc
|
||||
HiLink rhelpDelimiter Delimiter
|
||||
HiLink rhelpComment Comment
|
||||
HiLink rhelpRComment Comment
|
||||
HiLink rhelpSpecialChar SpecialChar
|
||||
delcommand HiLink
|
||||
endif
|
||||
hi def link rhelpVerbatim String
|
||||
hi def link rhelpDelimiter Delimiter
|
||||
hi def link rhelpIdentifier Identifier
|
||||
hi def link rhelpString String
|
||||
hi def link rhelpCodeSpecial Special
|
||||
hi def link rhelpKeyword Keyword
|
||||
hi def link rhelpDots Keyword
|
||||
hi def link rhelpLink Underlined
|
||||
hi def link rhelpType Type
|
||||
hi def link rhelpSection PreCondit
|
||||
hi def link rhelpError Error
|
||||
hi def link rhelpBraceError Error
|
||||
hi def link rhelpCurlyError Error
|
||||
hi def link rhelpParenError Error
|
||||
hi def link rhelpPreProc PreProc
|
||||
hi def link rhelpDelimiter Delimiter
|
||||
hi def link rhelpComment Comment
|
||||
hi def link rhelpRComment Comment
|
||||
hi def link rhelpSpecialChar SpecialChar
|
||||
hi def link rhelpMathSymb Special
|
||||
hi def link rhelpMathOp Operator
|
||||
|
||||
let b:current_syntax = "rhelp"
|
||||
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
" markdown Text with R statements
|
||||
" Language: markdown with R code chunks
|
||||
" Last Change: Wed Jul 09, 2014 10:29PM
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Sat Feb 06, 2016 06:45AM
|
||||
"
|
||||
" CONFIGURATION:
|
||||
" To highlight chunk headers as R code, put in your vimrc:
|
||||
" let rmd_syn_hl_chunk = 1
|
||||
|
||||
" for portability
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
@@ -58,6 +56,8 @@ if rmdIsPandoc == 0
|
||||
if exists("b:current_syntax")
|
||||
unlet b:current_syntax
|
||||
endif
|
||||
" Extend cluster
|
||||
syn cluster texMathZoneGroup add=rmdrInline
|
||||
" Inline
|
||||
syntax match rmdLaTeXInlDelim "\$"
|
||||
syntax match rmdLaTeXInlDelim "\\\$"
|
||||
|
||||
@@ -1,20 +1,14 @@
|
||||
" Vim syntax file
|
||||
" Language: R noweb Files
|
||||
" Maintainer: Johannes Ranke <jranke@uni-bremen.de>
|
||||
" Last Change: 2009 May 05
|
||||
" Version: 0.9
|
||||
" SVN: $Id: rnoweb.vim 84 2009-05-03 19:52:47Z ranke $
|
||||
" Last Change: Sat Feb 06, 2016 06:47AM
|
||||
" Version: 0.9.1
|
||||
" Remarks: - This file is inspired by the proposal of
|
||||
" Fernando Henrique Ferraz Pereira da Rosa <feferraz@ime.usp.br>
|
||||
" http://www.ime.usp.br/~feferraz/en/sweavevim.html
|
||||
" Fernando Henrique Ferraz Pereira da Rosa <feferraz@ime.usp.br>
|
||||
" http://www.ime.usp.br/~feferraz/en/sweavevim.html
|
||||
"
|
||||
|
||||
" Version Clears: {{{1
|
||||
" For version 5.x: Clear all syntax items
|
||||
" For version 6.x and 7.x: Quit when a syntax file was already loaded
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
@@ -26,21 +20,22 @@ unlet b:current_syntax
|
||||
|
||||
syn cluster texMatchGroup add=@rnoweb
|
||||
syn cluster texMathMatchGroup add=rnowebSexpr
|
||||
syn cluster texMathZoneGroup add=rnowebSexpr
|
||||
syn cluster texEnvGroup add=@rnoweb
|
||||
syn cluster texFoldGroup add=@rnoweb
|
||||
syn cluster texDocGroup add=@rnoweb
|
||||
syn cluster texPartGroup add=@rnoweb
|
||||
syn cluster texChapterGroup add=@rnoweb
|
||||
syn cluster texSectionGroup add=@rnoweb
|
||||
syn cluster texSubSectionGroup add=@rnoweb
|
||||
syn cluster texSubSubSectionGroup add=@rnoweb
|
||||
syn cluster texParaGroup add=@rnoweb
|
||||
syn cluster texDocGroup add=@rnoweb
|
||||
syn cluster texPartGroup add=@rnoweb
|
||||
syn cluster texChapterGroup add=@rnoweb
|
||||
syn cluster texSectionGroup add=@rnoweb
|
||||
syn cluster texSubSectionGroup add=@rnoweb
|
||||
syn cluster texSubSubSectionGroup add=@rnoweb
|
||||
syn cluster texParaGroup add=@rnoweb
|
||||
|
||||
" Highlighting of R code using an existing r.vim syntax file if available {{{1
|
||||
syn include @rnowebR syntax/r.vim
|
||||
syn region rnowebChunk matchgroup=rnowebDelimiter start="^<<.*>>=" matchgroup=rnowebDelimiter end="^@" contains=@rnowebR,rnowebChunkReference,rnowebChunk fold keepend
|
||||
syn match rnowebChunkReference "^<<.*>>$" contained
|
||||
syn region rnowebSexpr matchgroup=Delimiter start="\\Sexpr{" matchgroup=Delimiter end="}" contains=@rnowebR
|
||||
syn region rnowebSexpr matchgroup=Delimiter start="\\Sexpr{" matchgroup=Delimiter end="}" contains=@rnowebR contained
|
||||
|
||||
" Sweave options command {{{1
|
||||
syn region rnowebSweaveopts matchgroup=Delimiter start="\\SweaveOpts{" matchgroup=Delimiter end="}"
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
" reStructured Text with R statements
|
||||
" Language: reST with R code chunks
|
||||
" Maintainer: Alex Zvoleff, azvoleff@mail.sdsu.edu
|
||||
" Last Change: Wed Jul 09, 2014 10:29PM
|
||||
" Homepage: https://github.com/jalvesaq/R-Vim-runtime
|
||||
" Last Change: Sat Feb 06, 2016 06:45AM
|
||||
"
|
||||
" CONFIGURATION:
|
||||
" To highlight chunk headers as R code, put in your vimrc:
|
||||
" let rrst_syn_hl_chunk = 1
|
||||
|
||||
" for portability
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
" Maintainer: Dominik Fischer <d dot f dot fischer at web dot de>
|
||||
" Contributor: Leonard Ehrenfried <leonard.ehrenfried@web.de>
|
||||
" Contributor: Karsten Hopp <karsten@redhat.com>
|
||||
" Last Change: 2016 Jan 15
|
||||
" SSH Version: 7.1
|
||||
" Last Change: 2016 Mar 1
|
||||
" SSH Version: 7.2
|
||||
"
|
||||
|
||||
" Setup
|
||||
@@ -40,26 +40,57 @@ syn keyword sshconfigYesNo yes no ask
|
||||
syn keyword sshconfigYesNo any auto
|
||||
syn keyword sshconfigYesNo force autoask none
|
||||
|
||||
syn keyword sshconfigCipher 3des blowfish
|
||||
syn keyword sshconfigCiphers aes128-cbc 3des-cbc blowfish blowfish-cbc cast128-cbc
|
||||
syn keyword sshconfigCiphers aes192-cbc aes256-cbc aes128-ctr aes192-ctr aes256-ctr
|
||||
syn keyword sshconfigCiphers arcfour arcfour128 arcfour256 cast128-cbc
|
||||
syn keyword sshconfigCipher 3des blowfish
|
||||
|
||||
syn keyword sshconfigMAC hmac-md5 hmac-sha1 hmac-ripemd160 hmac-sha1-96
|
||||
syn keyword sshconfigMAC hmac-md5-96
|
||||
syn keyword sshconfigMAC hmac-sha2-256 hmac-sha2-256-96 hmac-sha2-512
|
||||
syn keyword sshconfigMAC hmac-sha2-512-96
|
||||
syn keyword sshconfigCiphers 3des-cbc
|
||||
syn keyword sshconfigCiphers blowfish-cbc
|
||||
syn keyword sshconfigCiphers cast128-cbc
|
||||
syn keyword sshconfigCiphers arcfour
|
||||
syn keyword sshconfigCiphers arcfour128
|
||||
syn keyword sshconfigCiphers arcfour256
|
||||
syn keyword sshconfigCiphers aes128-cbc
|
||||
syn keyword sshconfigCiphers aes192-cbc
|
||||
syn keyword sshconfigCiphers aes256-cbc
|
||||
syn match sshconfigCiphers "\<rijndael-cbc@lysator\.liu.se\>"
|
||||
syn keyword sshconfigCiphers aes128-ctr
|
||||
syn keyword sshconfigCiphers aes192-ctr
|
||||
syn keyword sshconfigCiphers aes256-ctr
|
||||
syn match sshconfigCiphers "\<aes128-gcm@openssh\.com\>"
|
||||
syn match sshconfigCiphers "\<aes256-gcm@openssh\.com\>"
|
||||
syn match sshconfigCiphers "\<chacha20-poly1305@openssh\.com\>"
|
||||
|
||||
syn keyword sshconfigMAC hmac-sha1
|
||||
syn keyword sshconfigMAC mac-sha1-96
|
||||
syn keyword sshconfigMAC mac-sha2-256
|
||||
syn keyword sshconfigMAC mac-sha2-512
|
||||
syn keyword sshconfigMAC mac-md5
|
||||
syn keyword sshconfigMAC mac-md5-96
|
||||
syn keyword sshconfigMAC mac-ripemd160
|
||||
syn match sshconfigMAC "\<hmac-ripemd160@openssh\.com\>"
|
||||
syn match sshconfigMAC "\<umac-64@openssh\.com\>"
|
||||
syn match sshconfigMAC "\<umac-128@openssh\.com\>"
|
||||
syn match sshconfigMAC "\<hmac-sha1-etm@openssh\.com\>"
|
||||
syn match sshconfigMAC "\<hmac-sha1-96-etm@openssh\.com\>"
|
||||
syn match sshconfigMAC "\<hmac-sha2-256-etm@openssh\.com\>"
|
||||
syn match sshconfigMAC "\<hmac-sha2-512-etm@openssh\.com\>"
|
||||
syn match sshconfigMAC "\<hmac-md5-etm@openssh\.com\>"
|
||||
syn match sshconfigMAC "\<hmac-md5-96-etm@openssh\.com\>"
|
||||
syn match sshconfigMAC "\<hmac-ripemd160-etm@openssh\.com\>"
|
||||
syn match sshconfigMAC "\<umac-64-etm@openssh\.com\>"
|
||||
syn match sshconfigMAC "\<umac-128-etm@openssh\.com\>"
|
||||
|
||||
syn keyword sshconfigHostKeyAlg ssh-rsa ssh-dss
|
||||
syn match sshconfigHostKeyAlg "\<ecdsa-sha2-nistp256-cert-v01@openssh\.com\>"
|
||||
syn match sshconfigHostKeyAlg "\<ecdsa-sha2-nistp384-cert-v01@openssh\.com\>"
|
||||
syn match sshconfigHostKeyAlg "\<ecdsa-sha2-nistp521-cert-v01@openssh\.com\>"
|
||||
syn match sshconfigHostKeyAlg "\<ssh-rsa-cert-v01@openssh\.com\>"
|
||||
syn match sshconfigHostKeyAlg "\<ssh-dss-cert-v01@openssh\.com\>"
|
||||
syn match sshconfigHostKeyAlg "\<ssh-rsa-cert-v00@openssh\.com\>"
|
||||
syn match sshconfigHostKeyAlg "\<ssh-dss-cert-v00@openssh\.com\>"
|
||||
syn keyword sshconfigHostKeyAlg ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521
|
||||
syn keyword sshconfigHostKeyAlgo ssh-ed25519
|
||||
syn match sshconfigHostKeyAlgo "\<ssh-ed25519-cert-v01@openssh\.com\>"
|
||||
syn keyword sshconfigHostKeyAlgo ssh-rsa
|
||||
syn keyword sshconfigHostKeyAlgo ssh-dss
|
||||
syn keyword sshconfigHostKeyAlgo ecdsa-sha2-nistp256
|
||||
syn keyword sshconfigHostKeyAlgo ecdsa-sha2-nistp384
|
||||
syn keyword sshconfigHostKeyAlgo ecdsa-sha2-nistp521
|
||||
syn match sshconfigHostKeyAlgo "\<ssh-rsa-cert-v01@openssh\.com\>"
|
||||
syn match sshconfigHostKeyAlgo "\<ssh-dss-cert-v01@openssh\.com\>"
|
||||
syn match sshconfigHostKeyAlgo "\<ecdsa-sha2-nistp256-cert-v01@openssh\.com\>"
|
||||
syn match sshconfigHostKeyAlgo "\<ecdsa-sha2-nistp384-cert-v01@openssh\.com\>"
|
||||
syn match sshconfigHostKeyAlgo "\<ecdsa-sha2-nistp521-cert-v01@openssh\.com\>"
|
||||
|
||||
syn keyword sshconfigPreferredAuth hostbased publickey password gssapi-with-mic
|
||||
syn keyword sshconfigPreferredAuth keyboard-interactive
|
||||
@@ -78,11 +109,14 @@ syn match sshconfigIPQoS "cs[0-7]"
|
||||
syn keyword sshconfigIPQoS ef lowdelay throughput reliability
|
||||
syn keyword sshconfigKbdInteractive bsdauth pam skey
|
||||
|
||||
syn keyword sshconfigKexAlgo ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521
|
||||
syn keyword sshconfigKexAlgo diffie-hellman-group-exchange-sha256
|
||||
syn keyword sshconfigKexAlgo diffie-hellman-group-exchange-sha1
|
||||
syn keyword sshconfigKexAlgo diffie-hellman-group14-sha1
|
||||
syn keyword sshconfigKexAlgo diffie-hellman-group1-sha1
|
||||
syn keyword sshconfigKexAlgo diffie-hellman-group1-sha1
|
||||
syn keyword sshconfigKexAlgo diffie-hellman-group14-sha1
|
||||
syn keyword sshconfigKexAlgo diffie-hellman-group-exchange-sha1
|
||||
syn keyword sshconfigKexAlgo diffie-hellman-group-exchange-sha256
|
||||
syn keyword sshconfigKexAlgo ecdh-sha2-nistp256
|
||||
syn keyword sshconfigKexAlgo ecdh-sha2-nistp384
|
||||
syn keyword sshconfigKexAlgo ecdh-sha2-nistp521
|
||||
syn match sshconfigKexAlgo "\<curve25519-sha256@libssh\.org\>"
|
||||
|
||||
syn keyword sshconfigTunnel point-to-point ethernet
|
||||
|
||||
@@ -111,6 +145,7 @@ syn keyword sshconfigKeyword CanonicalDomains
|
||||
syn keyword sshconfigKeyword CanonicalizeFallbackLocal
|
||||
syn keyword sshconfigKeyword CanonicalizeHostname
|
||||
syn keyword sshconfigKeyword CanonicalizeMaxDots
|
||||
syn keyword sshconfigKeyword CertificateFile
|
||||
syn keyword sshconfigKeyword ChallengeResponseAuthentication
|
||||
syn keyword sshconfigKeyword CheckHostIP
|
||||
syn keyword sshconfigKeyword Cipher
|
||||
@@ -212,7 +247,7 @@ if version >= 508 || !exists("did_sshconfig_syntax_inits")
|
||||
HiLink sshconfigCipher sshconfigEnum
|
||||
HiLink sshconfigCiphers sshconfigEnum
|
||||
HiLink sshconfigMAC sshconfigEnum
|
||||
HiLink sshconfigHostKeyAlg sshconfigEnum
|
||||
HiLink sshconfigHostKeyAlgo sshconfigEnum
|
||||
HiLink sshconfigLogLevel sshconfigEnum
|
||||
HiLink sshconfigSysLogFacility sshconfigEnum
|
||||
HiLink sshconfigAddressFamily sshconfigEnum
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
" Contributor: Leonard Ehrenfried <leonard.ehrenfried@web.de>
|
||||
" Contributor: Karsten Hopp <karsten@redhat.com>
|
||||
" Originally: 2009-07-09
|
||||
" Last Change: 2016 Jan 12
|
||||
" SSH Version: 7.1
|
||||
" Last Change: 2016 Mar 1
|
||||
" SSH Version: 7.2
|
||||
"
|
||||
|
||||
" Setup
|
||||
@@ -47,15 +47,55 @@ syn keyword sshdconfigTcpForwarding local remote
|
||||
|
||||
syn keyword sshdconfigRootLogin prohibit-password without-password forced-commands-only
|
||||
|
||||
syn keyword sshdconfigCipher aes128-cbc 3des-cbc blowfish-cbc cast128-cbc
|
||||
syn keyword sshdconfigCipher aes192-cbc aes256-cbc aes128-ctr aes192-ctr aes256-ctr
|
||||
syn keyword sshdconfigCipher arcfour arcfour128 arcfour256 cast128-cbc
|
||||
syn keyword sshdconfigCiphers 3des-cbc
|
||||
syn keyword sshdconfigCiphers blowfish-cbc
|
||||
syn keyword sshdconfigCiphers cast128-cbc
|
||||
syn keyword sshdconfigCiphers arcfour
|
||||
syn keyword sshdconfigCiphers arcfour128
|
||||
syn keyword sshdconfigCiphers arcfour256
|
||||
syn keyword sshdconfigCiphers aes128-cbc
|
||||
syn keyword sshdconfigCiphers aes192-cbc
|
||||
syn keyword sshdconfigCiphers aes256-cbc
|
||||
syn match sshdconfigCiphers "\<rijndael-cbc@lysator\.liu.se\>"
|
||||
syn keyword sshdconfigCiphers aes128-ctr
|
||||
syn keyword sshdconfigCiphers aes192-ctr
|
||||
syn keyword sshdconfigCiphers aes256-ctr
|
||||
syn match sshdconfigCiphers "\<aes128-gcm@openssh\.com\>"
|
||||
syn match sshdconfigCiphers "\<aes256-gcm@openssh\.com\>"
|
||||
syn match sshdconfigCiphers "\<chacha20-poly1305@openssh\.com\>"
|
||||
|
||||
syn keyword sshdconfigMAC hmac-md5 hmac-sha1 hmac-ripemd160 hmac-sha1-96
|
||||
syn keyword sshdconfigMAC hmac-md5-96
|
||||
syn keyword sshdconfigMAC hmac-sha2-256 hmac-sha256-96 hmac-sha2-512
|
||||
syn keyword sshdconfigMAC hmac-sha2-512-96
|
||||
syn keyword sshdconfigMAC hmac-sha1
|
||||
syn keyword sshdconfigMAC mac-sha1-96
|
||||
syn keyword sshdconfigMAC mac-sha2-256
|
||||
syn keyword sshdconfigMAC mac-sha2-512
|
||||
syn keyword sshdconfigMAC mac-md5
|
||||
syn keyword sshdconfigMAC mac-md5-96
|
||||
syn keyword sshdconfigMAC mac-ripemd160
|
||||
syn match sshdconfigMAC "\<hmac-ripemd160@openssh\.com\>"
|
||||
syn match sshdconfigMAC "\<umac-64@openssh\.com\>"
|
||||
syn match sshdconfigMAC "\<umac-128@openssh\.com\>"
|
||||
syn match sshdconfigMAC "\<hmac-sha1-etm@openssh\.com\>"
|
||||
syn match sshdconfigMAC "\<hmac-sha1-96-etm@openssh\.com\>"
|
||||
syn match sshdconfigMAC "\<hmac-sha2-256-etm@openssh\.com\>"
|
||||
syn match sshdconfigMAC "\<hmac-sha2-512-etm@openssh\.com\>"
|
||||
syn match sshdconfigMAC "\<hmac-md5-etm@openssh\.com\>"
|
||||
syn match sshdconfigMAC "\<hmac-md5-96-etm@openssh\.com\>"
|
||||
syn match sshdconfigMAC "\<hmac-ripemd160-etm@openssh\.com\>"
|
||||
syn match sshdconfigMAC "\<umac-64-etm@openssh\.com\>"
|
||||
syn match sshdconfigMAC "\<umac-128-etm@openssh\.com\>"
|
||||
|
||||
syn keyword sshdconfigHostKeyAlgo ssh-ed25519
|
||||
syn match sshdconfigHostKeyAlgo "\<ssh-ed25519-cert-v01@openssh\.com\>"
|
||||
syn keyword sshdconfigHostKeyAlgo ssh-rsa
|
||||
syn keyword sshdconfigHostKeyAlgo ssh-dss
|
||||
syn keyword sshdconfigHostKeyAlgo ecdsa-sha2-nistp256
|
||||
syn keyword sshdconfigHostKeyAlgo ecdsa-sha2-nistp384
|
||||
syn keyword sshdconfigHostKeyAlgo ecdsa-sha2-nistp521
|
||||
syn match sshdconfigHostKeyAlgo "\<ssh-rsa-cert-v01@openssh\.com\>"
|
||||
syn match sshdconfigHostKeyAlgo "\<ssh-dss-cert-v01@openssh\.com\>"
|
||||
syn match sshdconfigHostKeyAlgo "\<ecdsa-sha2-nistp256-cert-v01@openssh\.com\>"
|
||||
syn match sshdconfigHostKeyAlgo "\<ecdsa-sha2-nistp384-cert-v01@openssh\.com\>"
|
||||
syn match sshdconfigHostKeyAlgo "\<ecdsa-sha2-nistp521-cert-v01@openssh\.com\>"
|
||||
|
||||
syn keyword sshdconfigRootLogin prohibit-password without-password forced-commands-only
|
||||
|
||||
@@ -73,11 +113,14 @@ syn match sshdconfigIPQoS "af4[123]"
|
||||
syn match sshdconfigIPQoS "cs[0-7]"
|
||||
syn keyword sshdconfigIPQoS ef lowdelay throughput reliability
|
||||
|
||||
syn keyword sshdconfigKexAlgo ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521
|
||||
syn keyword sshdconfigKexAlgo diffie-hellman-group-exchange-sha256
|
||||
syn keyword sshdconfigKexAlgo diffie-hellman-group-exchange-sha1
|
||||
syn keyword sshdconfigKexAlgo diffie-hellman-group14-sha1
|
||||
syn keyword sshdconfigKexAlgo diffie-hellman-group1-sha1
|
||||
syn keyword sshdconfigKexAlgo diffie-hellman-group1-sha1
|
||||
syn keyword sshdconfigKexAlgo diffie-hellman-group14-sha1
|
||||
syn keyword sshdconfigKexAlgo diffie-hellman-group-exchange-sha1
|
||||
syn keyword sshdconfigKexAlgo diffie-hellman-group-exchange-sha256
|
||||
syn keyword sshdconfigKexAlgo ecdh-sha2-nistp256
|
||||
syn keyword sshdconfigKexAlgo ecdh-sha2-nistp384
|
||||
syn keyword sshdconfigKexAlgo ecdh-sha2-nistp521
|
||||
syn match sshdconfigKexAlgo "\<curve25519-sha256@libssh\.org\>"
|
||||
|
||||
syn keyword sshdconfigTunnel point-to-point ethernet
|
||||
|
||||
@@ -215,8 +258,9 @@ if version >= 508 || !exists("did_sshdconfig_syntax_inits")
|
||||
HiLink sshdconfigPrivilegeSeparation sshdconfigEnum
|
||||
HiLink sshdconfigTcpForwarding sshdconfigEnum
|
||||
HiLink sshdconfigRootLogin sshdconfigEnum
|
||||
HiLink sshdconfigCipher sshdconfigEnum
|
||||
HiLink sshdconfigCiphers sshdconfigEnum
|
||||
HiLink sshdconfigMAC sshdconfigEnum
|
||||
HiLink sshdconfigHostKeyAlgo sshdconfigEnum
|
||||
HiLink sshdconfigRootLogin sshdconfigEnum
|
||||
HiLink sshdconfigLogLevel sshdconfigEnum
|
||||
HiLink sshdconfigSysLogFacility sshdconfigEnum
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
" Vim syntax file
|
||||
" Language: VHDL
|
||||
" Maintainer: Daniel Kho <daniel.kho@tauhop.com>
|
||||
" Language: VHDL [VHSIC (Very High Speed Integrated Circuit) Hardware Description Language]
|
||||
" Maintainer: Daniel Kho <daniel.kho@tauhop.com>
|
||||
" Previous Maintainer: Czo <Olivier.Sirol@lip6.fr>
|
||||
" Credits: Stephan Hegel <stephan.hegel@snc.siemens.com.cn>
|
||||
" Last Changed: 2015 Dec 4 by Daniel Kho
|
||||
" Credits: Stephan Hegel <stephan.hegel@snc.siemens.com.cn>
|
||||
" Last Changed: 2016 Mar 05 by Daniel Kho
|
||||
|
||||
" VHSIC (Very High Speed Integrated Circuit) Hardware Description Language
|
||||
|
||||
" For version 5.x: Clear all syntax items
|
||||
" For version 6.x: Quit when a syntax file was already loaded
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
@@ -56,17 +52,40 @@ syn keyword vhdlStatement note warning error failure
|
||||
syn match vhdlStatement "\<\(if\|else\)\>"
|
||||
syn match vhdlError "\<else\s\+if\>"
|
||||
|
||||
" Predefined VHDL types
|
||||
syn keyword vhdlType bit bit_vector
|
||||
syn keyword vhdlType character boolean integer real time
|
||||
syn keyword vhdlType boolean_vector integer_vector real_vector time_vector
|
||||
syn keyword vhdlType string severity_level
|
||||
" Predefined standard ieee VHDL types
|
||||
syn keyword vhdlType positive natural signed unsigned
|
||||
syn keyword vhdlType unresolved_signed unresolved_unsigned u_signed u_unsigned
|
||||
syn keyword vhdlType line text
|
||||
syn keyword vhdlType std_logic std_logic_vector
|
||||
syn keyword vhdlType std_ulogic std_ulogic_vector
|
||||
" Types and type qualifiers
|
||||
" Predefined standard VHDL types
|
||||
syn match vhdlType "\<bit\>\'\="
|
||||
syn match vhdlType "\<boolean\>\'\="
|
||||
syn match vhdlType "\<natural\>\'\="
|
||||
syn match vhdlType "\<positive\>\'\="
|
||||
syn match vhdlType "\<integer\>\'\="
|
||||
syn match vhdlType "\<real\>\'\="
|
||||
syn match vhdlType "\<time\>\'\="
|
||||
|
||||
syn match vhdlType "\<bit_vector\>\'\="
|
||||
syn match vhdlType "\<boolean_vector\>\'\="
|
||||
syn match vhdlType "\<integer_vector\>\'\="
|
||||
syn match vhdlType "\<real_vector\>\'\="
|
||||
syn match vhdlType "\<time_vector\>\'\="
|
||||
|
||||
syn match vhdlType "\<character\>\'\="
|
||||
syn match vhdlType "\<string\>\'\="
|
||||
"syn keyword vhdlType severity_level
|
||||
syn keyword vhdlType line
|
||||
syn keyword vhdlType text
|
||||
|
||||
" Predefined standard IEEE VHDL types
|
||||
syn match vhdlType "\<std_ulogic\>\'\="
|
||||
syn match vhdlType "\<std_logic\>\'\="
|
||||
syn match vhdlType "\<std_ulogic_vector\>\'\="
|
||||
syn match vhdlType "\<std_logic_vector\>\'\="
|
||||
syn match vhdlType "\<unresolved_signed\>\'\="
|
||||
syn match vhdlType "\<unresolved_unsigned\>\'\="
|
||||
syn match vhdlType "\<u_signed\>\'\="
|
||||
syn match vhdlType "\<u_unsigned\>\'\="
|
||||
syn match vhdlType "\<signed\>\'\="
|
||||
syn match vhdlType "\<unsigned\>\'\="
|
||||
|
||||
|
||||
" array attributes
|
||||
syn match vhdlAttribute "\'high"
|
||||
@@ -191,15 +210,23 @@ syn case ignore
|
||||
syn region vhdlComment start="/\*" end="\*/" contains=vhdlTodo,vhdlFixme,@Spell
|
||||
syn match vhdlComment "\(^\|\s\)--.*" contains=vhdlTodo,vhdlFixme,@Spell
|
||||
|
||||
" Standard IEEE P1076.6 preprocessor directives (metacomments).
|
||||
syn match vhdlPreProc "/\*\s*rtl_synthesis\s\+\(on\|off\)\s*\*/"
|
||||
syn match vhdlPreProc "\(^\|\s\)--\s*rtl_synthesis\s\+\(on\|off\)\s*"
|
||||
syn match vhdlPreProc "/\*\s*rtl_syn\s\+\(on\|off\)\s*\*/"
|
||||
syn match vhdlPreProc "\(^\|\s\)--\s*rtl_syn\s\+\(on\|off\)\s*"
|
||||
|
||||
" Industry-standard directives. These are not standard VHDL, but are commonly
|
||||
" used in the industry.
|
||||
syn match vhdlPreProc "/\*\s*synthesis\s\+translate_\(on\|off\)\s*\*/"
|
||||
"syn match vhdlPreProc "/\*\s*simulation\s\+translate_\(on\|off\)\s*\*/"
|
||||
syn match vhdlPreProc "/\*\s*pragma\s\+translate_\(on\|off\)\s*\*/"
|
||||
syn match vhdlPreProc "/\*\s*pragma\s\+synthesis_\(on\|off\)\s*\*/"
|
||||
syn match vhdlPreProc "/\*\s*synopsys\s\+translate_\(on\|off\)\s*\*/"
|
||||
|
||||
syn match vhdlPreProc "\(^\|\s\)--\s*synthesis\s\+translate_\(on\|off\)\s*"
|
||||
"syn match vhdlPreProc "\(^\|\s\)--\s*simulation\s\+translate_\(on\|off\)\s*"
|
||||
syn match vhdlPreProc "\(^\|\s\)--\s*pragma\s\+translate_\(on\|off\)\s*"
|
||||
syn match vhdlPreProc "\(^\|\s\)--\s*pragma\s\+synthesis_\(on\|off\)\s*"
|
||||
syn match vhdlPreProc "\(^\|\s\)--\s*synopsys\s\+translate_\(on\|off\)\s*"
|
||||
|
||||
@@ -216,24 +243,24 @@ if version >= 508 || !exists("did_vhdl_syntax_inits")
|
||||
else
|
||||
command -nargs=+ HiLink hi def link <args>
|
||||
endif
|
||||
|
||||
HiLink vhdlSpecial Special
|
||||
HiLink vhdlStatement Statement
|
||||
HiLink vhdlCharacter Character
|
||||
HiLink vhdlString String
|
||||
HiLink vhdlVector Number
|
||||
HiLink vhdlBoolean Number
|
||||
HiLink vhdlTodo Todo
|
||||
HiLink vhdlFixme Fixme
|
||||
HiLink vhdlComment Comment
|
||||
HiLink vhdlNumber Number
|
||||
HiLink vhdlTime Number
|
||||
HiLink vhdlType Type
|
||||
HiLink vhdlOperator Operator
|
||||
HiLink vhdlError Error
|
||||
HiLink vhdlAttribute Special
|
||||
HiLink vhdlPreProc PreProc
|
||||
|
||||
|
||||
HiLink vhdlSpecial Special
|
||||
HiLink vhdlStatement Statement
|
||||
HiLink vhdlCharacter Character
|
||||
HiLink vhdlString String
|
||||
HiLink vhdlVector Number
|
||||
HiLink vhdlBoolean Number
|
||||
HiLink vhdlTodo Todo
|
||||
HiLink vhdlFixme Fixme
|
||||
HiLink vhdlComment Comment
|
||||
HiLink vhdlNumber Number
|
||||
HiLink vhdlTime Number
|
||||
HiLink vhdlType Type
|
||||
HiLink vhdlOperator Operator
|
||||
HiLink vhdlError Error
|
||||
HiLink vhdlAttribute Special
|
||||
HiLink vhdlPreProc PreProc
|
||||
|
||||
delcommand HiLink
|
||||
endif
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
|
||||
if data == '':
|
||||
print("=== socket closed ===")
|
||||
break
|
||||
print("received: {}".format(data))
|
||||
print("received: {0}".format(data))
|
||||
try:
|
||||
decoded = json.loads(data)
|
||||
except ValueError:
|
||||
@@ -65,7 +65,7 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
|
||||
else:
|
||||
response = "what?"
|
||||
encoded = json.dumps([decoded[0], response])
|
||||
print("sending {}".format(encoded))
|
||||
print("sending {0}".format(encoded))
|
||||
self.request.sendall(encoded.encode('utf-8'))
|
||||
thesocket = None
|
||||
|
||||
@@ -87,7 +87,7 @@ if __name__ == "__main__":
|
||||
server_thread.start()
|
||||
print("Server loop running in thread: ", server_thread.name)
|
||||
|
||||
print("Listening on port {}".format(PORT))
|
||||
print("Listening on port {0}".format(PORT))
|
||||
while True:
|
||||
typed = sys.stdin.readline()
|
||||
if "quit" in typed:
|
||||
@@ -96,7 +96,7 @@ if __name__ == "__main__":
|
||||
if thesocket is None:
|
||||
print("No socket yet")
|
||||
else:
|
||||
print("sending {}".format(typed))
|
||||
print("sending {0}".format(typed))
|
||||
thesocket.sendall(typed.encode('utf-8'))
|
||||
|
||||
server.shutdown()
|
||||
|
||||
@@ -32,8 +32,8 @@ func! ParseFoldProps()
|
||||
if line !~ '^#' && line !~ '^\s*$'
|
||||
let l = split(line, '\s*;\s*', 1)
|
||||
if len(l) != 4
|
||||
echoerr 'Found ' . len(l) . ' items in line ' . lnum . ', expected 4'
|
||||
return
|
||||
echoerr 'Found ' . len(l) . ' items in line ' . lnum . ', expected 4'
|
||||
return
|
||||
endif
|
||||
call add(s:foldprops, l)
|
||||
endif
|
||||
@@ -50,8 +50,8 @@ func! ParseWidthProps()
|
||||
if line !~ '^#' && line !~ '^\s*$'
|
||||
let l = split(line, '\s*;\s*', 1)
|
||||
if len(l) != 2
|
||||
echoerr 'Found ' . len(l) . ' items in line ' . lnum . ', expected 2'
|
||||
return
|
||||
echoerr 'Found ' . len(l) . ' items in line ' . lnum . ', expected 2'
|
||||
return
|
||||
endif
|
||||
call add(s:widthprops, l)
|
||||
endif
|
||||
@@ -72,18 +72,18 @@ func! BuildCaseTable(name, index)
|
||||
let n = ('0x' . p[0]) + 0
|
||||
let nl = ('0x' . p[a:index]) + 0
|
||||
if start >= 0 && add == nl - n && (step == 0 || n - end == step)
|
||||
" continue with same range.
|
||||
let step = n - end
|
||||
let end = n
|
||||
" continue with same range.
|
||||
let step = n - end
|
||||
let end = n
|
||||
else
|
||||
if start >= 0
|
||||
" produce previous range
|
||||
call Range(ranges, start, end, step, add)
|
||||
endif
|
||||
let start = n
|
||||
let end = n
|
||||
let step = 0
|
||||
let add = nl - n
|
||||
if start >= 0
|
||||
" produce previous range
|
||||
call Range(ranges, start, end, step, add)
|
||||
endif
|
||||
let start = n
|
||||
let end = n
|
||||
let step = 0
|
||||
let add = nl - n
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
@@ -115,18 +115,18 @@ func! BuildFoldTable()
|
||||
let n = ('0x' . p[0]) + 0
|
||||
let nl = ('0x' . p[2]) + 0
|
||||
if start >= 0 && add == nl - n && (step == 0 || n - end == step)
|
||||
" continue with same range.
|
||||
let step = n - end
|
||||
let end = n
|
||||
" continue with same range.
|
||||
let step = n - end
|
||||
let end = n
|
||||
else
|
||||
if start >= 0
|
||||
" produce previous range
|
||||
call Range(ranges, start, end, step, add)
|
||||
endif
|
||||
let start = n
|
||||
let end = n
|
||||
let step = 0
|
||||
let add = nl - n
|
||||
if start >= 0
|
||||
" produce previous range
|
||||
call Range(ranges, start, end, step, add)
|
||||
endif
|
||||
let start = n
|
||||
let end = n
|
||||
let step = 0
|
||||
let add = nl - n
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
@@ -160,15 +160,15 @@ func! BuildCombiningTable()
|
||||
if p[2] == 'Mn' || p[2] == 'Mc' || p[2] == 'Me'
|
||||
let n = ('0x' . p[0]) + 0
|
||||
if start >= 0 && end + 1 == n
|
||||
" continue with same range.
|
||||
let end = n
|
||||
" continue with same range.
|
||||
let end = n
|
||||
else
|
||||
if start >= 0
|
||||
" produce previous range
|
||||
call add(ranges, printf("\t{0x%04x, 0x%04x},", start, end))
|
||||
endif
|
||||
let start = n
|
||||
let end = n
|
||||
if start >= 0
|
||||
" produce previous range
|
||||
call add(ranges, printf("\t{0x%04x, 0x%04x},", start, end))
|
||||
endif
|
||||
let start = n
|
||||
let end = n
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
@@ -197,47 +197,57 @@ func! BuildWidthTable(pattern, tableName)
|
||||
for p in s:widthprops
|
||||
if p[1][0] =~ a:pattern
|
||||
if p[0] =~ '\.\.'
|
||||
" It is a range. we don't check for composing char then.
|
||||
let rng = split(p[0], '\.\.')
|
||||
if len(rng) != 2
|
||||
echoerr "Cannot parse range: '" . p[0] . "' in width table"
|
||||
endif
|
||||
let n = ('0x' . rng[0]) + 0
|
||||
let n_last = ('0x' . rng[1]) + 0
|
||||
" It is a range. we don't check for composing char then.
|
||||
let rng = split(p[0], '\.\.')
|
||||
if len(rng) != 2
|
||||
echoerr "Cannot parse range: '" . p[0] . "' in width table"
|
||||
endif
|
||||
let n = ('0x' . rng[0]) + 0
|
||||
let n_last = ('0x' . rng[1]) + 0
|
||||
else
|
||||
let n = ('0x' . p[0]) + 0
|
||||
let n_last = n
|
||||
let n = ('0x' . p[0]) + 0
|
||||
let n_last = n
|
||||
endif
|
||||
" Find this char in the data table.
|
||||
while 1
|
||||
let dn = ('0x' . s:dataprops[dataidx][0]) + 0
|
||||
if dn >= n
|
||||
break
|
||||
endif
|
||||
let dataidx += 1
|
||||
let dn = ('0x' . s:dataprops[dataidx][0]) + 0
|
||||
if dn >= n
|
||||
break
|
||||
endif
|
||||
let dataidx += 1
|
||||
endwhile
|
||||
if dn != n && n_last == n
|
||||
echoerr "Cannot find character " . n . " in data table"
|
||||
echoerr "Cannot find character " . n . " in data table"
|
||||
endif
|
||||
" Only use the char when it's not a composing char.
|
||||
" But use all chars from a range.
|
||||
let dp = s:dataprops[dataidx]
|
||||
if n_last > n || (dp[2] != 'Mn' && dp[2] != 'Mc' && dp[2] != 'Me')
|
||||
if start >= 0 && end + 1 == n
|
||||
" continue with same range.
|
||||
else
|
||||
if start >= 0
|
||||
" produce previous range
|
||||
call add(ranges, printf("\t{0x%04x, 0x%04x},", start, end))
|
||||
endif
|
||||
let start = n
|
||||
endif
|
||||
let end = n_last
|
||||
if start >= 0 && end + 1 == n
|
||||
" continue with same range.
|
||||
else
|
||||
if start >= 0
|
||||
" produce previous range
|
||||
call add(ranges, printf("\t{0x%04x, 0x%04x},", start, end))
|
||||
if a:pattern == 'A'
|
||||
call add(s:ambitable, [start, end])
|
||||
else
|
||||
call add(s:doubletable, [start, end])
|
||||
endif
|
||||
endif
|
||||
let start = n
|
||||
endif
|
||||
let end = n_last
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
if start >= 0
|
||||
call add(ranges, printf("\t{0x%04x, 0x%04x},", start, end))
|
||||
if a:pattern == 'A'
|
||||
call add(s:ambitable, [start, end])
|
||||
else
|
||||
call add(s:doubletable, [start, end])
|
||||
endif
|
||||
endif
|
||||
|
||||
" New buffer to put the result in.
|
||||
@@ -251,6 +261,84 @@ func! BuildWidthTable(pattern, tableName)
|
||||
wincmd p
|
||||
endfunc
|
||||
|
||||
" Build the amoji width table in a new buffer.
|
||||
func! BuildEmojiTable(pattern, tableName)
|
||||
let alltokens = []
|
||||
let widthtokens = []
|
||||
let lines = map(filter(filter(getline(1, '$'), 'v:val=~"^[1-9]"'), 'v:val=~a:pattern'), 'matchstr(v:val,"^\\S\\+")')
|
||||
for n in range(len(lines))
|
||||
let line = lines[n]
|
||||
let token = split(line, '\.\.')
|
||||
let first = ('0x' . token[0]) + 0
|
||||
if len(token) == 1
|
||||
let last = first
|
||||
else
|
||||
let last = ('0x' . token[1]) + 0
|
||||
endif
|
||||
|
||||
let token = [first, last]
|
||||
if len(alltokens) > 0 && (token[0] - 1 == alltokens[-1][1])
|
||||
let alltokens[-1][1] = token[1]
|
||||
else
|
||||
call add(alltokens, token)
|
||||
endif
|
||||
|
||||
" Characters below 1F000 may be considered single width traditionally,
|
||||
" making them double width causes problems.
|
||||
if first < 0x1f000
|
||||
continue
|
||||
endif
|
||||
|
||||
" exclude characters that are in the "ambiguous" or "doublewidth" table
|
||||
for ambi in s:ambitable
|
||||
if first >= ambi[0] && first <= ambi[1]
|
||||
let first = ambi[1] + 1
|
||||
endif
|
||||
if last >= ambi[0] && last <= ambi[1]
|
||||
let last = ambi[0] - 1
|
||||
endif
|
||||
endfor
|
||||
for double in s:doubletable
|
||||
if first >= double[0] && first <= double[1]
|
||||
let first = double[1] + 1
|
||||
endif
|
||||
if last >= double[0] && last <= double[1]
|
||||
let last = double[0] - 1
|
||||
endif
|
||||
endfor
|
||||
|
||||
if first <= last
|
||||
let token = [first, last]
|
||||
if len(widthtokens) > 0 && (token[0] - 1 == widthtokens[-1][1])
|
||||
let widthtokens[-1][1] = token[1]
|
||||
else
|
||||
call add(widthtokens, token)
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
let allranges = map(alltokens, 'printf("\t{0x%04x, 0x%04x},", v:val[0], v:val[1])')
|
||||
let widthranges = map(widthtokens, 'printf("\t{0x%04x, 0x%04x},", v:val[0], v:val[1])')
|
||||
|
||||
" New buffer to put the result in.
|
||||
new
|
||||
exe "file " . a:tableName . '_all'
|
||||
call setline(1, " static struct interval " . a:tableName . "_all[] =")
|
||||
call setline(2, " {")
|
||||
call append('$', allranges)
|
||||
call setline('$', getline('$')[:-2]) " remove last comma
|
||||
call setline(line('$') + 1, " };")
|
||||
wincmd p
|
||||
|
||||
" New buffer to put the result in.
|
||||
new
|
||||
exe "file " . a:tableName . '_width'
|
||||
call setline(1, " static struct interval " . a:tableName . "_width[] =")
|
||||
call setline(2, " {")
|
||||
call append('$', widthranges)
|
||||
call setline('$', getline('$')[:-2]) " remove last comma
|
||||
call setline(line('$') + 1, " };")
|
||||
wincmd p
|
||||
endfunc
|
||||
|
||||
" Try to avoid hitting E36
|
||||
set equalalways
|
||||
@@ -286,7 +374,16 @@ edit http://www.unicode.org/Public/UNIDATA/EastAsianWidth.txt
|
||||
call ParseWidthProps()
|
||||
|
||||
" Build the double width table.
|
||||
let s:doubletable = []
|
||||
call BuildWidthTable('[WF]', 'doublewidth')
|
||||
|
||||
" Build the ambiguous width table.
|
||||
let s:ambitable = []
|
||||
call BuildWidthTable('A', 'ambiguous')
|
||||
|
||||
" Edit the emoji text file. Requires the netrw plugin.
|
||||
edit http://www.unicode.org/Public/emoji/3.0/emoji-data.txt
|
||||
|
||||
" Build the emoji table. Ver. 1.0 - 6.0
|
||||
" Must come after the "ambiguous" table
|
||||
call BuildEmojiTable('; Emoji\s\+# [1-6]\.[0-9]', 'emoji')
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" An example for a vimrc file.
|
||||
"
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last change: 2015 Mar 24
|
||||
" Last change: 2016 Mar 25
|
||||
"
|
||||
" To use it, copy it to
|
||||
" for Unix and OS/2: ~/.vimrc
|
||||
@@ -100,3 +100,10 @@ if has('langmap') && exists('+langnoremap')
|
||||
" compatible).
|
||||
set langnoremap
|
||||
endif
|
||||
|
||||
|
||||
" Add optional packages.
|
||||
"
|
||||
" The matchit plugin makes the % command work better, but it is not backwards
|
||||
" compatible.
|
||||
packadd matchit
|
||||
|
||||
@@ -43,6 +43,10 @@ else
|
||||
DEL = del
|
||||
endif
|
||||
endif
|
||||
# Set the default $(WINVER) to make it work with WinXP.
|
||||
ifndef WINVER
|
||||
WINVER = 0x0501
|
||||
endif
|
||||
CXX := $(CROSS_COMPILE)g++
|
||||
WINDRES := $(CROSS_COMPILE)windres
|
||||
WINDRES_CXX = $(CXX)
|
||||
@@ -68,7 +72,7 @@ $(DLL): $(OBJ) $(RES) $(DEFFILE)
|
||||
$(LIBS)
|
||||
|
||||
gvimext.o: gvimext.cpp
|
||||
$(CXX) $(CXXFLAGS) -DFEAT_GETTEXT -c $? -o $@
|
||||
$(CXX) $(CXXFLAGS) -DFEAT_GETTEXT -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) -c $? -o $@
|
||||
|
||||
$(RES): gvimext_ming.rc
|
||||
$(WINDRES) $(WINDRES_FLAGS) --input-format=rc --output-format=coff -DMING $? -o $@
|
||||
|
||||
@@ -464,7 +464,7 @@ NBDEBUG_DEP = nbdebug.h nbdebug.c
|
||||
!endif
|
||||
|
||||
!if ("$(CHANNEL)"=="yes")
|
||||
DEFINES = $(DEFINES) -DFEAT_CHANNEL
|
||||
DEFINES = $(DEFINES) -DFEAT_JOB_CHANNEL
|
||||
!endif
|
||||
|
||||
!ifdef XPM
|
||||
|
||||
@@ -415,6 +415,7 @@ WINDRES_CC = $(CC)
|
||||
###########################################################################
|
||||
|
||||
CFLAGS = -Iproto $(DEFINES) -pipe -march=$(ARCH) -Wall
|
||||
CXXFLAGS = -std=gnu++11
|
||||
WINDRES_FLAGS = --preprocessor="$(WINDRES_CC) -E -xc" -DRC_INVOKED
|
||||
EXTRA_LIBS =
|
||||
|
||||
@@ -529,7 +530,7 @@ endif
|
||||
endif
|
||||
|
||||
ifeq ($(CHANNEL),yes)
|
||||
DEFINES += -DFEAT_CHANNEL
|
||||
DEFINES += -DFEAT_JOB_CHANNEL
|
||||
endif
|
||||
|
||||
# DirectWrite (DirectX)
|
||||
@@ -864,14 +865,14 @@ $(OUTDIR)/gui_w32.o: gui_w32.c $(INCL)
|
||||
$(CC) -c $(CFLAGS) gui_w32.c -o $(OUTDIR)/gui_w32.o
|
||||
|
||||
$(OUTDIR)/gui_dwrite.o: gui_dwrite.cpp $(INCL) gui_dwrite.h
|
||||
$(CC) -c $(CFLAGS) gui_dwrite.cpp -o $(OUTDIR)/gui_dwrite.o
|
||||
$(CC) -c $(CFLAGS) $(CXXFLAGS) gui_dwrite.cpp -o $(OUTDIR)/gui_dwrite.o
|
||||
|
||||
$(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h
|
||||
$(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o
|
||||
|
||||
# Remove -D__IID_DEFINED__ for newer versions of the w32api
|
||||
$(OUTDIR)/if_ole.o: if_ole.cpp $(INCL)
|
||||
$(CC) $(CFLAGS) -c -o $(OUTDIR)/if_ole.o if_ole.cpp
|
||||
$(CC) $(CFLAGS) $(CXXFLAGS) -c -o $(OUTDIR)/if_ole.o if_ole.cpp
|
||||
|
||||
$(OUTDIR)/if_ruby.o: if_ruby.c $(INCL)
|
||||
ifeq (16, $(RUBY))
|
||||
|
||||
@@ -332,7 +332,7 @@ XPM_INC = -I $(XPM)\include -I $(XPM)\..\include
|
||||
!if "$(CHANNEL)" == "yes"
|
||||
CHANNEL_PRO = proto/channel.pro
|
||||
CHANNEL_OBJ = $(OBJDIR)/channel.obj
|
||||
CHANNEL_DEFS = -DFEAT_CHANNEL
|
||||
CHANNEL_DEFS = -DFEAT_JOB_CHANNEL
|
||||
|
||||
NETBEANS_LIB = WSock32.lib
|
||||
!endif
|
||||
|
||||
49
src/Makefile
49
src/Makefile
@@ -130,6 +130,7 @@
|
||||
# make installlinks only installs the Vim binary links
|
||||
# make installmanlinks only installs the Vim manpage links
|
||||
# make installmacros only installs the Vim macros
|
||||
# make installpack only installs the packages
|
||||
# make installtutorbin only installs the Vim tutor program
|
||||
# make installtutor only installs the Vim tutor files
|
||||
# make installspell only installs the spell files
|
||||
@@ -424,7 +425,7 @@ CClink = $(CC)
|
||||
# NOTE: This may cause threading to be enabled, which has side effects (such
|
||||
# as using different libraries and debugging becomes more difficult).
|
||||
# NOTE: Using this together with Perl may cause a crash in initialization.
|
||||
# For Python3 support make a symbolic link in /usr/local/bin:
|
||||
# For Python3 support make a symbolic link in /usr/local/bin:
|
||||
# ln -s python3 python3.1
|
||||
# If both python2.x and python3.x are enabled then the linking will be via
|
||||
# dlopen(), dlsym(), dlclose(), i.e. pythonX.Y.so must be available
|
||||
@@ -1008,6 +1009,7 @@ LANGSUBDIR = /lang
|
||||
COMPSUBDIR = /compiler
|
||||
KMAPSUBDIR = /keymap
|
||||
MACROSUBDIR = /macros
|
||||
PACKSUBDIR = /pack
|
||||
TOOLSSUBDIR = /tools
|
||||
TUTORSUBDIR = /tutor
|
||||
SPELLSUBDIR = /spell
|
||||
@@ -1029,6 +1031,7 @@ PODIR = po
|
||||
### COMPSUBLOC location for compiler files
|
||||
### KMAPSUBLOC location for keymap files
|
||||
### MACROSUBLOC location for macro files
|
||||
### PACKSUBLOC location for packages
|
||||
### TOOLSSUBLOC location for tools files
|
||||
### TUTORSUBLOC location for tutor files
|
||||
### SPELLSUBLOC location for spell files
|
||||
@@ -1050,6 +1053,7 @@ LANGSUBLOC = $(VIMRTLOC)$(LANGSUBDIR)
|
||||
COMPSUBLOC = $(VIMRTLOC)$(COMPSUBDIR)
|
||||
KMAPSUBLOC = $(VIMRTLOC)$(KMAPSUBDIR)
|
||||
MACROSUBLOC = $(VIMRTLOC)$(MACROSUBDIR)
|
||||
PACKSUBLOC = $(VIMRTLOC)$(PACKSUBDIR)
|
||||
TOOLSSUBLOC = $(VIMRTLOC)$(TOOLSSUBDIR)
|
||||
TUTORSUBLOC = $(VIMRTLOC)$(TUTORSUBDIR)
|
||||
SPELLSUBLOC = $(VIMRTLOC)$(SPELLSUBDIR)
|
||||
@@ -1155,6 +1159,9 @@ FTPLUGSOURCE = ../runtime/ftplugin
|
||||
# Where to copy the macro files from
|
||||
MACROSOURCE = ../runtime/macros
|
||||
|
||||
# Where to copy the package files from
|
||||
PACKSOURCE = ../runtime/pack
|
||||
|
||||
# Where to copy the tools files from
|
||||
TOOLSSOURCE = ../runtime/tools
|
||||
|
||||
@@ -1430,6 +1437,7 @@ DEST_LANG = $(DESTDIR)$(LANGSUBLOC)
|
||||
DEST_COMP = $(DESTDIR)$(COMPSUBLOC)
|
||||
DEST_KMAP = $(DESTDIR)$(KMAPSUBLOC)
|
||||
DEST_MACRO = $(DESTDIR)$(MACROSUBLOC)
|
||||
DEST_PACK = $(DESTDIR)$(PACKSUBLOC)
|
||||
DEST_TOOLS = $(DESTDIR)$(TOOLSSUBLOC)
|
||||
DEST_TUTOR = $(DESTDIR)$(TUTORSUBLOC)
|
||||
DEST_SPELL = $(DESTDIR)$(SPELLSUBLOC)
|
||||
@@ -1972,7 +1980,6 @@ test1 \
|
||||
test_match_conceal \
|
||||
test_nested_function \
|
||||
test_options \
|
||||
test_qf_title \
|
||||
test_ruby \
|
||||
test_search_mbyte \
|
||||
test_signs \
|
||||
@@ -1982,7 +1989,7 @@ test1 \
|
||||
test_wordcount \
|
||||
test_writefile \
|
||||
test2 test3 test4 test5 test6 test7 test8 test9 \
|
||||
test10 test11 test12 test13 test14 test15 test16 test17 test18 test19 \
|
||||
test11 test12 test13 test14 test15 test16 test17 test18 test19 \
|
||||
test20 test21 test22 test23 test24 test25 test26 test27 test28 test29 \
|
||||
test30 test31 test32 test33 test34 test35 test36 test37 test38 test39 \
|
||||
test40 test41 test42 test43 test44 test45 test46 test47 test48 test49 \
|
||||
@@ -1990,37 +1997,51 @@ test1 \
|
||||
test60 test61 test62 test63 test64 test65 test66 test67 test68 test69 \
|
||||
test70 test71 test72 test73 test74 test75 test76 test77 test78 test79 \
|
||||
test80 test81 test82 test83 test84 test85 test86 test87 test88 test89 \
|
||||
test90 test91 test92 test93 test94 test95 test96 test97 test98 test99 \
|
||||
test100 test101 test102 test103 test104 test105 test106 test107 test108:
|
||||
test90 test91 test92 test93 test94 test95 test97 test98 test99 \
|
||||
test100 test101 test102 test103 test104 test105 test107 test108:
|
||||
cd testdir; rm -f $@.out; $(MAKE) -f Makefile $@.out VIMPROG=../$(VIMTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE)
|
||||
|
||||
# Run individual NEW style test, assuming that Vim was already compiled.
|
||||
test_arglist \
|
||||
test_assert \
|
||||
test_assign \
|
||||
test_backspace_opt \
|
||||
test_cdo \
|
||||
test_channel \
|
||||
test_cursor_func \
|
||||
test_delete \
|
||||
test_ex_undo \
|
||||
test_expr \
|
||||
test_expand \
|
||||
test_feedkeys \
|
||||
test_file_perm \
|
||||
test_glob2regpat \
|
||||
test_hardcopy \
|
||||
test_help_tagjump \
|
||||
test_history \
|
||||
test_increment \
|
||||
test_join \
|
||||
test_json \
|
||||
test_langmap \
|
||||
test_lispwords \
|
||||
test_menu \
|
||||
test_packadd \
|
||||
test_partial \
|
||||
test_perl \
|
||||
test_quickfix \
|
||||
test_reltime \
|
||||
test_searchpos \
|
||||
test_set \
|
||||
test_sort \
|
||||
test_syn_attr \
|
||||
test_syntax \
|
||||
test_timers \
|
||||
test_undolevels \
|
||||
test_unlet \
|
||||
test_viminfo \
|
||||
test_viml \
|
||||
test_visual \
|
||||
test_window_id \
|
||||
test_alot:
|
||||
cd testdir; rm -f $@.res test.log messages; $(MAKE) -f Makefile $@.res VIMPROG=../$(VIMTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE)
|
||||
@if test -f testdir/test.log; then \
|
||||
@@ -2094,7 +2115,7 @@ INSTALLMANARGS = $(VIMLOC) $(SCRIPTLOC) $(VIMRCLOC) $(HELPSOURCE) $(MANMOD) \
|
||||
$(VIMNAME) $(VIMDIFFNAME) $(EVIMNAME)
|
||||
|
||||
# Install most of the runtime files
|
||||
installruntime: installrtbase installmacros installtutor installspell
|
||||
installruntime: installrtbase installmacros installpack installtutor installspell
|
||||
|
||||
# install the help files; first adjust the contents for the final location
|
||||
installrtbase: $(HELPSOURCE)/vim.1 $(DEST_VIM) $(DEST_RT) \
|
||||
@@ -2102,8 +2123,11 @@ installrtbase: $(HELPSOURCE)/vim.1 $(DEST_VIM) $(DEST_RT) \
|
||||
$(DEST_FTP) $(DEST_AUTO) $(DEST_AUTO)/xml $(DEST_PLUG) \
|
||||
$(DEST_TUTOR) $(DEST_SPELL) $(DEST_COMP)
|
||||
-$(SHELL) ./installman.sh install $(DEST_MAN) "" $(INSTALLMANARGS)
|
||||
@echo generating help tags
|
||||
# Generate the help tags with ":helptags" to handle all languages.
|
||||
# Move the distributed tags file aside and restore it, to avoid it being
|
||||
# different from the repository.
|
||||
cd $(HELPSOURCE); if test -f tags; then mv -f tags tags.dist; fi
|
||||
@echo generating help tags
|
||||
-@cd $(HELPSOURCE); $(MAKE) VIMEXE=$(DEST_BIN)/$(VIMTARGET) vimtags
|
||||
cd $(HELPSOURCE); \
|
||||
files=`ls *.txt tags`; \
|
||||
@@ -2113,6 +2137,7 @@ installrtbase: $(HELPSOURCE)/vim.1 $(DEST_VIM) $(DEST_RT) \
|
||||
chmod $(HELPMOD) $$files
|
||||
$(INSTALL_DATA) $(HELPSOURCE)/*.pl $(DEST_HELP)
|
||||
chmod $(SCRIPTMOD) $(DEST_HELP)/*.pl
|
||||
cd $(HELPSOURCE); if test -f tags.dist; then mv -f tags.dist tags; fi
|
||||
# install the menu files
|
||||
$(INSTALL_DATA) $(SCRIPTSOURCE)/menu.vim $(SYS_MENU_FILE)
|
||||
chmod $(VIMSCRIPTMOD) $(SYS_MENU_FILE)
|
||||
@@ -2189,6 +2214,11 @@ installmacros: $(DEST_VIM) $(DEST_RT) $(DEST_MACRO)
|
||||
rm -rf $$cvs; \
|
||||
fi
|
||||
|
||||
installpack: $(DEST_VIM) $(DEST_RT) $(DEST_PACK)
|
||||
$(INSTALL_DATA_R) $(PACKSOURCE)/* $(DEST_PACK)
|
||||
chmod $(DIRMOD) `find $(DEST_PACK) -type d -print`
|
||||
chmod $(FILEMOD) `find $(DEST_PACK) -type f -print`
|
||||
|
||||
# install the tutor files
|
||||
installtutorbin: $(DEST_VIM)
|
||||
$(INSTALL_DATA) vimtutor $(DEST_BIN)/$(VIMNAME)tutor
|
||||
@@ -2338,8 +2368,8 @@ $(HELPSOURCE)/vim.1 $(MACROSOURCE) $(TOOLSSOURCE):
|
||||
$(DESTDIR)$(exec_prefix) $(DEST_BIN) \
|
||||
$(DEST_VIM) $(DEST_RT) $(DEST_HELP) \
|
||||
$(DEST_PRINT) $(DEST_COL) $(DEST_SYN) $(DEST_IND) $(DEST_FTP) \
|
||||
$(DEST_LANG) $(DEST_KMAP) $(DEST_COMP) \
|
||||
$(DEST_MACRO) $(DEST_TOOLS) $(DEST_TUTOR) $(DEST_SPELL) \
|
||||
$(DEST_LANG) $(DEST_KMAP) $(DEST_COMP) $(DEST_MACRO) \
|
||||
$(DEST_PACK) $(DEST_TOOLS) $(DEST_TUTOR) $(DEST_SPELL) \
|
||||
$(DEST_AUTO) $(DEST_AUTO)/xml $(DEST_PLUG):
|
||||
-$(SHELL) ./mkinstalldirs $@
|
||||
-chmod $(DIRMOD) $@
|
||||
@@ -2484,6 +2514,7 @@ uninstall_runtime:
|
||||
-rm -f $(DEST_SYN)/*.vim $(DEST_SYN)/README.txt
|
||||
-rm -f $(DEST_IND)/*.vim $(DEST_IND)/README.txt
|
||||
-rm -rf $(DEST_MACRO)
|
||||
-rm -rf $(DEST_PACK)
|
||||
-rm -rf $(DEST_TUTOR)
|
||||
-rm -rf $(DEST_SPELL)
|
||||
-rm -rf $(DEST_TOOLS)
|
||||
|
||||
2
src/auto/configure
vendored
2
src/auto/configure
vendored
@@ -7427,7 +7427,7 @@ if test "$enable_netbeans" = "yes"; then
|
||||
|
||||
fi
|
||||
if test "$enable_channel" = "yes"; then
|
||||
$as_echo "#define FEAT_CHANNEL 1" >>confdefs.h
|
||||
$as_echo "#define FEAT_JOB_CHANNEL 1" >>confdefs.h
|
||||
|
||||
CHANNEL_SRC="channel.c"
|
||||
|
||||
|
||||
20
src/buffer.c
20
src/buffer.c
@@ -139,14 +139,19 @@ open_buffer(
|
||||
#endif
|
||||
)
|
||||
{
|
||||
int old_msg_silent = msg_silent;
|
||||
|
||||
#ifdef FEAT_NETBEANS_INTG
|
||||
int oldFire = netbeansFireChanges;
|
||||
|
||||
netbeansFireChanges = 0;
|
||||
#endif
|
||||
if (shortmess(SHM_FILEINFO))
|
||||
msg_silent = 1;
|
||||
retval = readfile(curbuf->b_ffname, curbuf->b_fname,
|
||||
(linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM, eap,
|
||||
flags | READ_NEW);
|
||||
msg_silent = old_msg_silent;
|
||||
#ifdef FEAT_NETBEANS_INTG
|
||||
netbeansFireChanges = oldFire;
|
||||
#endif
|
||||
@@ -3722,7 +3727,7 @@ build_stl_str_hl(
|
||||
{
|
||||
/* remove group if all items are empty */
|
||||
for (n = groupitem[groupdepth] + 1; n < curitem; n++)
|
||||
if (item[n].type == Normal)
|
||||
if (item[n].type == Normal || item[n].type == Highlight)
|
||||
break;
|
||||
if (n == curitem)
|
||||
{
|
||||
@@ -4602,9 +4607,9 @@ do_arg_all(
|
||||
old_curwin = curwin;
|
||||
old_curtab = curtab;
|
||||
|
||||
#ifdef FEAT_GUI
|
||||
# ifdef FEAT_GUI
|
||||
need_mouse_correct = TRUE;
|
||||
#endif
|
||||
# endif
|
||||
|
||||
/*
|
||||
* Try closing all windows that are not in the argument list.
|
||||
@@ -4624,10 +4629,7 @@ do_arg_all(
|
||||
buf = wp->w_buffer;
|
||||
if (buf->b_ffname == NULL
|
||||
|| (!keep_tabs && buf->b_nwindows > 1)
|
||||
#ifdef FEAT_VERTSPLIT
|
||||
|| wp->w_width != Columns
|
||||
#endif
|
||||
)
|
||||
|| wp->w_width != Columns)
|
||||
i = opened_len;
|
||||
else
|
||||
{
|
||||
@@ -4896,13 +4898,11 @@ ex_buffer_all(exarg_T *eap)
|
||||
{
|
||||
wpnext = wp->w_next;
|
||||
if ((wp->w_buffer->b_nwindows > 1
|
||||
#ifdef FEAT_VERTSPLIT
|
||||
#ifdef FEAT_WINDOWS
|
||||
|| ((cmdmod.split & WSP_VERT)
|
||||
? wp->w_height + wp->w_status_height < Rows - p_ch
|
||||
- tabline_height()
|
||||
: wp->w_width != Columns)
|
||||
#endif
|
||||
#ifdef FEAT_WINDOWS
|
||||
|| (had_tab > 0 && wp != firstwin)
|
||||
#endif
|
||||
) && firstwin != lastwin
|
||||
|
||||
2166
src/channel.c
2166
src/channel.c
File diff suppressed because it is too large
Load Diff
@@ -1093,7 +1093,7 @@ win_lbr_chartabsize(
|
||||
&& vim_isbreak(c)
|
||||
&& !vim_isbreak(s[1])
|
||||
&& wp->w_p_wrap
|
||||
# ifdef FEAT_VERTSPLIT
|
||||
# ifdef FEAT_WINDOWS
|
||||
&& wp->w_width != 0
|
||||
# endif
|
||||
)
|
||||
@@ -1250,10 +1250,10 @@ in_win_border(win_T *wp, colnr_T vcol)
|
||||
int width1; /* width of first line (after line number) */
|
||||
int width2; /* width of further lines */
|
||||
|
||||
#ifdef FEAT_VERTSPLIT
|
||||
# ifdef FEAT_WINDOWS
|
||||
if (wp->w_width == 0) /* there is no border */
|
||||
return FALSE;
|
||||
#endif
|
||||
# endif
|
||||
width1 = W_WIDTH(wp) - win_col_off(wp);
|
||||
if ((int)vcol < width1 - 1)
|
||||
return FALSE;
|
||||
|
||||
@@ -432,7 +432,7 @@
|
||||
#undef FEAT_NETBEANS_INTG
|
||||
|
||||
/* Define if you want to include process communication. */
|
||||
#undef FEAT_CHANNEL
|
||||
#undef FEAT_JOB_CHANNEL
|
||||
|
||||
/* Define default global runtime path */
|
||||
#undef RUNTIME_GLOBAL
|
||||
|
||||
@@ -2014,7 +2014,7 @@ if test "$enable_netbeans" = "yes"; then
|
||||
AC_SUBST(NETBEANS_OBJ)
|
||||
fi
|
||||
if test "$enable_channel" = "yes"; then
|
||||
AC_DEFINE(FEAT_CHANNEL)
|
||||
AC_DEFINE(FEAT_JOB_CHANNEL)
|
||||
CHANNEL_SRC="channel.c"
|
||||
AC_SUBST(CHANNEL_SRC)
|
||||
CHANNEL_OBJ="objects/channel.o"
|
||||
|
||||
@@ -2320,13 +2320,13 @@ keymap_init(void)
|
||||
/* try finding "keymap/'keymap'_'encoding'.vim" in 'runtimepath' */
|
||||
vim_snprintf((char *)buf, buflen, "keymap/%s_%s.vim",
|
||||
curbuf->b_p_keymap, p_enc);
|
||||
if (source_runtime(buf, FALSE) == FAIL)
|
||||
if (source_runtime(buf, 0) == FAIL)
|
||||
# endif
|
||||
{
|
||||
/* try finding "keymap/'keymap'.vim" in 'runtimepath' */
|
||||
vim_snprintf((char *)buf, buflen, "keymap/%s.vim",
|
||||
curbuf->b_p_keymap);
|
||||
if (source_runtime(buf, FALSE) == FAIL)
|
||||
if (source_runtime(buf, 0) == FAIL)
|
||||
{
|
||||
vim_free(buf);
|
||||
return (char_u *)N_("E544: Keymap file not found");
|
||||
|
||||
2135
src/eval.c
2135
src/eval.c
File diff suppressed because it is too large
Load Diff
309
src/ex_cmds.c
309
src/ex_cmds.c
@@ -2065,26 +2065,30 @@ write_viminfo(char_u *file, int forceit)
|
||||
viminfo_errcnt = 0;
|
||||
do_viminfo(fp_in, fp_out, forceit ? 0 : (VIF_WANT_INFO | VIF_WANT_MARKS));
|
||||
|
||||
fclose(fp_out); /* errors are ignored !? */
|
||||
if (fclose(fp_out) == EOF)
|
||||
++viminfo_errcnt;
|
||||
|
||||
if (fp_in != NULL)
|
||||
{
|
||||
fclose(fp_in);
|
||||
|
||||
/* In case of an error keep the original viminfo file. Otherwise
|
||||
* rename the newly written file. Give an error if that fails. */
|
||||
if (viminfo_errcnt == 0 && vim_rename(tempname, fname) == -1)
|
||||
if (viminfo_errcnt == 0)
|
||||
{
|
||||
++viminfo_errcnt;
|
||||
EMSG2(_("E886: Can't rename viminfo file to %s!"), fname);
|
||||
if (vim_rename(tempname, fname) == -1)
|
||||
{
|
||||
++viminfo_errcnt;
|
||||
EMSG2(_("E886: Can't rename viminfo file to %s!"), fname);
|
||||
}
|
||||
# ifdef WIN3264
|
||||
/* If the viminfo file was hidden then also hide the new file. */
|
||||
else if (hidden)
|
||||
mch_hide(fname);
|
||||
# endif
|
||||
}
|
||||
if (viminfo_errcnt > 0)
|
||||
mch_remove(tempname);
|
||||
|
||||
#ifdef WIN3264
|
||||
/* If the viminfo file was hidden then also hide the new file. */
|
||||
if (hidden)
|
||||
mch_hide(fname);
|
||||
#endif
|
||||
}
|
||||
|
||||
end:
|
||||
@@ -2605,7 +2609,8 @@ ex_file(exarg_T *eap)
|
||||
return;
|
||||
}
|
||||
/* print full file name if :cd used */
|
||||
fileinfo(FALSE, FALSE, eap->forceit);
|
||||
if (!shortmess(SHM_FILEINFO))
|
||||
fileinfo(FALSE, FALSE, eap->forceit);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3884,7 +3889,8 @@ do_ecmd(
|
||||
msg_scroll = msg_scroll_save;
|
||||
msg_scrolled_ign = TRUE;
|
||||
|
||||
fileinfo(FALSE, TRUE, FALSE);
|
||||
if (!shortmess(SHM_FILEINFO))
|
||||
fileinfo(FALSE, TRUE, FALSE);
|
||||
|
||||
msg_scrolled_ign = FALSE;
|
||||
}
|
||||
@@ -5861,11 +5867,9 @@ ex_help(exarg_T *eap)
|
||||
* specified, the current window is vertically split and
|
||||
* narrow. */
|
||||
n = WSP_HELP;
|
||||
# ifdef FEAT_VERTSPLIT
|
||||
if (cmdmod.split == 0 && curwin->w_width != Columns
|
||||
&& curwin->w_width < 80)
|
||||
n |= WSP_TOP;
|
||||
# endif
|
||||
if (win_split(0, n) == FAIL)
|
||||
goto erret;
|
||||
#else
|
||||
@@ -6114,6 +6118,11 @@ find_help_tags(
|
||||
|| (arg[0] == '\\' && arg[1] == '{'))
|
||||
*d++ = '\\';
|
||||
|
||||
/*
|
||||
* If tag starts with "('", skip the "(". Fixes CTRL-] on ('option'.
|
||||
*/
|
||||
if (*arg == '(' && arg[1] == '\'')
|
||||
arg++;
|
||||
for (s = arg; *s; ++s)
|
||||
{
|
||||
/*
|
||||
@@ -6575,135 +6584,9 @@ ex_viusage(exarg_T *eap UNUSED)
|
||||
do_cmdline_cmd((char_u *)"help normal-index");
|
||||
}
|
||||
|
||||
static void helptags_one(char_u *dir, char_u *ext, char_u *lang, int add_help_tags);
|
||||
|
||||
/*
|
||||
* ":helptags"
|
||||
* Generate tags in one help directory.
|
||||
*/
|
||||
void
|
||||
ex_helptags(exarg_T *eap)
|
||||
{
|
||||
expand_T xpc;
|
||||
char_u *dirname;
|
||||
int add_help_tags = FALSE;
|
||||
#ifdef FEAT_MULTI_LANG
|
||||
int len;
|
||||
int i, j;
|
||||
garray_T ga;
|
||||
char_u lang[2];
|
||||
char_u ext[5];
|
||||
char_u fname[8];
|
||||
int filecount;
|
||||
char_u **files;
|
||||
#endif
|
||||
|
||||
/* Check for ":helptags ++t {dir}". */
|
||||
if (STRNCMP(eap->arg, "++t", 3) == 0 && vim_iswhite(eap->arg[3]))
|
||||
{
|
||||
add_help_tags = TRUE;
|
||||
eap->arg = skipwhite(eap->arg + 3);
|
||||
}
|
||||
|
||||
ExpandInit(&xpc);
|
||||
xpc.xp_context = EXPAND_DIRECTORIES;
|
||||
dirname = ExpandOne(&xpc, eap->arg, NULL,
|
||||
WILD_LIST_NOTFOUND|WILD_SILENT, WILD_EXPAND_FREE);
|
||||
if (dirname == NULL || !mch_isdir(dirname))
|
||||
{
|
||||
EMSG2(_("E150: Not a directory: %s"), eap->arg);
|
||||
vim_free(dirname);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef FEAT_MULTI_LANG
|
||||
/* Get a list of all files in the help directory and in subdirectories. */
|
||||
STRCPY(NameBuff, dirname);
|
||||
add_pathsep(NameBuff);
|
||||
STRCAT(NameBuff, "**");
|
||||
if (gen_expand_wildcards(1, &NameBuff, &filecount, &files,
|
||||
EW_FILE|EW_SILENT) == FAIL
|
||||
|| filecount == 0)
|
||||
{
|
||||
EMSG2("E151: No match: %s", NameBuff);
|
||||
vim_free(dirname);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Go over all files in the directory to find out what languages are
|
||||
* present. */
|
||||
ga_init2(&ga, 1, 10);
|
||||
for (i = 0; i < filecount; ++i)
|
||||
{
|
||||
len = (int)STRLEN(files[i]);
|
||||
if (len > 4)
|
||||
{
|
||||
if (STRICMP(files[i] + len - 4, ".txt") == 0)
|
||||
{
|
||||
/* ".txt" -> language "en" */
|
||||
lang[0] = 'e';
|
||||
lang[1] = 'n';
|
||||
}
|
||||
else if (files[i][len - 4] == '.'
|
||||
&& ASCII_ISALPHA(files[i][len - 3])
|
||||
&& ASCII_ISALPHA(files[i][len - 2])
|
||||
&& TOLOWER_ASC(files[i][len - 1]) == 'x')
|
||||
{
|
||||
/* ".abx" -> language "ab" */
|
||||
lang[0] = TOLOWER_ASC(files[i][len - 3]);
|
||||
lang[1] = TOLOWER_ASC(files[i][len - 2]);
|
||||
}
|
||||
else
|
||||
continue;
|
||||
|
||||
/* Did we find this language already? */
|
||||
for (j = 0; j < ga.ga_len; j += 2)
|
||||
if (STRNCMP(lang, ((char_u *)ga.ga_data) + j, 2) == 0)
|
||||
break;
|
||||
if (j == ga.ga_len)
|
||||
{
|
||||
/* New language, add it. */
|
||||
if (ga_grow(&ga, 2) == FAIL)
|
||||
break;
|
||||
((char_u *)ga.ga_data)[ga.ga_len++] = lang[0];
|
||||
((char_u *)ga.ga_data)[ga.ga_len++] = lang[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Loop over the found languages to generate a tags file for each one.
|
||||
*/
|
||||
for (j = 0; j < ga.ga_len; j += 2)
|
||||
{
|
||||
STRCPY(fname, "tags-xx");
|
||||
fname[5] = ((char_u *)ga.ga_data)[j];
|
||||
fname[6] = ((char_u *)ga.ga_data)[j + 1];
|
||||
if (fname[5] == 'e' && fname[6] == 'n')
|
||||
{
|
||||
/* English is an exception: use ".txt" and "tags". */
|
||||
fname[4] = NUL;
|
||||
STRCPY(ext, ".txt");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Language "ab" uses ".abx" and "tags-ab". */
|
||||
STRCPY(ext, ".xxx");
|
||||
ext[1] = fname[5];
|
||||
ext[2] = fname[6];
|
||||
}
|
||||
helptags_one(dirname, ext, fname, add_help_tags);
|
||||
}
|
||||
|
||||
ga_clear(&ga);
|
||||
FreeWild(filecount, files);
|
||||
|
||||
#else
|
||||
/* No language support, just use "*.txt" and "tags". */
|
||||
helptags_one(dirname, (char_u *)".txt", (char_u *)"tags", add_help_tags);
|
||||
#endif
|
||||
vim_free(dirname);
|
||||
}
|
||||
|
||||
static void
|
||||
helptags_one(
|
||||
char_u *dir, /* doc directory */
|
||||
@@ -6960,6 +6843,150 @@ helptags_one(
|
||||
fclose(fd_tags); /* there is no check for an error... */
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate tags in one help directory, taking care of translations.
|
||||
*/
|
||||
static void
|
||||
do_helptags(char_u *dirname, int add_help_tags)
|
||||
{
|
||||
#ifdef FEAT_MULTI_LANG
|
||||
int len;
|
||||
int i, j;
|
||||
garray_T ga;
|
||||
char_u lang[2];
|
||||
char_u ext[5];
|
||||
char_u fname[8];
|
||||
int filecount;
|
||||
char_u **files;
|
||||
|
||||
/* Get a list of all files in the help directory and in subdirectories. */
|
||||
STRCPY(NameBuff, dirname);
|
||||
add_pathsep(NameBuff);
|
||||
STRCAT(NameBuff, "**");
|
||||
if (gen_expand_wildcards(1, &NameBuff, &filecount, &files,
|
||||
EW_FILE|EW_SILENT) == FAIL
|
||||
|| filecount == 0)
|
||||
{
|
||||
EMSG2("E151: No match: %s", NameBuff);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Go over all files in the directory to find out what languages are
|
||||
* present. */
|
||||
ga_init2(&ga, 1, 10);
|
||||
for (i = 0; i < filecount; ++i)
|
||||
{
|
||||
len = (int)STRLEN(files[i]);
|
||||
if (len > 4)
|
||||
{
|
||||
if (STRICMP(files[i] + len - 4, ".txt") == 0)
|
||||
{
|
||||
/* ".txt" -> language "en" */
|
||||
lang[0] = 'e';
|
||||
lang[1] = 'n';
|
||||
}
|
||||
else if (files[i][len - 4] == '.'
|
||||
&& ASCII_ISALPHA(files[i][len - 3])
|
||||
&& ASCII_ISALPHA(files[i][len - 2])
|
||||
&& TOLOWER_ASC(files[i][len - 1]) == 'x')
|
||||
{
|
||||
/* ".abx" -> language "ab" */
|
||||
lang[0] = TOLOWER_ASC(files[i][len - 3]);
|
||||
lang[1] = TOLOWER_ASC(files[i][len - 2]);
|
||||
}
|
||||
else
|
||||
continue;
|
||||
|
||||
/* Did we find this language already? */
|
||||
for (j = 0; j < ga.ga_len; j += 2)
|
||||
if (STRNCMP(lang, ((char_u *)ga.ga_data) + j, 2) == 0)
|
||||
break;
|
||||
if (j == ga.ga_len)
|
||||
{
|
||||
/* New language, add it. */
|
||||
if (ga_grow(&ga, 2) == FAIL)
|
||||
break;
|
||||
((char_u *)ga.ga_data)[ga.ga_len++] = lang[0];
|
||||
((char_u *)ga.ga_data)[ga.ga_len++] = lang[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Loop over the found languages to generate a tags file for each one.
|
||||
*/
|
||||
for (j = 0; j < ga.ga_len; j += 2)
|
||||
{
|
||||
STRCPY(fname, "tags-xx");
|
||||
fname[5] = ((char_u *)ga.ga_data)[j];
|
||||
fname[6] = ((char_u *)ga.ga_data)[j + 1];
|
||||
if (fname[5] == 'e' && fname[6] == 'n')
|
||||
{
|
||||
/* English is an exception: use ".txt" and "tags". */
|
||||
fname[4] = NUL;
|
||||
STRCPY(ext, ".txt");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Language "ab" uses ".abx" and "tags-ab". */
|
||||
STRCPY(ext, ".xxx");
|
||||
ext[1] = fname[5];
|
||||
ext[2] = fname[6];
|
||||
}
|
||||
helptags_one(dirname, ext, fname, add_help_tags);
|
||||
}
|
||||
|
||||
ga_clear(&ga);
|
||||
FreeWild(filecount, files);
|
||||
|
||||
#else
|
||||
/* No language support, just use "*.txt" and "tags". */
|
||||
helptags_one(dirname, (char_u *)".txt", (char_u *)"tags", add_help_tags);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
helptags_cb(char_u *fname, void *cookie)
|
||||
{
|
||||
do_helptags(fname, *(int *)cookie);
|
||||
}
|
||||
|
||||
/*
|
||||
* ":helptags"
|
||||
*/
|
||||
void
|
||||
ex_helptags(exarg_T *eap)
|
||||
{
|
||||
expand_T xpc;
|
||||
char_u *dirname;
|
||||
int add_help_tags = FALSE;
|
||||
|
||||
/* Check for ":helptags ++t {dir}". */
|
||||
if (STRNCMP(eap->arg, "++t", 3) == 0 && vim_iswhite(eap->arg[3]))
|
||||
{
|
||||
add_help_tags = TRUE;
|
||||
eap->arg = skipwhite(eap->arg + 3);
|
||||
}
|
||||
|
||||
if (STRCMP(eap->arg, "ALL") == 0)
|
||||
{
|
||||
do_in_path(p_rtp, (char_u *)"doc", DIP_ALL + DIP_DIR,
|
||||
helptags_cb, &add_help_tags);
|
||||
}
|
||||
else
|
||||
{
|
||||
ExpandInit(&xpc);
|
||||
xpc.xp_context = EXPAND_DIRECTORIES;
|
||||
dirname = ExpandOne(&xpc, eap->arg, NULL,
|
||||
WILD_LIST_NOTFOUND|WILD_SILENT, WILD_EXPAND_FREE);
|
||||
if (dirname == NULL || !mch_isdir(dirname))
|
||||
EMSG2(_("E150: Not a directory: %s"), eap->arg);
|
||||
else
|
||||
do_helptags(dirname, add_help_tags);
|
||||
vim_free(dirname);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(FEAT_SIGNS) || defined(PROTO)
|
||||
|
||||
/*
|
||||
|
||||
@@ -810,9 +810,6 @@ EX(CMD_loadview, "loadview", ex_loadview,
|
||||
EX(CMD_loadkeymap, "loadkeymap", ex_loadkeymap,
|
||||
CMDWIN,
|
||||
ADDR_LINES),
|
||||
EX(CMD_loadplugin, "loadplugin", ex_loadplugin,
|
||||
BANG|FILE1|TRLBAR|SBOXOK|CMDWIN,
|
||||
ADDR_LINES),
|
||||
EX(CMD_lockmarks, "lockmarks", ex_wrongmodifier,
|
||||
NEEDARG|EXTRA|NOTRLCOM,
|
||||
ADDR_LINES),
|
||||
@@ -1014,6 +1011,12 @@ EX(CMD_ownsyntax, "ownsyntax", ex_ownsyntax,
|
||||
EX(CMD_print, "print", ex_print,
|
||||
RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|SBOXOK,
|
||||
ADDR_LINES),
|
||||
EX(CMD_packadd, "packadd", ex_packadd,
|
||||
BANG|FILE1|NEEDARG|TRLBAR|SBOXOK|CMDWIN,
|
||||
ADDR_LINES),
|
||||
EX(CMD_packloadall, "packloadall", ex_packloadall,
|
||||
BANG|TRLBAR|SBOXOK|CMDWIN,
|
||||
ADDR_LINES),
|
||||
EX(CMD_pclose, "pclose", ex_pclose,
|
||||
BANG|TRLBAR,
|
||||
ADDR_LINES),
|
||||
|
||||
467
src/ex_cmds2.c
467
src/ex_cmds2.c
@@ -1088,6 +1088,174 @@ profile_zero(proftime_T *tm)
|
||||
|
||||
# endif /* FEAT_PROFILE || FEAT_RELTIME */
|
||||
|
||||
# if defined(FEAT_TIMERS) || defined(PROTO)
|
||||
static timer_T *first_timer = NULL;
|
||||
static int last_timer_id = 0;
|
||||
|
||||
/*
|
||||
* Insert a timer in the list of timers.
|
||||
*/
|
||||
static void
|
||||
insert_timer(timer_T *timer)
|
||||
{
|
||||
timer->tr_next = first_timer;
|
||||
timer->tr_prev = NULL;
|
||||
if (first_timer != NULL)
|
||||
first_timer->tr_prev = timer;
|
||||
first_timer = timer;
|
||||
}
|
||||
|
||||
/*
|
||||
* Take a timer out of the list of timers.
|
||||
*/
|
||||
static void
|
||||
remove_timer(timer_T *timer)
|
||||
{
|
||||
if (timer->tr_prev == NULL)
|
||||
first_timer = timer->tr_next;
|
||||
else
|
||||
timer->tr_prev->tr_next = timer->tr_next;
|
||||
if (timer->tr_next != NULL)
|
||||
timer->tr_next->tr_prev = timer->tr_prev;
|
||||
}
|
||||
|
||||
static void
|
||||
free_timer(timer_T *timer)
|
||||
{
|
||||
vim_free(timer->tr_callback);
|
||||
partial_unref(timer->tr_partial);
|
||||
vim_free(timer);
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a timer and return it. NULL if out of memory.
|
||||
* Caller should set the callback.
|
||||
*/
|
||||
timer_T *
|
||||
create_timer(long msec, int repeat)
|
||||
{
|
||||
timer_T *timer = (timer_T *)alloc_clear(sizeof(timer_T));
|
||||
|
||||
if (timer == NULL)
|
||||
return NULL;
|
||||
timer->tr_id = ++last_timer_id;
|
||||
insert_timer(timer);
|
||||
if (repeat != 0)
|
||||
{
|
||||
timer->tr_repeat = repeat - 1;
|
||||
timer->tr_interval = msec;
|
||||
}
|
||||
|
||||
profile_setlimit(msec, &timer->tr_due);
|
||||
return timer;
|
||||
}
|
||||
|
||||
/*
|
||||
* Invoke the callback of "timer".
|
||||
*/
|
||||
static void
|
||||
timer_callback(timer_T *timer)
|
||||
{
|
||||
typval_T rettv;
|
||||
int dummy;
|
||||
typval_T argv[2];
|
||||
|
||||
argv[0].v_type = VAR_NUMBER;
|
||||
argv[0].vval.v_number = timer->tr_id;
|
||||
argv[1].v_type = VAR_UNKNOWN;
|
||||
|
||||
call_func(timer->tr_callback, (int)STRLEN(timer->tr_callback),
|
||||
&rettv, 1, argv, 0L, 0L, &dummy, TRUE,
|
||||
timer->tr_partial, NULL);
|
||||
clear_tv(&rettv);
|
||||
}
|
||||
|
||||
/*
|
||||
* Call timers that are due.
|
||||
* Return the time in msec until the next timer is due.
|
||||
*/
|
||||
long
|
||||
check_due_timer()
|
||||
{
|
||||
timer_T *timer;
|
||||
long this_due;
|
||||
long next_due = -1;
|
||||
proftime_T now;
|
||||
int did_one = FALSE;
|
||||
# ifdef WIN3264
|
||||
LARGE_INTEGER fr;
|
||||
|
||||
QueryPerformanceFrequency(&fr);
|
||||
# endif
|
||||
while (!got_int)
|
||||
{
|
||||
profile_start(&now);
|
||||
next_due = -1;
|
||||
for (timer = first_timer; timer != NULL; timer = timer->tr_next)
|
||||
{
|
||||
# ifdef WIN3264
|
||||
this_due = (long)(((double)(timer->tr_due.QuadPart - now.QuadPart)
|
||||
/ (double)fr.QuadPart) * 1000);
|
||||
# else
|
||||
this_due = (timer->tr_due.tv_sec - now.tv_sec) * 1000
|
||||
+ (timer->tr_due.tv_usec - now.tv_usec) / 1000;
|
||||
# endif
|
||||
if (this_due <= 1)
|
||||
{
|
||||
remove_timer(timer);
|
||||
timer_callback(timer);
|
||||
did_one = TRUE;
|
||||
if (timer->tr_repeat != 0)
|
||||
{
|
||||
profile_setlimit(timer->tr_interval, &timer->tr_due);
|
||||
if (timer->tr_repeat > 0)
|
||||
--timer->tr_repeat;
|
||||
insert_timer(timer);
|
||||
}
|
||||
else
|
||||
free_timer(timer);
|
||||
/* the callback may do anything, start all over */
|
||||
break;
|
||||
}
|
||||
if (next_due == -1 || next_due > this_due)
|
||||
next_due = this_due;
|
||||
}
|
||||
if (timer == NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
if (did_one)
|
||||
redraw_after_callback();
|
||||
|
||||
return next_due;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find a timer by ID. Returns NULL if not found;
|
||||
*/
|
||||
timer_T *
|
||||
find_timer(int id)
|
||||
{
|
||||
timer_T *timer;
|
||||
|
||||
for (timer = first_timer; timer != NULL; timer = timer->tr_next)
|
||||
if (timer->tr_id == id)
|
||||
break;
|
||||
return timer;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Stop a timer and delete it.
|
||||
*/
|
||||
void
|
||||
stop_timer(timer_T *timer)
|
||||
{
|
||||
remove_timer(timer);
|
||||
free_timer(timer);
|
||||
}
|
||||
# endif
|
||||
|
||||
#if defined(FEAT_SYN_HL) && defined(FEAT_RELTIME) && defined(FEAT_FLOAT)
|
||||
# if defined(HAVE_MATH_H)
|
||||
# include <math.h>
|
||||
@@ -2872,7 +3040,7 @@ ex_compiler(exarg_T *eap)
|
||||
do_unlet((char_u *)"b:current_compiler", TRUE);
|
||||
|
||||
sprintf((char *)buf, "compiler/%s.vim", eap->arg);
|
||||
if (source_runtime(buf, TRUE) == FAIL)
|
||||
if (source_runtime(buf, DIP_ALL) == FAIL)
|
||||
EMSG2(_("E666: compiler not supported: %s"), eap->arg);
|
||||
vim_free(buf);
|
||||
|
||||
@@ -2901,12 +3069,38 @@ ex_compiler(exarg_T *eap)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ":runtime {name}"
|
||||
* ":runtime [what] {name}"
|
||||
*/
|
||||
void
|
||||
ex_runtime(exarg_T *eap)
|
||||
{
|
||||
source_runtime(eap->arg, eap->forceit);
|
||||
char_u *arg = eap->arg;
|
||||
char_u *p = skiptowhite(arg);
|
||||
int len = (int)(p - arg);
|
||||
int flags = eap->forceit ? DIP_ALL : 0;
|
||||
|
||||
if (STRNCMP(arg, "START", len) == 0)
|
||||
{
|
||||
flags += DIP_START + DIP_NORTP;
|
||||
arg = skipwhite(arg + len);
|
||||
}
|
||||
else if (STRNCMP(arg, "OPT", len) == 0)
|
||||
{
|
||||
flags += DIP_OPT + DIP_NORTP;
|
||||
arg = skipwhite(arg + len);
|
||||
}
|
||||
else if (STRNCMP(arg, "PACK", len) == 0)
|
||||
{
|
||||
flags += DIP_START + DIP_OPT + DIP_NORTP;
|
||||
arg = skipwhite(arg + len);
|
||||
}
|
||||
else if (STRNCMP(arg, "ALL", len) == 0)
|
||||
{
|
||||
flags += DIP_START + DIP_OPT;
|
||||
arg = skipwhite(arg + len);
|
||||
}
|
||||
|
||||
source_runtime(arg, flags);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2918,20 +3112,31 @@ source_callback(char_u *fname, void *cookie UNUSED)
|
||||
/*
|
||||
* Source the file "name" from all directories in 'runtimepath'.
|
||||
* "name" can contain wildcards.
|
||||
* When "all" is TRUE, source all files, otherwise only the first one.
|
||||
* When "flags" has DIP_ALL: source all files, otherwise only the first one.
|
||||
*
|
||||
* return FAIL when no file could be sourced, OK otherwise.
|
||||
*/
|
||||
int
|
||||
source_runtime(char_u *name, int all)
|
||||
source_runtime(char_u *name, int flags)
|
||||
{
|
||||
return do_in_runtimepath(name, all, source_callback, NULL);
|
||||
return do_in_runtimepath(name, flags, source_callback, NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
/*
|
||||
* Find the file "name" in all directories in "path" and invoke
|
||||
* "callback(fname, cookie)".
|
||||
* "name" can contain wildcards.
|
||||
* When "flags" has DIP_ALL: source all files, otherwise only the first one.
|
||||
* When "flags" has DIP_DIR: find directories instead of files.
|
||||
* When "flags" has DIP_ERR: give an error message if there is no match.
|
||||
*
|
||||
* return FAIL when no file could be sourced, OK otherwise.
|
||||
*/
|
||||
int
|
||||
do_in_path(
|
||||
char_u *path,
|
||||
char_u *name,
|
||||
int all,
|
||||
int flags,
|
||||
void (*callback)(char_u *fname, void *ck),
|
||||
void *cookie)
|
||||
{
|
||||
@@ -2968,7 +3173,7 @@ do_in_path(
|
||||
|
||||
/* Loop over all entries in 'runtimepath'. */
|
||||
rtp = rtp_copy;
|
||||
while (*rtp != NUL && (all || !did_one))
|
||||
while (*rtp != NUL && ((flags & DIP_ALL) || !did_one))
|
||||
{
|
||||
/* Copy the path from 'runtimepath' to buf[]. */
|
||||
copy_option_part(&rtp, buf, MAXPATHL, ",");
|
||||
@@ -2985,7 +3190,7 @@ do_in_path(
|
||||
|
||||
/* Loop over all patterns in "name" */
|
||||
np = name;
|
||||
while (*np != NUL && (all || !did_one))
|
||||
while (*np != NUL && ((flags & DIP_ALL) || !did_one))
|
||||
{
|
||||
/* Append the pattern from "name" to buf[]. */
|
||||
copy_option_part(&np, tail, (int)(MAXPATHL - (tail - buf)),
|
||||
@@ -3000,13 +3205,13 @@ do_in_path(
|
||||
|
||||
/* Expand wildcards, invoke the callback for each match. */
|
||||
if (gen_expand_wildcards(1, &buf, &num_files, &files,
|
||||
EW_FILE) == OK)
|
||||
(flags & DIP_DIR) ? EW_DIR : EW_FILE) == OK)
|
||||
{
|
||||
for (i = 0; i < num_files; ++i)
|
||||
{
|
||||
(*callback)(files[i], cookie);
|
||||
did_one = TRUE;
|
||||
if (!all)
|
||||
if (!(flags & DIP_ALL))
|
||||
break;
|
||||
}
|
||||
FreeWild(num_files, files);
|
||||
@@ -3017,11 +3222,18 @@ do_in_path(
|
||||
}
|
||||
vim_free(buf);
|
||||
vim_free(rtp_copy);
|
||||
if (p_verbose > 0 && !did_one && name != NULL)
|
||||
if (!did_one && name != NULL)
|
||||
{
|
||||
verbose_enter();
|
||||
smsg((char_u *)_("not found in 'runtimepath': \"%s\""), name);
|
||||
verbose_leave();
|
||||
char *basepath = path == p_rtp ? "runtimepath" : "packpath";
|
||||
|
||||
if (flags & DIP_ERR)
|
||||
EMSG3(_(e_dirnotf), basepath, name);
|
||||
else if (p_verbose > 0)
|
||||
{
|
||||
verbose_enter();
|
||||
smsg((char_u *)_("not found in '%s': \"%s\""), basepath, name);
|
||||
verbose_leave();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef AMIGA
|
||||
@@ -3034,8 +3246,8 @@ do_in_path(
|
||||
/*
|
||||
* Find "name" in 'runtimepath'. When found, invoke the callback function for
|
||||
* it: callback(fname, "cookie")
|
||||
* When "all" is TRUE repeat for all matches, otherwise only the first one is
|
||||
* used.
|
||||
* When "flags" has DIP_ALL repeat for all matches, otherwise only the first
|
||||
* one is used.
|
||||
* Returns OK when at least one match found, FAIL otherwise.
|
||||
*
|
||||
* If "name" is NULL calls callback for each entry in runtimepath. Cookie is
|
||||
@@ -3045,101 +3257,194 @@ do_in_path(
|
||||
int
|
||||
do_in_runtimepath(
|
||||
char_u *name,
|
||||
int all,
|
||||
int flags,
|
||||
void (*callback)(char_u *fname, void *ck),
|
||||
void *cookie)
|
||||
{
|
||||
return do_in_path(p_rtp, name, all, callback, cookie);
|
||||
int done = FAIL;
|
||||
char_u *s;
|
||||
int len;
|
||||
char *start_dir = "pack/*/start/*/%s";
|
||||
char *opt_dir = "pack/*/opt/*/%s";
|
||||
|
||||
if ((flags & DIP_NORTP) == 0)
|
||||
done = do_in_path(p_rtp, name, flags, callback, cookie);
|
||||
|
||||
if ((done == FAIL || (flags & DIP_ALL)) && (flags & DIP_START))
|
||||
{
|
||||
len = (int)(STRLEN(start_dir) + STRLEN(name));
|
||||
s = alloc(len);
|
||||
if (s == NULL)
|
||||
return FAIL;
|
||||
vim_snprintf((char *)s, len, start_dir, name);
|
||||
done = do_in_path(p_pp, s, flags, callback, cookie);
|
||||
vim_free(s);
|
||||
}
|
||||
|
||||
if ((done == FAIL || (flags & DIP_ALL)) && (flags & DIP_OPT))
|
||||
{
|
||||
len = (int)(STRLEN(opt_dir) + STRLEN(name));
|
||||
s = alloc(len);
|
||||
if (s == NULL)
|
||||
return FAIL;
|
||||
vim_snprintf((char *)s, len, opt_dir, name);
|
||||
done = do_in_path(p_pp, s, flags, callback, cookie);
|
||||
vim_free(s);
|
||||
}
|
||||
|
||||
return done;
|
||||
}
|
||||
|
||||
/*
|
||||
* Expand wildcards in "pat" and invoke do_source() for each match.
|
||||
*/
|
||||
static void
|
||||
source_all_matches(char_u *pat)
|
||||
{
|
||||
int num_files;
|
||||
char_u **files;
|
||||
int i;
|
||||
|
||||
if (gen_expand_wildcards(1, &pat, &num_files, &files, EW_FILE) == OK)
|
||||
{
|
||||
for (i = 0; i < num_files; ++i)
|
||||
(void)do_source(files[i], FALSE, DOSO_NONE);
|
||||
FreeWild(num_files, files);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
source_pack_plugin(char_u *fname, void *cookie UNUSED)
|
||||
add_pack_plugin(char_u *fname, void *cookie)
|
||||
{
|
||||
char_u *p6, *p5, *p4, *p3, *p2, *p1, *p;
|
||||
int c;
|
||||
char_u *new_rtp;
|
||||
int keep;
|
||||
int oldlen;
|
||||
int addlen;
|
||||
char_u *p4, *p3, *p2, *p1, *p;
|
||||
char_u *insp;
|
||||
int c;
|
||||
char_u *new_rtp;
|
||||
int keep;
|
||||
int oldlen;
|
||||
int addlen;
|
||||
char_u *ffname = fix_fname(fname);
|
||||
int load_files = cookie != NULL;
|
||||
|
||||
p6 = p5 = p4 = p3 = p2 = p1 = get_past_head(fname);
|
||||
for (p = p1; *p; mb_ptr_adv(p))
|
||||
if (vim_ispathsep_nocolon(*p))
|
||||
{
|
||||
p6 = p5; p5 = p4; p4 = p3; p3 = p2; p2 = p1; p1 = p;
|
||||
}
|
||||
|
||||
/* now we have:
|
||||
* rtp/pack/name/ever/name/plugin/name.vim
|
||||
* p6 p5 p4 p3 p2 p1
|
||||
*/
|
||||
|
||||
/* find the part up to "pack" in 'runtimepath' */
|
||||
c = *p6;
|
||||
*p6 = NUL;
|
||||
p = (char_u *)strstr((char *)p_rtp, (char *)fname);
|
||||
if (p == NULL)
|
||||
/* not found, append at the end */
|
||||
p = p_rtp + STRLEN(p_rtp);
|
||||
else
|
||||
/* append after the matching directory. */
|
||||
p += STRLEN(fname);
|
||||
*p6 = c;
|
||||
|
||||
c = *p2;
|
||||
*p2 = NUL;
|
||||
if (strstr((char *)p_rtp, (char *)fname) == NULL)
|
||||
if (ffname == NULL)
|
||||
return;
|
||||
if (strstr((char *)p_rtp, (char *)ffname) == NULL)
|
||||
{
|
||||
/* directory not in 'runtimepath', add it */
|
||||
p4 = p3 = p2 = p1 = get_past_head(ffname);
|
||||
for (p = p1; *p; mb_ptr_adv(p))
|
||||
if (vim_ispathsep_nocolon(*p))
|
||||
{
|
||||
p4 = p3; p3 = p2; p2 = p1; p1 = p;
|
||||
}
|
||||
|
||||
/* now we have:
|
||||
* rtp/pack/name/start/name
|
||||
* p4 p3 p2 p1
|
||||
*
|
||||
* find the part up to "pack" in 'runtimepath' */
|
||||
c = *p4;
|
||||
*p4 = NUL;
|
||||
insp = (char_u *)strstr((char *)p_rtp, (char *)ffname);
|
||||
if (insp == NULL)
|
||||
/* not found, append at the end */
|
||||
insp = p_rtp + STRLEN(p_rtp);
|
||||
else
|
||||
{
|
||||
/* append after the matching directory. */
|
||||
insp += STRLEN(ffname);
|
||||
while (*insp != NUL && *insp != ',')
|
||||
++insp;
|
||||
}
|
||||
*p4 = c;
|
||||
|
||||
oldlen = (int)STRLEN(p_rtp);
|
||||
addlen = (int)STRLEN(fname);
|
||||
addlen = (int)STRLEN(ffname);
|
||||
new_rtp = alloc(oldlen + addlen + 2);
|
||||
if (new_rtp == NULL)
|
||||
{
|
||||
*p2 = c;
|
||||
return;
|
||||
}
|
||||
keep = (int)(p - p_rtp);
|
||||
goto theend;
|
||||
keep = (int)(insp - p_rtp);
|
||||
mch_memmove(new_rtp, p_rtp, keep);
|
||||
new_rtp[keep] = ',';
|
||||
mch_memmove(new_rtp + keep + 1, fname, addlen + 1);
|
||||
mch_memmove(new_rtp + keep + 1, ffname, addlen + 1);
|
||||
if (p_rtp[keep] != NUL)
|
||||
mch_memmove(new_rtp + keep + 1 + addlen, p_rtp + keep,
|
||||
oldlen - keep + 1);
|
||||
free_string_option(p_rtp);
|
||||
p_rtp = new_rtp;
|
||||
set_option_value((char_u *)"rtp", 0L, new_rtp, 0);
|
||||
vim_free(new_rtp);
|
||||
}
|
||||
*p2 = c;
|
||||
|
||||
(void)do_source(fname, FALSE, DOSO_NONE);
|
||||
if (load_files)
|
||||
{
|
||||
static char *plugpat = "%s/plugin/*.vim";
|
||||
static char *ftpat = "%s/ftdetect/*.vim";
|
||||
int len;
|
||||
char_u *pat;
|
||||
|
||||
len = (int)STRLEN(ffname) + (int)STRLEN(ftpat);
|
||||
pat = alloc(len);
|
||||
if (pat == NULL)
|
||||
goto theend;
|
||||
vim_snprintf((char *)pat, len, plugpat, ffname);
|
||||
source_all_matches(pat);
|
||||
|
||||
#ifdef FEAT_AUTOCMD
|
||||
{
|
||||
char_u *cmd = vim_strsave((char_u *)"g:did_load_filetypes");
|
||||
|
||||
/* If runtime/filetype.vim wasn't loaded yet, the scripts will be
|
||||
* found when it loads. */
|
||||
if (cmd != NULL && eval_to_number(cmd) > 0)
|
||||
{
|
||||
do_cmdline_cmd((char_u *)"augroup filetypedetect");
|
||||
vim_snprintf((char *)pat, len, ftpat, ffname);
|
||||
source_all_matches(pat);
|
||||
do_cmdline_cmd((char_u *)"augroup END");
|
||||
}
|
||||
vim_free(cmd);
|
||||
}
|
||||
#endif
|
||||
vim_free(pat);
|
||||
}
|
||||
|
||||
theend:
|
||||
vim_free(ffname);
|
||||
}
|
||||
|
||||
static int did_source_packages = FALSE;
|
||||
|
||||
/*
|
||||
* ":packloadall"
|
||||
* Find plugins in the package directories and source them.
|
||||
*/
|
||||
void
|
||||
ex_packloadall(exarg_T *eap)
|
||||
{
|
||||
if (!did_source_packages || (eap != NULL && eap->forceit))
|
||||
{
|
||||
did_source_packages = TRUE;
|
||||
do_in_path(p_pp, (char_u *)"pack/*/start/*", DIP_ALL + DIP_DIR,
|
||||
add_pack_plugin, p_pp);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Source the plugins in the package directories.
|
||||
* ":packadd[!] {name}"
|
||||
*/
|
||||
void
|
||||
source_packages()
|
||||
ex_packadd(exarg_T *eap)
|
||||
{
|
||||
do_in_path(p_pp, (char_u *)"pack/*/ever/*/plugin/*.vim",
|
||||
TRUE, source_pack_plugin, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* ":loadplugin {name}"
|
||||
*/
|
||||
void
|
||||
ex_loadplugin(exarg_T *eap)
|
||||
{
|
||||
static char *pattern = "pack/*/opt/%s/plugin/*.vim";
|
||||
static char *plugpat = "pack/*/opt/%s";
|
||||
int len;
|
||||
char *pat;
|
||||
|
||||
len = (int)STRLEN(pattern) + (int)STRLEN(eap->arg);
|
||||
len = (int)STRLEN(plugpat) + (int)STRLEN(eap->arg);
|
||||
pat = (char *)alloc(len);
|
||||
if (pat == NULL)
|
||||
return;
|
||||
vim_snprintf(pat, len, pattern, eap->arg);
|
||||
do_in_path(p_pp, (char_u *)pat, TRUE, source_pack_plugin, NULL);
|
||||
vim_snprintf(pat, len, plugpat, eap->arg);
|
||||
do_in_path(p_pp, (char_u *)pat, DIP_ALL + DIP_DIR + DIP_ERR,
|
||||
add_pack_plugin, eap->forceit ? NULL : p_pp);
|
||||
vim_free(pat);
|
||||
}
|
||||
|
||||
|
||||
@@ -2013,7 +2013,7 @@ do_one_cmd(
|
||||
|
||||
case 'v': if (checkforcmd(&ea.cmd, "vertical", 4))
|
||||
{
|
||||
#ifdef FEAT_VERTSPLIT
|
||||
#ifdef FEAT_WINDOWS
|
||||
cmdmod.split |= WSP_VERT;
|
||||
#endif
|
||||
continue;
|
||||
@@ -4198,6 +4198,11 @@ set_one_cmd_context(
|
||||
xp->xp_pattern = arg;
|
||||
break;
|
||||
|
||||
case CMD_packadd:
|
||||
xp->xp_context = EXPAND_PACKADD;
|
||||
xp->xp_pattern = arg;
|
||||
break;
|
||||
|
||||
#if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
|
||||
&& (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE))
|
||||
case CMD_language:
|
||||
@@ -5846,6 +5851,7 @@ static struct
|
||||
{EXPAND_SYNTIME, "syntime"},
|
||||
#endif
|
||||
{EXPAND_SETTINGS, "option"},
|
||||
{EXPAND_PACKADD, "packadd"},
|
||||
{EXPAND_SHELLCMD, "shellcmd"},
|
||||
#if defined(FEAT_SIGNS)
|
||||
{EXPAND_SIGN, "sign"},
|
||||
@@ -7917,14 +7923,6 @@ ex_splitview(exarg_T *eap)
|
||||
int browse_flag = cmdmod.browse;
|
||||
# endif
|
||||
|
||||
# ifndef FEAT_VERTSPLIT
|
||||
if (eap->cmdidx == CMD_vsplit || eap->cmdidx == CMD_vnew)
|
||||
{
|
||||
ex_ni(eap);
|
||||
return;
|
||||
}
|
||||
# endif
|
||||
|
||||
# ifdef FEAT_GUI
|
||||
need_mouse_correct = TRUE;
|
||||
# endif
|
||||
@@ -7936,10 +7934,8 @@ ex_splitview(exarg_T *eap)
|
||||
{
|
||||
if (eap->cmdidx == CMD_split)
|
||||
eap->cmdidx = CMD_new;
|
||||
# ifdef FEAT_VERTSPLIT
|
||||
if (eap->cmdidx == CMD_vsplit)
|
||||
eap->cmdidx = CMD_vnew;
|
||||
# endif
|
||||
}
|
||||
# endif
|
||||
|
||||
@@ -7958,9 +7954,7 @@ ex_splitview(exarg_T *eap)
|
||||
# endif
|
||||
# ifdef FEAT_BROWSE
|
||||
if (cmdmod.browse
|
||||
# ifdef FEAT_VERTSPLIT
|
||||
&& eap->cmdidx != CMD_vnew
|
||||
# endif
|
||||
&& eap->cmdidx != CMD_new)
|
||||
{
|
||||
# ifdef FEAT_AUTOCMD
|
||||
@@ -8218,11 +8212,10 @@ ex_resize(exarg_T *eap)
|
||||
;
|
||||
}
|
||||
|
||||
#ifdef FEAT_GUI
|
||||
# ifdef FEAT_GUI
|
||||
need_mouse_correct = TRUE;
|
||||
#endif
|
||||
# endif
|
||||
n = atol((char *)eap->arg);
|
||||
#ifdef FEAT_VERTSPLIT
|
||||
if (cmdmod.split & WSP_VERT)
|
||||
{
|
||||
if (*eap->arg == '-' || *eap->arg == '+')
|
||||
@@ -8232,7 +8225,6 @@ ex_resize(exarg_T *eap)
|
||||
win_setwidth_win((int)n, wp);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (*eap->arg == '-' || *eap->arg == '+')
|
||||
n += curwin->w_height;
|
||||
@@ -8391,7 +8383,7 @@ do_exedit(
|
||||
if ((eap->cmdidx == CMD_new
|
||||
|| eap->cmdidx == CMD_tabnew
|
||||
|| eap->cmdidx == CMD_tabedit
|
||||
#ifdef FEAT_VERTSPLIT
|
||||
#ifdef FEAT_WINDOWS
|
||||
|| eap->cmdidx == CMD_vnew
|
||||
#endif
|
||||
) && *eap->arg == NUL)
|
||||
@@ -8403,7 +8395,7 @@ do_exedit(
|
||||
old_curwin == NULL ? curwin : NULL);
|
||||
}
|
||||
else if ((eap->cmdidx != CMD_split
|
||||
#ifdef FEAT_VERTSPLIT
|
||||
#ifdef FEAT_WINDOWS
|
||||
&& eap->cmdidx != CMD_vsplit
|
||||
#endif
|
||||
)
|
||||
@@ -8888,12 +8880,22 @@ ex_sleep(exarg_T *eap)
|
||||
do_sleep(long msec)
|
||||
{
|
||||
long done;
|
||||
long wait_now;
|
||||
|
||||
cursor_on();
|
||||
out_flush();
|
||||
for (done = 0; !got_int && done < msec; done += 1000L)
|
||||
for (done = 0; !got_int && done < msec; done += wait_now)
|
||||
{
|
||||
ui_delay(msec - done > 1000L ? 1000L : msec - done, TRUE);
|
||||
wait_now = msec - done > 1000L ? 1000L : msec - done;
|
||||
#ifdef FEAT_TIMERS
|
||||
{
|
||||
long due_time = check_due_timer();
|
||||
|
||||
if (due_time > 0 && due_time < wait_now)
|
||||
wait_now = due_time;
|
||||
}
|
||||
#endif
|
||||
ui_delay(wait_now, TRUE);
|
||||
ui_breakcheck();
|
||||
#ifdef MESSAGE_QUEUE
|
||||
/* Process the netbeans and clientserver messages that may have been
|
||||
@@ -11771,16 +11773,16 @@ ex_filetype(exarg_T *eap)
|
||||
{
|
||||
if (*arg == 'o' || !filetype_detect)
|
||||
{
|
||||
source_runtime((char_u *)FILETYPE_FILE, TRUE);
|
||||
source_runtime((char_u *)FILETYPE_FILE, DIP_ALL);
|
||||
filetype_detect = TRUE;
|
||||
if (plugin)
|
||||
{
|
||||
source_runtime((char_u *)FTPLUGIN_FILE, TRUE);
|
||||
source_runtime((char_u *)FTPLUGIN_FILE, DIP_ALL);
|
||||
filetype_plugin = TRUE;
|
||||
}
|
||||
if (indent)
|
||||
{
|
||||
source_runtime((char_u *)INDENT_FILE, TRUE);
|
||||
source_runtime((char_u *)INDENT_FILE, DIP_ALL);
|
||||
filetype_indent = TRUE;
|
||||
}
|
||||
}
|
||||
@@ -11796,18 +11798,18 @@ ex_filetype(exarg_T *eap)
|
||||
{
|
||||
if (plugin)
|
||||
{
|
||||
source_runtime((char_u *)FTPLUGOF_FILE, TRUE);
|
||||
source_runtime((char_u *)FTPLUGOF_FILE, DIP_ALL);
|
||||
filetype_plugin = FALSE;
|
||||
}
|
||||
if (indent)
|
||||
{
|
||||
source_runtime((char_u *)INDOFF_FILE, TRUE);
|
||||
source_runtime((char_u *)INDOFF_FILE, DIP_ALL);
|
||||
filetype_indent = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
source_runtime((char_u *)FTOFF_FILE, TRUE);
|
||||
source_runtime((char_u *)FTOFF_FILE, DIP_ALL);
|
||||
filetype_detect = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -432,7 +432,7 @@ get_exception_string(
|
||||
|
||||
if (type == ET_ERROR)
|
||||
{
|
||||
*should_free = FALSE;
|
||||
*should_free = TRUE;
|
||||
mesg = ((struct msglist *)value)->throw_msg;
|
||||
if (cmdname != NULL && *cmdname != NUL)
|
||||
{
|
||||
@@ -489,7 +489,7 @@ get_exception_string(
|
||||
else
|
||||
{
|
||||
*should_free = FALSE;
|
||||
ret = (char_u *) value;
|
||||
ret = (char_u *)value;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user