mirror of
https://github.com/zoriya/vim.git
synced 2025-12-25 00:25:21 +00:00
Compare commits
315 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7fed5c18f8 | ||
|
|
d18cfb7dbf | ||
|
|
e609ad557c | ||
|
|
72188e9aae | ||
|
|
ef9d9b94a8 | ||
|
|
925ccfde79 | ||
|
|
7d2a5796d3 | ||
|
|
8b29aba019 | ||
|
|
0b9e4d1224 | ||
|
|
fead3ac9a3 | ||
|
|
e101204906 | ||
|
|
cf2d8dee51 | ||
|
|
2946d0236d | ||
|
|
e934e8f5c1 | ||
|
|
61264d9969 | ||
|
|
a32095fc8f | ||
|
|
8b877ac38e | ||
|
|
ee1f7b3cb7 | ||
|
|
84e1d2b21a | ||
|
|
46c00a6565 | ||
|
|
8038568722 | ||
|
|
89c64d557d | ||
|
|
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 | ||
|
|
b5760a1ce5 | ||
|
|
f1d2501ebe | ||
|
|
00ded43a5a | ||
|
|
5fac467474 | ||
|
|
d1413d9098 | ||
|
|
4ca812b153 | ||
|
|
bf73b91c66 | ||
|
|
289a90551d | ||
|
|
42bc6dde46 | ||
|
|
51d1d53680 | ||
|
|
10b369f670 | ||
|
|
6b584af3d7 | ||
|
|
cc7f8be3e0 | ||
|
|
5131c144fe | ||
|
|
a6b8976bb7 | ||
|
|
2f6271b1e7 | ||
|
|
a86f14a923 | ||
|
|
fdcc9afb71 | ||
|
|
e081e21f76 | ||
|
|
fdd6ce4a2f | ||
|
|
d42119fff2 | ||
|
|
29e1951e14 | ||
|
|
fc2457e21d | ||
|
|
9730f74a0b | ||
|
|
9bfdba3de3 | ||
|
|
18b5d6df10 | ||
|
|
707659490d | ||
|
|
1c39102666 | ||
|
|
8cc6977a96 | ||
|
|
c5215e943b | ||
|
|
d6051b5eb8 | ||
|
|
80e7884739 | ||
|
|
b362872837 | ||
|
|
0f526f5652 | ||
|
|
dae8d21dd2 | ||
|
|
3f2a5d8dfb | ||
|
|
e0fd2aa8f6 | ||
|
|
e26643e6bc | ||
|
|
fefecb0fbe | ||
|
|
f97ddbeb25 | ||
|
|
c7f0ebc6d1 | ||
|
|
136f29a91d | ||
|
|
e98991b8cf | ||
|
|
8b1862a316 | ||
|
|
b6ff81188d | ||
|
|
85b11769ab | ||
|
|
4d1961783f | ||
|
|
9e24f0c5c1 | ||
|
|
7ce686c990 | ||
|
|
d804fdf4c2 | ||
|
|
edb4f2b360 | ||
|
|
43acbce1bb | ||
|
|
187db50d04 | ||
|
|
6e722e2f94 | ||
|
|
0c0dac1fb1 | ||
|
|
4cafa6dc7f | ||
|
|
46c85439c9 | ||
|
|
c8dcbb12c5 | ||
|
|
d2227a02b0 | ||
|
|
49c39ff678 | ||
|
|
923d926d57 | ||
|
|
265f64efcf | ||
|
|
669cac0a80 | ||
|
|
f391327adb | ||
|
|
84f4996d2a | ||
|
|
81275ca9ce | ||
|
|
8b374215cc | ||
|
|
68c85fcdf3 | ||
|
|
9e34110816 | ||
|
|
42dd7aee41 | ||
|
|
1858a842af | ||
|
|
3ea0f1ae31 | ||
|
|
f1b6ac7229 | ||
|
|
e16e5a9d8d | ||
|
|
8aefbe0ad5 | ||
|
|
9186a27622 | ||
|
|
0106e3d0bf | ||
|
|
9892189d2e | ||
|
|
6bd364e084 | ||
|
|
254ebaf068 | ||
|
|
48e330aff9 | ||
|
|
4e221c99e8 | ||
|
|
0bb6108eb4 | ||
|
|
1daae446e5 | ||
|
|
eed284a169 | ||
|
|
0b962473dd | ||
|
|
bd73ae1bc6 | ||
|
|
2cd5bb2505 | ||
|
|
4db20ab091 | ||
|
|
33c31d5abf | ||
|
|
b2bd6a087d | ||
|
|
bdcd752750 | ||
|
|
8f8ae40ce4 | ||
|
|
23c463a157 | ||
|
|
5e83840756 | ||
|
|
f6fee0e2d4 | ||
|
|
271273c39f | ||
|
|
02e83b438e | ||
|
|
eab089d22f | ||
|
|
ee1cffc07a |
53
Filelist
53
Filelist
@@ -6,6 +6,7 @@ SRC_ALL = \
|
||||
.hgignore \
|
||||
.travis.yml \
|
||||
appveyor.yml \
|
||||
src/appveyor.bat \
|
||||
src/README.txt \
|
||||
src/alloc.h \
|
||||
src/arabic.c \
|
||||
@@ -261,7 +262,6 @@ SRC_DOS_UNIX = \
|
||||
src/if_python3.c \
|
||||
src/if_py_both.h \
|
||||
src/if_ruby.c \
|
||||
src/if_sniff.h \
|
||||
src/if_tcl.c \
|
||||
src/proto/if_cscope.pro \
|
||||
src/proto/if_lua.pro \
|
||||
@@ -291,11 +291,9 @@ SRC_DOS = \
|
||||
src/GvimExt/uninst.bat \
|
||||
README_srcdos.txt \
|
||||
src/INSTALLpc.txt \
|
||||
src/Make_bc3.mak \
|
||||
src/Make_bc5.mak \
|
||||
src/Make_cyg.mak \
|
||||
src/Make_cyg_ming.mak \
|
||||
src/Make_djg.mak \
|
||||
src/Make_ivc.mak \
|
||||
src/Make_dvc.mak \
|
||||
src/Make_ming.mak \
|
||||
@@ -321,8 +319,6 @@ SRC_DOS = \
|
||||
src/if_perl_msvc/stdbool.h \
|
||||
src/iid_ole.c \
|
||||
src/os_dos.h \
|
||||
src/os_msdos.c \
|
||||
src/os_msdos.h \
|
||||
src/os_w32dll.c \
|
||||
src/os_w32exe.c \
|
||||
src/os_win32.c \
|
||||
@@ -330,7 +326,6 @@ SRC_DOS = \
|
||||
src/os_win32.h \
|
||||
src/proto/gui_w32.pro \
|
||||
src/proto/if_ole.pro \
|
||||
src/proto/os_msdos.pro \
|
||||
src/proto/os_win32.pro \
|
||||
src/proto/os_mswin.pro \
|
||||
src/testdir/Make_dos.mak \
|
||||
@@ -345,9 +340,7 @@ SRC_DOS = \
|
||||
src/vimtbar.h \
|
||||
src/xpm_w32.c \
|
||||
src/xpm_w32.h \
|
||||
src/xxd/Make_bc3.mak \
|
||||
src/xxd/Make_bc5.mak \
|
||||
src/xxd/Make_djg.mak \
|
||||
src/xxd/Make_ming.mak \
|
||||
src/xxd/Make_mvc.mak \
|
||||
nsis/gvim.nsi \
|
||||
@@ -461,7 +454,6 @@ SRC_EXTRA = \
|
||||
$(SRC_VMS) \
|
||||
README_os390.txt \
|
||||
src/Make_mint.mak \
|
||||
src/if_sniff.c \
|
||||
src/infplist.xml \
|
||||
src/link.390 \
|
||||
src/os_beos.c \
|
||||
@@ -491,7 +483,6 @@ RT_ALL = \
|
||||
runtime/ftoff.vim \
|
||||
runtime/gvimrc_example.vim \
|
||||
runtime/macros/README.txt \
|
||||
runtime/macros/dvorak \
|
||||
runtime/macros/editexisting.vim \
|
||||
runtime/macros/hanoi/click.me \
|
||||
runtime/macros/hanoi/hanoi.vim \
|
||||
@@ -503,7 +494,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 \
|
||||
@@ -533,6 +523,16 @@ RT_ALL = \
|
||||
runtime/tutor/tutor \
|
||||
runtime/tutor/tutor.vim \
|
||||
runtime/vimrc_example.vim \
|
||||
runtime/pack/dist/opt/dvorak/plugin/dvorak.vim \
|
||||
runtime/pack/dist/opt/dvorak/dvorak/enable.vim \
|
||||
runtime/pack/dist/opt/dvorak/dvorak/disable.vim \
|
||||
runtime/pack/dist/opt/editexisting/plugin/editexisting.vim \
|
||||
runtime/pack/dist/opt/justify/plugin/justify.vim \
|
||||
runtime/pack/dist/opt/matchit/plugin/matchit.vim \
|
||||
runtime/pack/dist/opt/matchit/doc/matchit.txt \
|
||||
runtime/pack/dist/opt/matchit/doc/tags \
|
||||
runtime/pack/dist/opt/shellmenu/plugin/shellmenu.vim \
|
||||
runtime/pack/dist/opt/swapmouse/plugin/swapmouse.vim \
|
||||
|
||||
# runtime files for all distributions without CR-NL translation
|
||||
RT_ALL_BIN = \
|
||||
@@ -613,7 +613,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 \
|
||||
@@ -700,7 +699,35 @@ EXTRA = \
|
||||
src/tee/Makefile \
|
||||
src/tee/Make_mvc.mak \
|
||||
src/tee/tee.c \
|
||||
csdpmi4b.zip \
|
||||
|
||||
# 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 = \
|
||||
|
||||
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
|
||||
|
||||
67
README.md
67
README.md
@@ -2,25 +2,28 @@
|
||||
[](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? ##
|
||||
|
||||
Vim is an almost compatible version of the UNIX editor Vi. Many new features
|
||||
have been added: multi-level undo, syntax highlighting, command line history,
|
||||
on-line help, spell checking, filename completion, block operations, etc.
|
||||
There is also a Graphical User Interface (GUI) available. See
|
||||
`runtime/doc/vi_diff.txt` for differences with Vi.
|
||||
Vim is a greatly improved version of the good old UNIX editor Vi. Many new
|
||||
features have been added: multi-level undo, syntax highlighting, command line
|
||||
history, on-line help, spell checking, filename completion, block operations,
|
||||
script language, etc. There is also a Graphical User Interface (GUI)
|
||||
available. Still, Vi compatibility is maintained, those who have Vi "in the
|
||||
fingers" will feel at home. See `runtime/doc/vi_diff.txt` for differences with
|
||||
Vi.
|
||||
|
||||
This editor is very useful for editing programs and other plain text files.
|
||||
All commands are given with normal keyboard characters, so those who can type
|
||||
with ten fingers can work very fast. Additionally, function keys can be
|
||||
defined by the user, and the mouse can be used.
|
||||
mapped to commands by the user, and the mouse can be used.
|
||||
|
||||
Vim runs under MS-DOS, MS-Windows (NT, 2000, XP, Vista, 7, 8, 10), Macintosh,
|
||||
VMS and almost all flavours of UNIX. Porting to other systems should not be
|
||||
very difficult. Older versions of Vim run on MS-Windows 95/98/Me, Amiga DOS,
|
||||
Atari MiNT, BeOS, RISC OS and OS/2. These are no longer maintained.
|
||||
Vim runs under MS-Windows (NT, 2000, XP, Vista, 7, 8, 10), Macintosh, VMS and
|
||||
almost all flavours of UNIX. Porting to other systems should not be very
|
||||
difficult. Older versions of Vim run on MS-DOS, MS-Windows 95/98/Me, Amiga
|
||||
DOS, Atari MiNT, BeOS, RISC OS and OS/2. These are no longer maintained.
|
||||
|
||||
|
||||
## Distribution ##
|
||||
@@ -38,9 +41,31 @@ want or must compile it yourself. Check http://www.vim.org/download.php for
|
||||
an overview of currently available distributions.
|
||||
|
||||
|
||||
## Compiling ##
|
||||
|
||||
If you obtained a binary distribution you don't need to compile Vim. If you
|
||||
obtained a source distribution, all the stuff for compiling Vim is in the
|
||||
`src` directory. See `src/INSTALL` for instructions.
|
||||
|
||||
|
||||
## Installation ##
|
||||
|
||||
See one of these files for system-specific instructions. Either in the
|
||||
READMEdir directory (in the repository) or the top directory (if you unpack an
|
||||
archive):
|
||||
|
||||
README_ami.txt Amiga
|
||||
README_unix.txt Unix
|
||||
README_dos.txt MS-DOS and MS-Windows
|
||||
README_mac.txt Macintosh
|
||||
README_vms.txt VMS
|
||||
|
||||
There are other `README_*.txt` files, depending on the distribution you used.
|
||||
|
||||
|
||||
## Documentation ##
|
||||
|
||||
The vim tutor is a one hour training course for beginners. Mostly it can be
|
||||
The Vim tutor is a one hour training course for beginners. Often it can be
|
||||
started as `vimtutor`. See `:help tutor` for more information.
|
||||
|
||||
The best is to use `:help` in Vim. If you don't have an executable yet, read
|
||||
@@ -76,26 +101,6 @@ For the most recent information about sponsoring look on the Vim web site:
|
||||
http://www.vim.org/sponsor/
|
||||
|
||||
|
||||
## Compiling ##
|
||||
|
||||
If you obtained a binary distribution you don't need to compile Vim. If you
|
||||
obtained a source distribution, all the stuff for compiling Vim is in the
|
||||
`src` directory. See `src/INSTALL` for instructions.
|
||||
|
||||
|
||||
## Installation ##
|
||||
|
||||
See one of these files for system-specific instructions:
|
||||
|
||||
README_ami.txt Amiga
|
||||
README_unix.txt Unix
|
||||
README_dos.txt MS-DOS and MS-Windows
|
||||
README_mac.txt Macintosh
|
||||
README_vms.txt VMS
|
||||
|
||||
There are more `README_*.txt` files, depending on the distribution you used.
|
||||
|
||||
|
||||
## Contributing ##
|
||||
|
||||
If you would like to help making Vim better, see the [CONTRIBUTING.md](https://github.com/vim/vim/blob/master/CONTRIBUTING.md) file.
|
||||
|
||||
64
README.txt
64
README.txt
@@ -3,21 +3,23 @@ README.txt for version 7.4 of Vim: Vi IMproved.
|
||||
|
||||
WHAT IS VIM?
|
||||
|
||||
Vim is an almost compatible version of the UNIX editor Vi. Many new features
|
||||
have been added: multi-level undo, syntax highlighting, command line history,
|
||||
on-line help, spell checking, filename completion, block operations, etc.
|
||||
There is also a Graphical User Interface (GUI) available. See
|
||||
"runtime/doc/vi_diff.txt" for differences with Vi.
|
||||
Vim is a greatly improved version of the good old UNIX editor Vi. Many new
|
||||
features have been added: multi-level undo, syntax highlighting, command line
|
||||
history, on-line help, spell checking, filename completion, block operations,
|
||||
script language, etc. There is also a Graphical User Interface (GUI)
|
||||
available. Still, Vi compatibility is maintained, those who have Vi "in the
|
||||
fingers" will feel at home. See "runtime/doc/vi_diff.txt" for differences with
|
||||
Vi.
|
||||
|
||||
This editor is very useful for editing programs and other plain text files.
|
||||
All commands are given with normal keyboard characters, so those who can type
|
||||
with ten fingers can work very fast. Additionally, function keys can be
|
||||
defined by the user, and the mouse can be used.
|
||||
mapped to commands by the user, and the mouse can be used.
|
||||
|
||||
Vim runs under MS-DOS, MS-Windows (NT, 2000, XP, Vista, 7, 8, 10), Macintosh,
|
||||
VMS and almost all flavours of UNIX. Porting to other systems should not be
|
||||
very difficult. Older versions of Vim run on MS-Windows 95/98/Me, Amiga DOS,
|
||||
Atari MiNT, BeOS, RISC OS and OS/2. These are no longer maintained.
|
||||
Vim runs under MS-Windows (NT, 2000, XP, Vista, 7, 8, 10), Macintosh, VMS and
|
||||
almost all flavours of UNIX. Porting to other systems should not be very
|
||||
difficult. Older versions of Vim run on MS-DOS, MS-Windows 95/98/Me, Amiga
|
||||
DOS, Atari MiNT, BeOS, RISC OS and OS/2. These are no longer maintained.
|
||||
|
||||
|
||||
DISTRIBUTION
|
||||
@@ -35,9 +37,31 @@ want or must compile it yourself. Check "http://www.vim.org/download.php" for
|
||||
an overview of currently available distributions.
|
||||
|
||||
|
||||
COMPILING
|
||||
|
||||
If you obtained a binary distribution you don't need to compile Vim. If you
|
||||
obtained a source distribution, all the stuff for compiling Vim is in the
|
||||
"src" directory. See src/INSTALL for instructions.
|
||||
|
||||
|
||||
INSTALLATION
|
||||
|
||||
See one of these files for system-specific instructions. Either in the
|
||||
READMEdir directory (in the repository) or the top directory (if you unpack an
|
||||
archive):
|
||||
|
||||
README_ami.txt Amiga
|
||||
README_unix.txt Unix
|
||||
README_dos.txt MS-DOS and MS-Windows
|
||||
README_mac.txt Macintosh
|
||||
README_vms.txt VMS
|
||||
|
||||
There are more README_*.txt files, depending on the distribution you used.
|
||||
|
||||
|
||||
DOCUMENTATION
|
||||
|
||||
The vim tutor is a one hour training course for beginners. Mostly it can be
|
||||
The Vim tutor is a one hour training course for beginners. Often it can be
|
||||
started as "vimtutor". See ":help tutor" for more information.
|
||||
|
||||
The best is to use ":help" in Vim. If you don't have an executable yet, read
|
||||
@@ -74,23 +98,9 @@ For the most recent information about sponsoring look on the Vim web site:
|
||||
http://www.vim.org/sponsor/
|
||||
|
||||
|
||||
COMPILING
|
||||
CONTRIBUTING
|
||||
|
||||
If you obtained a binary distribution you don't need to compile Vim. If you
|
||||
obtained a source distribution, all the stuff for compiling Vim is in the
|
||||
"src" directory. See src/INSTALL for instructions.
|
||||
|
||||
|
||||
INSTALLATION
|
||||
|
||||
See one of these files for system-specific instructions:
|
||||
README_ami.txt Amiga
|
||||
README_unix.txt Unix
|
||||
README_dos.txt MS-DOS and MS-Windows
|
||||
README_mac.txt Macintosh
|
||||
README_vms.txt VMS
|
||||
|
||||
There are more README_*.txt files, depending on the distribution you used.
|
||||
If you would like to help making Vim better, see the CONTRIBUTING.md file.
|
||||
|
||||
|
||||
INFORMATION
|
||||
|
||||
@@ -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
26
appveyor.yml
26
appveyor.yml
@@ -2,6 +2,18 @@ version: "{build}"
|
||||
|
||||
skip_tags: true
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
- FEATURE: HUGE
|
||||
- FEATURE: NORMAL
|
||||
# disabled
|
||||
# - FEATURE: TINY
|
||||
# - FEATURE: SMALL
|
||||
# - FEATURE: BIG
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
|
||||
before_build:
|
||||
- '"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 /release'
|
||||
# Work around for Python 2.7.11's bug
|
||||
@@ -9,12 +21,14 @@ before_build:
|
||||
- reg copy HKLM\SOFTWARE\Python\PythonCore\2.7 HKLM\SOFTWARE\Python\PythonCore\2.7-32 /s /reg:64
|
||||
|
||||
build_script:
|
||||
- cd src
|
||||
- sed -e "s/\$(LINKARGS2)/\$(LINKARGS2) | sed -e 's#.*\\\\r.*##'/" Make_mvc.mak > Make_mvc2.mak
|
||||
- nmake -f Make_mvc2.mak CPU=AMD64 GUI=yes IME=yes MBYTE=yes ICONV=yes DEBUG=no PYTHON_VER=27 DYNAMIC_PYTHON=yes PYTHON=C:\Python27-x64 PYTHON3_VER=34 DYNAMIC_PYTHON3=yes PYTHON3=C:\Python34-x64
|
||||
- .\gvim -u NONE -c "redir @a | ver | 0put a | wq!" ver.txt
|
||||
- type ver.txt
|
||||
- src/appveyor.bat
|
||||
|
||||
test_script:
|
||||
- cd testdir
|
||||
- cd src/testdir
|
||||
# Testing with MSVC gvim
|
||||
- nmake -f Make_dos.mak VIMPROG=..\gvim
|
||||
- nmake -f Make_dos.mak clean
|
||||
# Testing with MingW console version
|
||||
- nmake -f Make_dos.mak VIMPROG=..\vim
|
||||
|
||||
# vim: sw=2 sts=2 et ts=2 sr
|
||||
|
||||
BIN
csdpmi4b.zip
BIN
csdpmi4b.zip
Binary file not shown.
BIN
libs/arp.library
BIN
libs/arp.library
Binary file not shown.
@@ -32,7 +32,6 @@ DOCS = \
|
||||
ft_ada.txt \
|
||||
ft_sql.txt \
|
||||
gui.txt \
|
||||
gui_w16.txt \
|
||||
gui_w32.txt \
|
||||
gui_x11.txt \
|
||||
hangulin.txt \
|
||||
@@ -167,7 +166,6 @@ HTMLS = \
|
||||
ft_ada.html \
|
||||
ft_sql.html \
|
||||
gui.html \
|
||||
gui_w16.html \
|
||||
gui_w32.html \
|
||||
gui_x11.html \
|
||||
hangulin.html \
|
||||
@@ -388,9 +386,6 @@ hebrew.txt:
|
||||
russian.txt:
|
||||
touch russian.txt
|
||||
|
||||
gui_w16.txt:
|
||||
touch gui_w16.txt
|
||||
|
||||
gui_w32.txt:
|
||||
touch gui_w32.txt
|
||||
|
||||
|
||||
@@ -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 20
|
||||
*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:
|
||||
@@ -74,7 +74,7 @@ In T1 you should see:
|
||||
=== socket opened === ~
|
||||
|
||||
You can now send a message to the server: >
|
||||
echo ch_sendexpr(channel, 'hello!')
|
||||
echo ch_evalexpr(channel, 'hello!')
|
||||
|
||||
The message is received in T1 and a response is sent back to Vim.
|
||||
You can see the raw messages in T1. What Vim sends is:
|
||||
@@ -93,7 +93,7 @@ To handle asynchronous communication a callback needs to be used: >
|
||||
func MyHandler(channel, msg)
|
||||
echo "from the handler: " . a:msg
|
||||
endfunc
|
||||
call ch_sendexpr(channel, 'hello!', "MyHandler")
|
||||
call ch_sendexpr(channel, 'hello!', {'callback': "MyHandler"})
|
||||
Vim will not wait for a response. Now the server can send the response later
|
||||
and MyHandler will be invoked.
|
||||
|
||||
@@ -101,97 +101,101 @@ Instead of giving a callback with every send call, it can also be specified
|
||||
when opening the channel: >
|
||||
call ch_close(channel)
|
||||
let channel = ch_open('localhost:8765', {'callback': "MyHandler"})
|
||||
call ch_sendexpr(channel, 'hello!', 0)
|
||||
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*
|
||||
|
||||
To open a channel: >
|
||||
let channel = ch_open({address} [, {options}])
|
||||
if ch_status(channel) == "open"
|
||||
" use the channel
|
||||
|
||||
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.
|
||||
|
||||
*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
|
||||
handle and the received message. Example: >
|
||||
and the received message. Example: >
|
||||
func Handle(channel, msg)
|
||||
echo 'Received: ' . a:msg
|
||||
endfunc
|
||||
let channel = ch_open("localhost:8765", {"callback": "Handle"})
|
||||
<
|
||||
"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.
|
||||
When "mode" is "json" or "js" the "msg" argument is the body
|
||||
of the received message, converted to Vim types.
|
||||
When "mode" is "nl" the "msg" argument is one message,
|
||||
excluding the NL.
|
||||
When "mode" is "raw" the "msg" argument is the whole message
|
||||
as a string.
|
||||
|
||||
"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" 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*
|
||||
"waittime" The time to wait for the connection to be made in
|
||||
milliseconds. The default is zero, don't wait, which is
|
||||
useful if the server is supposed to be running already. A
|
||||
negative number waits forever.
|
||||
milliseconds. A negative number waits forever.
|
||||
|
||||
The default is zero, don't wait, which is useful if a local
|
||||
server is supposed to be running already. On Unix Vim
|
||||
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_sendexpr(). In milliseconds. The default is 2000 (2
|
||||
ch_evalexpr(). In milliseconds. The default is 2000 (2
|
||||
seconds).
|
||||
|
||||
"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 "msg" argument is the body of the received
|
||||
message, converted to Vim types.
|
||||
When "mode" is "raw" the "msg" argument is the whole message as a string.
|
||||
|
||||
When "mode" is "json" or "js" the "callback" is optional. When omitted it is
|
||||
only possible to receive a message after sending one.
|
||||
|
||||
To change the channel options after opening it use ch_setoptions(). The
|
||||
arguments are similar to what is passed to ch_open(), but "waittime" cannot be
|
||||
given, since that only applies to opening the channel.
|
||||
To change the channel options after opening it use |ch_setoptions()|. The
|
||||
arguments are similar to what is passed to |ch_open()|, but "waittime" cannot
|
||||
be given, since that only applies to opening the channel.
|
||||
|
||||
The handler can be added or changed: >
|
||||
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})
|
||||
<
|
||||
*E906*
|
||||
*channel-close* *E906*
|
||||
Once done with the channel, disconnect it like this: >
|
||||
call ch_close(channel)
|
||||
When a socket is used this will close the socket for both directions. When
|
||||
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.
|
||||
|
||||
TODO:
|
||||
Currently up to 10 channels can be in use at the same time. *E897*
|
||||
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
|
||||
@@ -205,18 +209,19 @@ If there is an error reading or writing a channel it will be closed.
|
||||
4. Using a JSON or JS channel *channel-use*
|
||||
|
||||
If mode is JSON then a message can be sent synchronously like this: >
|
||||
let response = ch_sendexpr(channel, {expr})
|
||||
let response = ch_evalexpr(channel, {expr})
|
||||
This awaits a response from the other side.
|
||||
|
||||
When mode is JS this works the same, except that the messages use
|
||||
JavaScript encoding. See |js_encode()| for the difference.
|
||||
|
||||
To send a message, without handling a response: >
|
||||
call ch_sendexpr(channel, {expr}, 0)
|
||||
To send a message, without handling a response or letting the channel callback
|
||||
handle the response: >
|
||||
call ch_sendexpr(channel, {expr})
|
||||
|
||||
To send a message and letting the response handled by a specific function,
|
||||
asynchronously: >
|
||||
call ch_sendexpr(channel, {expr}, {callback})
|
||||
call ch_sendexpr(channel, {expr}, {'callback': Handler})
|
||||
|
||||
Vim will match the response with the request using the message ID. Once the
|
||||
response is received the callback will be invoked. Further responses with the
|
||||
@@ -249,11 +254,13 @@ 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.
|
||||
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() on a JSON or JS channel. The caller
|
||||
is then completely responsible for correct encoding and decoding.
|
||||
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
|
||||
decoding.
|
||||
|
||||
==============================================================================
|
||||
5. Channel commands *channel-commands*
|
||||
@@ -301,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" ~
|
||||
|
||||
@@ -319,7 +329,7 @@ It will send back the result of the expression:
|
||||
[-2, "last line"] ~
|
||||
The format is:
|
||||
[{number}, {result}]
|
||||
*E915*
|
||||
|
||||
Here {number} is the same as what was in the request. Use a negative number
|
||||
to avoid confusion with message that Vim sends. Use a different number on
|
||||
every request to be able to match the request with the response.
|
||||
@@ -352,7 +362,7 @@ Leave out the fourth argument if no response is to be sent:
|
||||
6. Using a RAW or NL channel *channel-raw*
|
||||
|
||||
If mode is RAW or NL then a message can be send like this: >
|
||||
let response = ch_sendraw(channel, {string})
|
||||
let response = ch_evalraw(channel, {string})
|
||||
|
||||
The {string} is sent as-is. The response will be what can be read from the
|
||||
channel right away. Since Vim doesn't know how to recognize the end of the
|
||||
@@ -366,18 +376,18 @@ first NL. This can also be just the NL for an empty response.
|
||||
If no NL was read before the channel timeout an empty string is returned.
|
||||
|
||||
To send a message, without expecting a response: >
|
||||
call ch_sendraw(channel, {string}, 0)
|
||||
call ch_sendraw(channel, {string})
|
||||
The process can send back a response, the channel handler will be called with
|
||||
it.
|
||||
|
||||
To send a message and letting the response handled by a specific function,
|
||||
asynchronously: >
|
||||
call ch_sendraw(channel, {string}, {callback})
|
||||
call ch_sendraw(channel, {string}, {'callback': 'MyHandler'})
|
||||
|
||||
This {string} can also be JSON, use |json_encode()| to create it and
|
||||
|json_decode()| to handle a received JSON message.
|
||||
|
||||
It is not possible to use |ch_sendexpr()| on a raw channel.
|
||||
It is not possible to use |ch_evalexpr()| or |ch_sendexpr()| on a raw channel.
|
||||
|
||||
==============================================================================
|
||||
7. More channel functions *channel-more*
|
||||
@@ -388,8 +398,7 @@ are:
|
||||
"open" The channel can be used.
|
||||
"closed" The channel was closed.
|
||||
|
||||
TODO:
|
||||
To objain the job associated with a channel: ch_getjob(channel)
|
||||
To obtain the job associated with a channel: ch_getjob(channel)
|
||||
|
||||
To read one message from a channel: >
|
||||
let output = ch_read(channel)
|
||||
@@ -404,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*
|
||||
|
||||
@@ -419,119 +445,213 @@ 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)
|
||||
|
||||
Without the handler you need to read the output with ch_read().
|
||||
Without the handler you need to read the output with |ch_read()| or
|
||||
|ch_readraw()|.
|
||||
|
||||
The handler defined for "out-cb" will also 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"})
|
||||
|
||||
You can send a message to the command with ch_sendraw(). If the channel is in
|
||||
JSON or JS mode you can use ch_sendexpr().
|
||||
If you want to handle both stderr and stdout with one handler use the
|
||||
"callback" option: >
|
||||
let job = job_start(command, {"callback": "MyHandler"})
|
||||
|
||||
You can send a message to the command with ch_evalraw(). If the channel is in
|
||||
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'})
|
||||
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*
|
||||
|
||||
The {options} argument in job_start() is a dictionary. All entries are
|
||||
optional. The same options can be used with job_setoptions(job, {options}).
|
||||
optional. Some options can be used after the job has started, using
|
||||
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.
|
||||
TODO: *job-close-cb*
|
||||
"close-cb": handler Callback for when the channel is closed. Same as
|
||||
"close-cb" on ch_open().
|
||||
TODO: *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.
|
||||
TODO: *job-killonexit*
|
||||
"killonexit": 1 Stop the job when Vim exits.
|
||||
"killonexit": 0 Do not stop the job when Vim exits.
|
||||
The default is 1.
|
||||
TODO: *job-term*
|
||||
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".
|
||||
|
||||
*job-term*
|
||||
"term": "open" Start a terminal and connect the job
|
||||
stdin/stdout/stderr to it.
|
||||
NOTE: Not implemented yet!
|
||||
|
||||
TODO: *job-in-io*
|
||||
"in-io": "null" disconnect stdin
|
||||
"in-io": "pipe" stdin is connected to the channel (default)
|
||||
"in-io": "file" stdin reads from a file
|
||||
"in-file": "/path/file" the file to read from
|
||||
"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.
|
||||
|
||||
TODO: *job-out-io*
|
||||
"out-io": "null" disconnect stdout
|
||||
"out-io": "pipe" stdout is connected to the channel (default)
|
||||
"out-io": "file" stdout writes to a file
|
||||
"out-file": "/path/file" the file to write to
|
||||
"out-io": "buffer" stdout appends to a buffer
|
||||
"out-buffer": "name" buffer to append to
|
||||
*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
|
||||
|
||||
TODO: *job-err-io*
|
||||
"err-io": "out" same type as stdout (default)
|
||||
"err-io": "null" disconnect stderr
|
||||
"err-io": "pipe" stderr is connected to the channel
|
||||
"err-io": "file" stderr writes to a file
|
||||
"err-file": "/path/file" the file to write to
|
||||
"err-io": "buffer" stderr appends to a buffer
|
||||
"err-buffer": "name" buffer to append to
|
||||
*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
|
||||
|
||||
TODO: more options
|
||||
*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.
|
||||
Use an empty name to always create a new buffer. |ch_getbufnr()| can then be
|
||||
used to get the buffer number.
|
||||
|
||||
For a new buffer 'buftype' is set to "nofile" and 'bufhidden' to "hide". If
|
||||
you prefer other settings, create the buffer first and pass the buffer number.
|
||||
|
||||
When the buffer written to is displayed in a window and the cursor is in the
|
||||
first column of the last line, the cursor will be moved to the newly added
|
||||
line and the window is scrolled up to show the cursor if needed.
|
||||
|
||||
Undo is synced for every added line.
|
||||
|
||||
|
||||
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 19
|
||||
*eval.txt* For Vim version 7.4. Last change: 2016 Mar 27
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -59,11 +59,11 @@ Dictionary An associative, unordered array: Each entry has a key and a
|
||||
Funcref A reference to a function |Funcref|.
|
||||
Example: function("strlen")
|
||||
|
||||
Special v:false, v:true, v:none and v:null
|
||||
Special |v:false|, |v:true|, |v:none| and |v:null|. *Special*
|
||||
|
||||
Job Used for a job, see |job_start()|.
|
||||
Job Used for a job, see |job_start()|. *Job*
|
||||
|
||||
Channel Used for a channel, see |ch_open()|.
|
||||
Channel Used for a channel, see |ch_open()|. *Channel*
|
||||
|
||||
The Number and String types are converted automatically, depending on how they
|
||||
are used.
|
||||
@@ -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,17 +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( {handle}) none close a channel
|
||||
ch_log( {msg} [, {channel}]) none write {msg} in the channel log file
|
||||
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_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_readraw( {handle}) String read from channel {handle}
|
||||
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 channel {handle}
|
||||
any send {expr} over JSON {handle}
|
||||
ch_sendraw( {handle}, {string} [, {options}])
|
||||
any send {string} over raw channel {handle}
|
||||
ch_setoptions( {handle}, {options}) none set options for channel {handle}
|
||||
ch_status( {handle}) String status of channel {handle}
|
||||
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}
|
||||
@@ -1886,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}
|
||||
@@ -1959,11 +1976,14 @@ insert( {list}, {item} [, {idx}]) List insert {item} in {list} [before {idx}]
|
||||
invert( {expr}) Number bitwise invert
|
||||
isdirectory( {directory}) Number TRUE if {directory} is a directory
|
||||
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}) Number get the channel handle for {job}
|
||||
job_start( {command} [, {options}]) Job start a job
|
||||
job_status( {job}) String get the status of a job
|
||||
job_stop( {job} [, {how}]) Number stop a job
|
||||
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}
|
||||
job_stop( {job} [, {how}]) Number stop {job}
|
||||
join( {list} [, {sep}]) String join {list} items into one String
|
||||
js_decode( {string}) any decode JS style JSON
|
||||
js_encode( {expr}) String encode JS style JSON
|
||||
@@ -2000,6 +2020,8 @@ matchlist( {expr}, {pat}[, {start}[, {count}]])
|
||||
List match and submatches of {pat} in {expr}
|
||||
matchstr( {expr}, {pat}[, {start}[, {count}]])
|
||||
String {count}'th match of {pat} in {expr}
|
||||
matchstrpos( {expr}, {pat}[, {start}[, {count}]])
|
||||
List {count}'th match of {pat} in {expr}
|
||||
max( {list}) Number maximum value of items in {list}
|
||||
min( {list}) Number minimum value of items in {list}
|
||||
mkdir( {name} [, {path} [, {prot}]])
|
||||
@@ -2058,6 +2080,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}
|
||||
@@ -2119,9 +2142,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}
|
||||
@@ -2136,6 +2162,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}
|
||||
@@ -2287,6 +2318,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()|.
|
||||
@@ -2685,14 +2736,89 @@ confirm({msg} [, {choices} [, {default} [, {type}]]])
|
||||
the horizontal layout is always used.
|
||||
|
||||
ch_close({handle}) *ch_close()*
|
||||
Close channel {handle}. See |channel|.
|
||||
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_log({msg} [, {channel}]) *ch_log()*
|
||||
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. 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
|
||||
empty string.
|
||||
|
||||
{only available when compiled with the |+channel| feature}
|
||||
|
||||
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
|
||||
in NL mode, the caller must do that. The NL in the response
|
||||
is removed.
|
||||
See |channel-use|.
|
||||
|
||||
{only available when compiled with the |+channel| feature}
|
||||
|
||||
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.
|
||||
{only available when compiled with the |+channel| feature}
|
||||
|
||||
ch_getjob({channel}) *ch_getjob()*
|
||||
Get the Job associated with {channel}.
|
||||
If there is no job calling |job_status()| on the returned Job
|
||||
will result in "fail".
|
||||
|
||||
{only available when compiled with the |+channel| and
|
||||
|+job| features}
|
||||
|
||||
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}.
|
||||
@@ -2704,55 +2830,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 the channel handle on success. Returns a negative
|
||||
number 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 as
|
||||
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_readraw({handle}) *ch_readraw()*
|
||||
Read from channel {handle} and return the received message.
|
||||
This uses the channel timeout. When there is nothing to read
|
||||
within that time an empty string is returned.
|
||||
TODO: depends on channel mode.
|
||||
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}
|
||||
|
||||
ch_readraw({handle} [, {options}]) *ch_readraw()*
|
||||
Like ch_read() but for a JS and JSON channel does not decode
|
||||
the message. See |channel-more|.
|
||||
{only available when compiled with the |+channel| feature}
|
||||
|
||||
ch_sendexpr({handle}, {expr} [, {options}]) *ch_sendexpr()*
|
||||
Send {expr} over channel {handle}. The {expr} is encoded
|
||||
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.
|
||||
When "callback" is a Funcref or the name of a function,
|
||||
ch_sendexpr() returns immediately. The callback is invoked
|
||||
when the response is received. See |channel-callback|.
|
||||
|
||||
Without "callback" ch_sendexpr() waits for a response and
|
||||
returns the decoded expression. When there is an error or
|
||||
timeout it returns an empty string.
|
||||
|
||||
When "callback" is zero no response is expected.
|
||||
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({handle}, {string} [, {options}]) *ch_sendraw()*
|
||||
Send {string} over channel {handle}.
|
||||
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
|
||||
@@ -2763,20 +2875,25 @@ ch_sendraw({handle}, {string} [, {options}]) *ch_sendraw()*
|
||||
{only available when compiled with the |+channel| feature}
|
||||
|
||||
ch_setoptions({handle}, {options}) *ch_setoptions()*
|
||||
Set options on channel {handle}:
|
||||
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.
|
||||
|
||||
These options cannot be changed:
|
||||
"mode" cannot be changed once channel is open
|
||||
"waittime" only applies to "ch_open()|
|
||||
|
||||
ch_status({handle}) *ch_status()*
|
||||
Return the status of channel {handle}:
|
||||
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
|
||||
@@ -3473,9 +3590,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()*
|
||||
@@ -3744,6 +3920,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
|
||||
@@ -4364,17 +4542,39 @@ islocked({expr}) *islocked()* *E786*
|
||||
< When {expr} is a variable that does not exist you get an error
|
||||
message. Use |exists()| to check for existence.
|
||||
|
||||
isnan({expr}) *isnan()*
|
||||
Return non-zero if {expr} is a float with value NaN. >
|
||||
echo isnan(0.0 / 0.0)
|
||||
< 1 ~
|
||||
|
||||
{only available when compiled with the |+float| feature}
|
||||
|
||||
items({dict}) *items()*
|
||||
Return a |List| with all the key-value pairs of {dict}. Each
|
||||
|List| item is a list with two items: the key of a {dict}
|
||||
entry and the value of this entry. The |List| is in arbitrary
|
||||
order.
|
||||
|
||||
|
||||
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|
|
||||
|
||||
job_start({command} [, {options}]) *job_start()*
|
||||
Start a job and return a Job object. Unlike |system()| and
|
||||
|:!cmd| this does not wait for the job to finish.
|
||||
@@ -4415,32 +4615,43 @@ job_start({command} [, {options}]) *job_start()*
|
||||
|
||||
{only available when compiled with the |+job| feature}
|
||||
|
||||
job_status({job}) *job_status()*
|
||||
job_status({job}) *job_status()* *E916*
|
||||
Returns a String with the status of {job}:
|
||||
"run" job is running
|
||||
"fail" job failed to start
|
||||
"dead" job died or was stopped after running
|
||||
|
||||
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()*
|
||||
Stop the {job}. This can also be used to signal the job.
|
||||
|
||||
When {how} is omitted or is "term" the job will be terminated
|
||||
normally. For Unix SIGTERM is sent. For MS-Windows
|
||||
CTRL_BREAK will be sent. This goes to the process group, thus
|
||||
children may also be affected.
|
||||
When {how} is omitted or is "term" the job will be terminated.
|
||||
For Unix SIGTERM is sent. On MS-Windows the job will be
|
||||
terminated forcedly (there is no "gentle" way).
|
||||
This goes to the process group, thus children may also be
|
||||
affected.
|
||||
|
||||
Other values for Unix:
|
||||
"hup" Unix: SIGHUP
|
||||
"quit" Unix: SIGQUIT
|
||||
"kill" Unix: SIGKILL (strongest way to stop)
|
||||
number Unix: signal with that number
|
||||
Effect for Unix:
|
||||
"term" SIGTERM (default)
|
||||
"hup" SIGHUP
|
||||
"quit" SIGQUIT
|
||||
"int" SIGINT
|
||||
"kill" SIGKILL (strongest way to stop)
|
||||
number signal with that number
|
||||
|
||||
Other values for MS-Windows:
|
||||
"int" Windows: CTRL_C
|
||||
"kill" Windows: terminate process forcedly
|
||||
Others Windows: CTRL_BREAK
|
||||
Effect for MS-Windows:
|
||||
"term" terminate process forcedly (default)
|
||||
"hup" CTRL_BREAK
|
||||
"quit" CTRL_BREAK
|
||||
"int" CTRL_C
|
||||
"kill" terminate process forcedly
|
||||
Others CTRL_BREAK
|
||||
|
||||
On Unix the signal is sent to the process group. This means
|
||||
that when the job is "sh -c command" it affects both the shell
|
||||
@@ -4507,6 +4718,8 @@ json_encode({expr}) *json_encode()*
|
||||
Vim values are converted as follows:
|
||||
Number decimal number
|
||||
Float floating point number
|
||||
Float nan "NaN"
|
||||
Float inf "Infinity"
|
||||
String in double quotes (possibly null)
|
||||
Funcref not possible, error
|
||||
List as an array (possibly null); when
|
||||
@@ -4517,13 +4730,9 @@ json_encode({expr}) *json_encode()*
|
||||
v:true "true"
|
||||
v:none "null"
|
||||
v:null "null"
|
||||
Note that using v:none is permitted, although the JSON
|
||||
standard does not allow empty items. This can be useful for
|
||||
omitting items in an array:
|
||||
[0,,,,,5] ~
|
||||
This is much more efficient than:
|
||||
[0,null,null,null,null,5] ~
|
||||
But a strict JSON parser will not accept it.
|
||||
Note that NaN and Infinity are passed on as values. This is
|
||||
missing in the JSON standard, but several implementations do
|
||||
allow it. If not then you will get an error.
|
||||
|
||||
keys({dict}) *keys()*
|
||||
Return a |List| with all the keys of {dict}. The |List| is in
|
||||
@@ -4997,6 +5206,24 @@ matchstr({expr}, {pat}[, {start}[, {count}]]) *matchstr()*
|
||||
:echo matchstr("testing", "ing", 5)
|
||||
< result is "".
|
||||
When {expr} is a |List| then the matching item is returned.
|
||||
The type isn't changed, it's not necessarily a String.
|
||||
|
||||
matchstrpos({expr}, {pat}[, {start}[, {count}]]) *matchstrpos()*
|
||||
Same as |matchstr()|, but return the matched string, the start
|
||||
position and the end position of the match. Example: >
|
||||
:echo matchstrpos("testing", "ing")
|
||||
< results in ["ing", 4, 7].
|
||||
When there is no match ["", -1, -1] is returned.
|
||||
The {start}, if given, has the same meaning as for |match()|. >
|
||||
:echo matchstrpos("testing", "ing", 2)
|
||||
< results in ["ing", 4, 7]. >
|
||||
:echo matchstrpos("testing", "ing", 5)
|
||||
< result is ["", -1, -1].
|
||||
When {expr} is a |List| then the matching item, the index
|
||||
of first item where {pat} matches, the start position and the
|
||||
end position of the match are returned. >
|
||||
:echo matchstrpos([1, '__x'], '\a')
|
||||
< result is ["x", 1, 2, 3].
|
||||
The type isn't changed, it's not necessarily a String.
|
||||
|
||||
*max()*
|
||||
@@ -5897,6 +6124,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()|.
|
||||
@@ -6434,13 +6679,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()*
|
||||
@@ -6714,8 +6963,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()*
|
||||
@@ -6831,6 +7079,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
|
||||
@@ -7031,6 +7310,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
|
||||
@@ -7275,6 +7581,7 @@ gui_athena Compiled with Athena GUI.
|
||||
gui_gnome Compiled with Gnome support (gui_gtk is also defined).
|
||||
gui_gtk Compiled with GTK+ GUI (any version).
|
||||
gui_gtk2 Compiled with GTK+ 2 GUI (gui_gtk is also defined).
|
||||
gui_gtk3 Compiled with GTK+ 3 GUI (gui_gtk is also defined).
|
||||
gui_mac Compiled with Macintosh GUI.
|
||||
gui_motif Compiled with Motif GUI.
|
||||
gui_photon Compiled with Photon GUI.
|
||||
@@ -7338,7 +7645,6 @@ scrollbind Compiled with 'scrollbind' support.
|
||||
showcmd Compiled with 'showcmd' support.
|
||||
signs Compiled with |:sign| support.
|
||||
smartindent Compiled with 'smartindent' support.
|
||||
sniff Compiled with SNiFF interface support.
|
||||
spell Compiled with spell checking support |spell|.
|
||||
startuptime Compiled with |--startuptime| support.
|
||||
statusline Compiled with support for 'statusline', 'rulerformat'
|
||||
@@ -7360,12 +7666,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.
|
||||
@@ -7375,7 +7683,6 @@ vms VMS version of Vim.
|
||||
vreplace Compiled with |gR| and |gr| commands.
|
||||
wildignore Compiled with 'wildignore' option.
|
||||
wildmenu Compiled with 'wildmenu' option.
|
||||
win16 Win16 version of Vim (MS-Windows 3.1).
|
||||
win32 Win32 version of Vim (MS-Windows 95 and later, 32 or
|
||||
64 bits)
|
||||
win32unix Win32 version of Vim, using Unix files (Cygwin)
|
||||
|
||||
@@ -25,7 +25,7 @@ Other GUI documentation:
|
||||
|
||||
First you must make sure you actually have a version of Vim with the GUI code
|
||||
included. You can check this with the ":version" command, it says "with xxx
|
||||
GUI", where "xxx" is X11-Motif, X11-Athena, Photon, GTK, GTK2, etc., or
|
||||
GUI", where "xxx" is X11-Motif, X11-Athena, Photon, GTK2, GTK3, etc., or
|
||||
"MS-Windows 32 bit GUI version".
|
||||
|
||||
How to start the GUI depends on the system used. Mostly you can run the
|
||||
@@ -514,11 +514,14 @@ a menu entry. Hit <Enter> to execute it. Hit <Esc> if you want to cancel.
|
||||
This does require the |+menu| feature enabled at compile time.
|
||||
|
||||
*tear-off-menus*
|
||||
GTK+ and Motif support Tear-off menus. These are sort of sticky menus or
|
||||
GTK+ 2 and Motif support Tear-off menus. These are sort of sticky menus or
|
||||
pop-up menus that are present all the time. If the resizing does not work
|
||||
correctly, this may be caused by using something like "Vim*geometry" in the
|
||||
defaults. Use "Vim.geometry" instead.
|
||||
|
||||
As to GTK+ 3, tear-off menus have been deprecated since GTK+ 3.4.
|
||||
Accordingly, they are disabled if gvim is linked against GTK+ 3.4 or later.
|
||||
|
||||
The Win32 GUI version emulates Motif's tear-off menus. Actually, a Motif user
|
||||
will spot the differences easily, but hopefully they're just as useful. You
|
||||
can also use the |:tearoff| command together with |hidden-menus| to create
|
||||
@@ -650,8 +653,8 @@ When no or zero priority is given, 500 is used.
|
||||
The priority for the PopUp menu is not used.
|
||||
|
||||
The Help menu will be placed on the far right side of the menu bar on systems
|
||||
which support this (Motif and GTK+). For GTK+ 2, this is not done anymore
|
||||
because right-aligning the Help menu is now discouraged UI design.
|
||||
which support this (Motif and GTK+). For GTK+ 2 and 3, this is not done
|
||||
anymore because right-aligning the Help menu is now discouraged UI design.
|
||||
|
||||
You can use a priority higher than 9999, to make it go after the Help menu,
|
||||
but that is non-standard and is discouraged. The highest possible priority is
|
||||
|
||||
@@ -369,6 +369,16 @@ Write this in the file ~/.gtkrc and it will be used by GTK+. For GTK+ 2
|
||||
you might have to use the file ~/.gtkrc-2.0 instead, depending on your
|
||||
distribution.
|
||||
|
||||
For GTK+ 3, an effect similar to the above can be obtained by adding the
|
||||
following snippet of CSS code to $XDG_HOME_DIR/gtk-3.0/gtk.css (usually,
|
||||
$HOME/.config/gtk-3.0/gtk.css):
|
||||
>
|
||||
.tooltip {
|
||||
background-color: #ffffcc;
|
||||
color: #000000;
|
||||
}
|
||||
<
|
||||
|
||||
Using Vim as a GTK+ plugin *gui-gtk-socketid*
|
||||
|
||||
When the GTK+ version of Vim starts up normally, it creates its own top level
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*help.txt* For Vim version 7.4. Last change: 2016 Jan 10
|
||||
*help.txt* For Vim version 7.4. Last change: 2016 Feb 27
|
||||
|
||||
VIM - main help file
|
||||
k
|
||||
@@ -155,7 +155,6 @@ Special issues ~
|
||||
|
||||
GUI ~
|
||||
|gui.txt| Graphical User Interface (GUI)
|
||||
|gui_w16.txt| Windows 3.1 GUI
|
||||
|gui_w32.txt| Win32 GUI
|
||||
|gui_x11.txt| X11 GUI
|
||||
|
||||
@@ -165,7 +164,6 @@ Interfaces ~
|
||||
|if_mzsch.txt| MzScheme interface
|
||||
|if_perl.txt| Perl interface
|
||||
|if_pyth.txt| Python interface
|
||||
|if_sniff.txt| SNiFF+ interface
|
||||
|if_tcl.txt| Tcl interface
|
||||
|if_ole.txt| OLE automation interface for Win32
|
||||
|if_ruby.txt| Ruby interface
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,95 +1,11 @@
|
||||
*if_sniff.txt* For Vim version 7.4. Last change: 2005 Mar 29
|
||||
*if_sniff.txt* For Vim version 7.4. Last change: 2016 Feb 27
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL
|
||||
by Anton Leherbauer (toni@takefive.co.at)
|
||||
|
||||
|
||||
SNiFF+ and Vim *sniff*
|
||||
|
||||
1. Introduction |sniff-intro|
|
||||
2. Commands |sniff-commands|
|
||||
3. Compiling Vim with SNiFF+ interface |sniff-compiling|
|
||||
|
||||
{Vi does not have any of these commands} *E275* *E274* *E276* *E278* *E279*
|
||||
|
||||
The SNiFF+ interface only works, when Vim was compiled with the |+sniff|
|
||||
feature.
|
||||
|
||||
==============================================================================
|
||||
1. Introduction *sniff-intro*
|
||||
|
||||
The following features for the use with SNiFF+ are available:
|
||||
|
||||
* Vim can be used for all editing requests
|
||||
* SNiFF+ recognizes and updates all browsers when a file is saved in Vim
|
||||
* SNiFF+ commands can be issued directly from Vim
|
||||
|
||||
How to use Vim with SNiFF+
|
||||
1. Make sure SNiFF+ is running.
|
||||
2. In the Editor view of the Preferences dialog set the Field named
|
||||
'External Editor' to 'Emacs/Vim'.
|
||||
4. Start Vim
|
||||
5. Connect to SNiFF+ (:sniff connect)
|
||||
|
||||
Once a connection is established, SNiFF+ uses Vim for all requests to show or
|
||||
edit source code. On the other hand, you can send queries to SNiFF+ with the
|
||||
:sniff command.
|
||||
|
||||
==============================================================================
|
||||
2. Commands *sniff-commands*
|
||||
|
||||
*:sniff* *:sni*
|
||||
:sni[ff] request [symbol] Send request to sniff with optional symbol.
|
||||
{not in Vi}
|
||||
:sni[ff] Display all possible requests and the connection
|
||||
status
|
||||
|
||||
Most requests require a symbol (identifier) as parameter. If it is omitted,
|
||||
Vim will use the current word under the cursor.
|
||||
The available requests are listed below:
|
||||
|
||||
request mapping description
|
||||
-------------------------------------------------------------------------------
|
||||
connect sc Establish connection with SNiFF+.
|
||||
Make sure SNiFF+ is prepared for this in the
|
||||
Preferences
|
||||
disconnect sq Disconnect from SNiFF+. You can reconnect any
|
||||
time with :sniff connect (or 'sc')
|
||||
toggle st Toggle between implementation
|
||||
and definition file
|
||||
find-symbol sf Load the symbol into a Symbol Browser
|
||||
browse-class sb Loads the class into a Class Browser
|
||||
superclass ss Edit superclass of symbol
|
||||
overridden so Edit overridden method of symbol
|
||||
retrieve-file srf Retrieve symbol in current file
|
||||
retrieve-project srp Retrieve symbol in current project
|
||||
retrieve-all-projects srP Retrieve symbol in all projects
|
||||
retrieve-next sR Retrieve symbol using current Retriever
|
||||
settings
|
||||
goto-symbol sg Goto definition or implementation of symbol
|
||||
hierarchy sh Load symbol into the Hierarchy Browser
|
||||
restr-hier sH same as above but show only related classes
|
||||
xref-to sxt Start a refers-to query on symbol and
|
||||
load the results into the Cross Referencer
|
||||
xref-by sxb Start a referred-by query on symbol
|
||||
xref-has sxh Start a refers-to components query on symbol
|
||||
xref-used-by sxu Start a referred-by as component query on
|
||||
symbol
|
||||
show-docu sd Show documentation of symbol
|
||||
gen-docu sD Generate documentation of symbol
|
||||
|
||||
The mappings are defined in a file 'sniff.vim', which is part of every SNiFF+
|
||||
product ($SNIFF_DIR/config/sniff.vim). This file is sourced whenever Vim
|
||||
connects to SNiFF+.
|
||||
|
||||
==============================================================================
|
||||
3. Compiling Vim with SNiFF+ interface *sniff-compiling*
|
||||
|
||||
To compile Vim with SNiFF+ support, you need two source files of the extra
|
||||
archive: if_sniff.c and if_sniff.h.
|
||||
On Unix: Edit the Makefile and uncomment the line "--enable-sniff". Or run
|
||||
configure manually with this argument.
|
||||
On NT: Specify SNIFF=yes with your make command.
|
||||
The SNiFF+ support was removed at patch 7.4.1433. If you want to check it out
|
||||
sync to before that.
|
||||
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
||||
|
||||
@@ -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 Jan 19
|
||||
*index.txt* For Vim version 7.4. Last change: 2016 Mar 12
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -1394,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
|
||||
@@ -1498,7 +1500,6 @@ tag command action ~
|
||||
|:smile| :smi[le] make the user happy
|
||||
|:snext| :sn[ext] split window and go to next file in the
|
||||
argument list
|
||||
|:sniff| :sni[ff] send request to sniff
|
||||
|:snomagic| :sno[magic] :substitute with 'nomagic'
|
||||
|:snoremap| :snor[emap] like ":noremap" but for Select mode
|
||||
|:snoremenu| :snoreme[nu] like ":noremenu" but for Select mode
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*message.txt* For Vim version 7.4. Last change: 2013 Feb 23
|
||||
*message.txt* For Vim version 7.4. Last change: 2016 Feb 27
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -476,8 +476,6 @@ in memory, you can reduce that with these options:
|
||||
helps for a change that affects all lines.
|
||||
- 'undoreload' Set to zero to disable.
|
||||
|
||||
Also see |msdos-limitations|.
|
||||
|
||||
*E339* >
|
||||
Pattern too long
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*options.txt* For Vim version 7.4. Last change: 2016 Feb 20
|
||||
*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.
|
||||
@@ -1211,10 +1211,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
'bioskey' 'biosk' boolean (default on)
|
||||
global
|
||||
{not in Vi} {only for MS-DOS}
|
||||
When on the BIOS is called to obtain a keyboard character. This works
|
||||
better to detect CTRL-C, but only works for the console. When using a
|
||||
terminal over a serial port reset this option.
|
||||
Also see |'conskey'|.
|
||||
This was for MS-DOS and is no longer supported.
|
||||
|
||||
*'bomb'* *'nobomb'*
|
||||
'bomb' boolean (default off)
|
||||
@@ -1795,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
|
||||
@@ -1946,13 +1943,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
'conskey' 'consk' boolean (default off)
|
||||
global
|
||||
{not in Vi} {only for MS-DOS}
|
||||
When on direct console I/O is used to obtain a keyboard character.
|
||||
This should work in most cases. Also see |'bioskey'|. Together,
|
||||
three methods of console input are available:
|
||||
'conskey' 'bioskey' action ~
|
||||
on on or off direct console input
|
||||
off on BIOS
|
||||
off off STDIN
|
||||
This was for MS-DOS and is no longer supported.
|
||||
|
||||
*'copyindent'* *'ci'* *'nocopyindent'* *'noci'*
|
||||
'copyindent' 'ci' boolean (default off)
|
||||
@@ -2301,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.
|
||||
@@ -2653,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
|
||||
@@ -3030,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
|
||||
@@ -3741,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.
|
||||
@@ -4850,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|
|
||||
@@ -5115,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
|
||||
@@ -5307,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
|
||||
@@ -5337,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
|
||||
@@ -5409,6 +5412,12 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
This option was supported on RISC OS, which has been removed.
|
||||
|
||||
|
||||
*'packpath'* *'pp'*
|
||||
'packpath' 'pp' string (default: see 'runtimepath')
|
||||
{not in Vi}
|
||||
Directories used to find packages. See |packages|.
|
||||
|
||||
|
||||
*'paragraphs'* *'para'*
|
||||
'paragraphs' 'para' string (default "IPLPPPQPP TPHPLIPpLpItpplpipbp")
|
||||
global
|
||||
@@ -5570,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|
|
||||
@@ -5707,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|
|
||||
@@ -5948,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|
|
||||
@@ -6536,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
|
||||
@@ -7440,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|
|
||||
@@ -7495,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*
|
||||
@@ -7772,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_390.txt* For Vim version 7.4. Last change: 2010 May 30
|
||||
*os_390.txt* For Vim version 7.4. Last change: 2016 Feb 27
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Ralf Schandl
|
||||
@@ -108,7 +108,6 @@ Never tested:
|
||||
- Langmap (|'langmap'|)
|
||||
- Python support (|Python|)
|
||||
- Right-to-left mode (|'rightleft'|)
|
||||
- SNiFF+ interface (|sniff|)
|
||||
- TCL interface (|tcl|)
|
||||
...
|
||||
|
||||
|
||||
@@ -1,276 +1,15 @@
|
||||
*os_msdos.txt* For Vim version 7.4. Last change: 2005 Mar 29
|
||||
*os_msdos.txt* For Vim version 7.4. Last change: 2016 Feb 26
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
|
||||
|
||||
*msdos* *ms-dos* *MSDOS* *MS-DOS*
|
||||
This file contains the particularities for the MS-DOS version of Vim.
|
||||
This file used to contain the particularities for the MS-DOS version of Vim.
|
||||
MS-DOS support was removed in patch 7.4.1399. If you want to use it you will
|
||||
need to get a version older than that. Note that the MS-DOS version doesn't
|
||||
work, there is not enough memory. The DOS32 version (using DJGPP) might still
|
||||
work on older systems.
|
||||
|
||||
1. Two versions for MS-DOS |msdos-versions|
|
||||
2. Known problems |msdos-problems|
|
||||
3. Long file names |msdos-longfname|
|
||||
4. Termcap codes |msdos-termcap|
|
||||
5. Shifted arrow keys |msdos-arrows|
|
||||
6. Filename extensions |msdos-fname-extensions|
|
||||
7. Memory usage and limitations |msdos-limitations|
|
||||
8. Symbolically linked files |msdos-linked-files|
|
||||
9. Copy/paste in a dos box |msdos-copy-paste|
|
||||
|
||||
Additionally, there are a number of common Win32 and DOS items:
|
||||
File locations |dos-locations|
|
||||
Using backslashes |dos-backslash|
|
||||
Standard mappings |dos-standard-mappings|
|
||||
Screen output and colors |dos-colors|
|
||||
File formats |dos-file-formats|
|
||||
:cd command |dos-:cd|
|
||||
Interrupting |dos-CTRL-Break|
|
||||
Temp files |dos-temp-files|
|
||||
Shell option default |dos-shell|
|
||||
|
||||
For compiling Vim see src/INSTALL.pc. *msdos-compiling*
|
||||
|
||||
==============================================================================
|
||||
1. Two versions for MS-DOS *msdos-versions*
|
||||
|
||||
There are two versions of Vim that can be used with MS-DOS machines:
|
||||
|
||||
*dos16*
|
||||
Dos16 version Can be used on any MS-DOS system, only uses up to 640 Kbyte of
|
||||
memory. Also runs on OS/2, Windows 95, and NT. Excludes some
|
||||
Vim-specific features (autocommands, syntax highlighting,
|
||||
etc.). Recommended for use on pre-386 machines.
|
||||
*dos32*
|
||||
Dos32 version Requires 386 processor and a |DPMI| driver, uses all
|
||||
available memory. Supports long file names and the Windows
|
||||
clipboard, but NOT on Windows NT. Recommended for MS-DOS,
|
||||
Windows 3.1 and Windows 95.
|
||||
|
||||
There are also two versions that run under Windows:
|
||||
Win32 version Requires Windows 95 or Windows NT, uses all available
|
||||
memory, supports long file names, etc. Has some problems on
|
||||
Windows 95. Recommended for Windows NT. See |os_win32.txt|
|
||||
Win32 GUI Requirements like the Win32 version, but runs in its own
|
||||
window, instead of a console. Has scrollbars, menu, etc.
|
||||
Recommended for Windows 95 and Windows NT. See |gui-w32|.
|
||||
|
||||
It is recommended to use the Dos32 or Win32 version. Although the Dos16
|
||||
version is able to edit very big files, it quickly runs out of memory when
|
||||
making big changes. Disabling undo helps: ":set ul=-1". The screen updating
|
||||
of the Dos16 version is the fastest of the three on DOS or Windows 95; on
|
||||
Windows NT, the Win32 version is just as fast.
|
||||
|
||||
*DPMI*
|
||||
For the Dos32 version, you may need a DPMI driver when running in MS-DOS. If
|
||||
you are running Windows or installed a clever memory manager, it will probably
|
||||
work already. If you get the message "No DPMI", you need to install a DPMI
|
||||
driver. Such a driver is included with the executable in CSDPMI4B.ZIP. Run
|
||||
"cwsdpmi" just before starting Vim each time. Or you might want to include
|
||||
"cwsdpmi -p" in your autoexec.bat to make it resident. The latest version of
|
||||
"CSDPMI*.ZIP" can be obtained from: "ftp.neosoft.com:pub/users/s/sandmann".
|
||||
|
||||
*minimal-features*
|
||||
The 16 bit DOS version has been compiled with minimal features. Check the
|
||||
|+feature-list| which ones are included (marked with a "T").
|
||||
You can include more features by editing feature.h and recompiling.
|
||||
|
||||
==============================================================================
|
||||
2. Known problems *msdos-problems*
|
||||
|
||||
When using smartdrive (MS-DOS 6.x) with write-behind caching, it is possible
|
||||
that Vim will try to create a swap file on a read-only file system (e.g.
|
||||
write protected floppy). You will then be given the message >
|
||||
A serious disk error has occurred .., Retry (r)?
|
||||
There is nothing you can do but unprotect the floppy or switch off the
|
||||
computer. Even CTRL-ALT-DEL will not get you out of this. This is really a
|
||||
problem of smartdrive, not Vim. Smartdrive works fine otherwise. If this
|
||||
bothers you, don't use the write-behind caching.
|
||||
|
||||
Vim can't read swap files that have been opened already, unless the "share"
|
||||
command has been used. If you see stray warnings for existing swap files,
|
||||
include the "share" command in your config.sys or autoexec.bat (see your MSDOS
|
||||
documentation).
|
||||
|
||||
The Dos16 version can only have about 10 files open (in a window or hidden) at
|
||||
one time. With more files you will get error messages when trying to read or
|
||||
write a file, and for filter commands. Or Vim runs out of memory, and random
|
||||
problems may result.
|
||||
|
||||
The Dos32 version cannot have an unlimited number of files open at any one
|
||||
time. The limit depends on the setting of FILES in your CONFIG.SYS. This
|
||||
defaults to 15; if you need to edit a lot of files, you should increase this.
|
||||
If you do not set FILES high enough, you can get strange errors, and shell
|
||||
commands may cause a crash!
|
||||
|
||||
The Dos32 version can work with long file names. When doing file name
|
||||
completion, matches for the short file name will also be found. But this will
|
||||
result in the corresponding long file name. For example, if you have the long
|
||||
file name "this_is_a_test" with the short file name "this_i~1", the command
|
||||
":e *1" will start editing "this_is_a_test".
|
||||
|
||||
When using the Dos32 version and you run into problems with DPMI support,
|
||||
check if there is a program in your config.sys that eats resources. One
|
||||
program known to cause this problem is "netx", which says "NetWare v. 3.26
|
||||
Workstation shell". Replace it with version 3.32 to fix the problem.
|
||||
|
||||
The Dos32 version will parse its arguments to handle quotation. This is good
|
||||
to edit a file with spaces in its name, for example: >
|
||||
vim "program files\accessories\ppp.scp"
|
||||
A side effect is that single quotes are removed. Insert a backslash to avoid
|
||||
that. For example, to edit the file "fi'le.txt": >
|
||||
vim fi\'le.txt
|
||||
|
||||
==============================================================================
|
||||
3. Long file names *msdos-longfname*
|
||||
|
||||
If the Dos32 version is run on Windows 95, it can use long file names. It
|
||||
will work by default. If you want to disable this, use this setting:
|
||||
set LFN=N
|
||||
You can put this in your autoexec.bat file.
|
||||
|
||||
Note: If you have installed DJGPP on your machine, you probably have a
|
||||
"djgpp.env" file, which contains "LFN=n". You need to use "LFN=Y" to switch
|
||||
on using long file names then.
|
||||
|
||||
==============================================================================
|
||||
4. Termcap codes *msdos-termcap*
|
||||
|
||||
If you want to use another output method (e.g., when using a terminal on a COM
|
||||
port), set the terminal name to "pcansi". You can change the termcap options
|
||||
when needed (see |terminal-options|). Note that the
|
||||
normal IBM ansi.sys does not support all the codes of the builtin pcansi
|
||||
terminal. If you use ansi.sys, you will need to delete the termcap entries
|
||||
t_al and t_dl with >
|
||||
:set t_al= t_dl=
|
||||
Otherwise, the screen will not be updated correctly. It is better to use
|
||||
nansi.sys, nnansi.sys, or the like instead of ansi.sys.
|
||||
|
||||
If you want to use Vim on a terminal connected to a COM: port, reset the
|
||||
'bioskey' option. Otherwise the commands will be read from the PC keyboard.
|
||||
CTRL-C and CTRL-P may not work correctly with 'bioskey' reset.
|
||||
|
||||
==============================================================================
|
||||
5. Shifted arrow keys *msdos-arrows*
|
||||
|
||||
Use CTRL-arrow-left and CTRL-arrow-right instead of SHIFT-arrow-left and
|
||||
SHIFT-arrow-right. The arrow-up and arrow-down cannot be used with SHIFT or
|
||||
CTRL.
|
||||
|
||||
==============================================================================
|
||||
6. Filename extensions *msdos-fname-extensions*
|
||||
|
||||
MS-DOS allows for only one file name extension. Therefore, when appending an
|
||||
extension, the '.' in the original file name is replaced with a '_', the name
|
||||
is truncated to 8 characters, and the new extension (e.g., ".swp") is
|
||||
appended. Two examples: "test.c" becomes "test_c.bak", "thisisat.est"
|
||||
becomes "thisisat.bak". To reduce these problems, the default for
|
||||
'backupext' is "~" instead of ".bak". The backup file for "thisisat.est"
|
||||
then becomes "thisisat.es~". The 'shortname' option is not available,
|
||||
because it would always be set.
|
||||
|
||||
==============================================================================
|
||||
7. Memory usage and limitations *msdos-limitations*
|
||||
|
||||
A swap file is used to store most of the text. You should be able to edit
|
||||
very large files. However, memory is used for undo and other things. If you
|
||||
delete a lot of text, you can still run out of memory in the Dos16 version.
|
||||
|
||||
If Vim gives an "Out of memory" warning, you should stop editing. The result
|
||||
of further editing actions is unpredictable. Setting 'undolevels' to 0 saves
|
||||
some memory. Running the maze macros on a big maze is guaranteed to run out
|
||||
of memory, because each change is remembered for undo. In this case set
|
||||
'undolevels' to a negative number. This will switch off undo completely.
|
||||
|
||||
*msdos-clipboard-limits*
|
||||
In the Dos32 version, extended memory is used to avoid these problems.
|
||||
However, if you are using the clipboard, you can still run into memory
|
||||
limitations because the Windows clipboard can only communicate with Vim using
|
||||
Dos memory. This means that the largest amount of text that can be sent to
|
||||
or received from the Windows clipboard is limited by how much free Dos memory
|
||||
is available on your system.
|
||||
|
||||
You can usually maximize the amount of available Dos memory by adding the
|
||||
following lines to Dos's "config.sys" file: >
|
||||
|
||||
DOS=HIGH,UMB
|
||||
DEVICE=C:\WINDOWS\himem.sys
|
||||
DEVICE=C:\WINDOWS\emm386.exe RAM
|
||||
|
||||
Modifying config.sys in this way will also help to make more memory available
|
||||
for the Dos16 version, if you are using that.
|
||||
|
||||
In the Dos16 version the line length is limited to about 32000 characters.
|
||||
When reading a file the lines are automatically split. But editing a line
|
||||
in such a way that it becomes too long may give unexpected results.
|
||||
|
||||
==============================================================================
|
||||
8. Symbolically linked files *msdos-linked-files*
|
||||
|
||||
When using Vim to edit a symbolically linked file on a unix NFS file server,
|
||||
you may run into problems. When writing the file, Vim does not "write
|
||||
through" the symlink. Instead, it deletes the symbolic link and creates a new
|
||||
file in its place.
|
||||
|
||||
On Unix, Vim is prepared for links (symbolic or hard). A backup copy of the
|
||||
original file is made and then the original file is overwritten. This assures
|
||||
that all properties of the file remain the same. On non-Unix systems, the
|
||||
original file is renamed and a new file is written. Only the protection bits
|
||||
are set like the original file. However, this doesn't work properly when
|
||||
working on an NFS-mounted file system where links and other things exist. The
|
||||
only way to fix this in the current version is not making a backup file, by
|
||||
":set nobackup nowritebackup" |'writebackup'|
|
||||
|
||||
A similar problem occurs when mounting a Unix filesystem through Samba or a
|
||||
similar system. When Vim creates a new file it will get the default user ID
|
||||
for the mounted file system. This may be different from the original user ID.
|
||||
To avoid this set the 'backupcopy' option to "yes".
|
||||
|
||||
==============================================================================
|
||||
9. Copy/paste in a dos box *msdos-copy-paste*
|
||||
|
||||
*E450* *E451* *E452* *E453* *E454*
|
||||
The 32 bit version can copy/paste from/to the Windows clipboard directly. Use
|
||||
the "* register. Large amounts of text can be copied this way, but it must be
|
||||
possible to allocate memory for it, see |msdos-clipboard-limits|. When moving
|
||||
text from one Vim to another, the type of the selection
|
||||
(characterwise/linewise/blockwise) is passed on.
|
||||
|
||||
In other versions, the following can be used.
|
||||
|
||||
(posted to comp.editors by John Velman <velman@igate1.hac.com>)
|
||||
|
||||
How to copy/paste text from/to vim in a dos box:
|
||||
|
||||
1) To get VIM to run in a window, instead of full screen, press alt+enter.
|
||||
This toggles back and forth between full screen and a dos window.
|
||||
NOTE: In Windows 95 you must have the property "Fast Pasting" unchecked!
|
||||
In the properties dialog box for the MS-DOS window, go to "MS-DOS
|
||||
Prompt/Misc/Fast pasting" and make sure that it is NOT checked.
|
||||
To make this permanent, change the properties for
|
||||
"\windows\system\conagent.exe" (from Philip Nelson, unverified).
|
||||
|
||||
2) To paste something _into_ Vim, put Vim in insert mode.
|
||||
|
||||
3) Put the text you want to paste on the windows clipboard.
|
||||
|
||||
4) Click the control box in the upper left of the Vim window. (This looks
|
||||
like a big minus sign.) If you don't want to use the mouse, you can get
|
||||
this with alt+spacebar.
|
||||
5) On the resulting dropdown menu choose "Edit".
|
||||
6) On the child dropdown menu choose "Paste".
|
||||
|
||||
To copy something from the Vim window to the clipboard,
|
||||
|
||||
1) Select the control box to get the control drop down menu.
|
||||
2) Select "Edit".
|
||||
3) Select "Mark".
|
||||
4) Using either the keys or the mouse, select the part of the Vim window that
|
||||
you want to copy. To use the keys, use the arrow keys, and hold down shift
|
||||
to extend the selection.
|
||||
5) When you've completed your selection, press 'enter'. The selection
|
||||
is now in the windows clipboard. By the way, this can be any
|
||||
rectangular selection, for example columns 4-25 in rows 7-10. It can
|
||||
include anything in the VIM window: the output of a :!dir, for
|
||||
example.
|
||||
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
||||
|
||||
@@ -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 @@
|
||||
*quickref.txt* For Vim version 7.4. Last change: 2015 Nov 10
|
||||
*quickref.txt* For Vim version 7.4. Last change: 2016 Feb 24
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -810,7 +810,8 @@ Short explanation of each option: *option-list*
|
||||
'omnifunc' 'ofu' function for filetype-specific completion
|
||||
'opendevice' 'odev' allow reading/writing devices on MS-Windows
|
||||
'operatorfunc' 'opfunc' function to be called for |g@| operator
|
||||
'osfiletype' 'oft' no longer supported
|
||||
'osfiletype' 'oft' no longer supported
|
||||
'packpath' 'pp' list of directories used for packages
|
||||
'paragraphs' 'para' nroff macros that separate paragraphs
|
||||
'paste' allow pasting text
|
||||
'pastetoggle' 'pt' key code that causes 'paste' to toggle
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*repeat.txt* For Vim version 7.4. Last change: 2016 Feb 12
|
||||
*repeat.txt* For Vim version 7.4. Last change: 2016 Mar 26
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -8,12 +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. Debugging scripts |debug-scripts|
|
||||
6. 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*
|
||||
@@ -181,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
|
||||
@@ -198,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
|
||||
@@ -212,6 +225,45 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
|
||||
about each searched file.
|
||||
{not in Vi}
|
||||
|
||||
*: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.
|
||||
|
||||
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.
|
||||
The following lines will be converted from [encoding]
|
||||
@@ -388,7 +440,167 @@ Rationale:
|
||||
< Therefore the unusual leading backslash is used.
|
||||
|
||||
==============================================================================
|
||||
5. Debugging scripts *debug-scripts*
|
||||
5. Using Vim packages *packages*
|
||||
|
||||
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.
|
||||
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 `: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/foopack.zip":
|
||||
% mkdir -p ~/.vim/pack/foo
|
||||
% cd ~/.vim/pack/foo
|
||||
% unzip /tmp/foopack.zip
|
||||
|
||||
The directory name "foo" is arbitrary, you can pick anything you like.
|
||||
|
||||
You would now have these files under ~/.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, 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 "pack/foo/start/foobar/plugin/foo.vim" and adds
|
||||
"~/.vim/pack/foo/start/foobar" to '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'.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
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. 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
|
||||
@@ -500,7 +712,7 @@ Additionally, these commands can be used:
|
||||
About the additional commands in debug mode:
|
||||
- There is no command-line completion for them, you get the completion for the
|
||||
normal Ex commands only.
|
||||
- You can shorten them, up to a single character, unless more then one command
|
||||
- You can shorten them, up to a single character, unless more than one command
|
||||
starts with the same letter. "f" stands for "finish", use "fr" for "frame".
|
||||
- Hitting <CR> will repeat the previous one. When doing another command, this
|
||||
is reset (because it's not clear what you want to repeat).
|
||||
@@ -613,7 +825,7 @@ OBSCURE
|
||||
user, don't use typeahead for debug commands.
|
||||
|
||||
==============================================================================
|
||||
6. 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 18
|
||||
*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
|
||||
@@ -414,6 +415,11 @@ a slash. Thus "-R" means recovery and "-/R" readonly.
|
||||
not needed, because Vim will be able to find out what type
|
||||
of terminal you are using. (See |terminal-info|.) {not in Vi}
|
||||
|
||||
*--not-a-term*
|
||||
--not-a-term Tells Vim that the user knows that the input and/or output is
|
||||
not connected to a terminal. This will avoid the warning and
|
||||
the two second delay that would happen. {not in Vi}
|
||||
|
||||
*-d*
|
||||
-d Start in diff mode, like |vimdiff|.
|
||||
{not in Vi} {not available when compiled without the |+diff|
|
||||
@@ -827,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,
|
||||
@@ -857,6 +865,10 @@ accordingly. Vim proceeds in this order:
|
||||
commands from the command line have not been executed yet. You can
|
||||
use "--cmd 'set noloadplugins'" |--cmd|.
|
||||
|
||||
Plugin packs are loaded. These are plugins, as above, but found in
|
||||
'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
|
||||
value of the 'shell' option, unless they have been set before.
|
||||
@@ -893,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:
|
||||
@@ -1144,7 +1157,7 @@ There are several ways to exit Vim:
|
||||
- Use `:cquit`. Also when there are changes.
|
||||
|
||||
When using `:cquit` or when there was an error message Vim exits with exit
|
||||
code 1. Errors can be avoide by using `:silent!`.
|
||||
code 1. Errors can be avoided by using `:silent!`.
|
||||
|
||||
==============================================================================
|
||||
8. Saving settings *save-settings*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*syntax.txt* For Vim version 7.4. Last change: 2016 Jan 28
|
||||
*syntax.txt* For Vim version 7.4. Last change: 2016 Mar 12
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -2890,7 +2890,7 @@ You may wish to embed languages into sh. I'll give an example courtesy of
|
||||
Lorance Stinson on how to do this with awk as an example. Put the following
|
||||
file into $HOME/.vim/after/syntax/sh/awkembed.vim: >
|
||||
|
||||
" AWK Embedding: {{{1
|
||||
" AWK Embedding:
|
||||
" ==============
|
||||
" Shamelessly ripped from aspperl.vim by Aaron Hope.
|
||||
if exists("b:current_syntax")
|
||||
@@ -3361,6 +3361,13 @@ Note that schemas are not actually limited to plain scalars, but this is the
|
||||
only difference between schemas defined in YAML specification and the only
|
||||
difference defined in the syntax file.
|
||||
|
||||
|
||||
ZSH *zsh.vim* *ft-zsh-syntax*
|
||||
|
||||
The syntax script for zsh allows for syntax-based folding: >
|
||||
|
||||
:let g:zsh_fold_enable = 1
|
||||
|
||||
==============================================================================
|
||||
5. Defining a syntax *:syn-define* *E410*
|
||||
|
||||
@@ -4527,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
|
||||
|
||||
145
runtime/doc/tags
145
runtime/doc/tags
@@ -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'*
|
||||
@@ -726,6 +728,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
|
||||
'option' intro.txt /*'option'*
|
||||
'osfiletype' options.txt /*'osfiletype'*
|
||||
'pa' options.txt /*'pa'*
|
||||
'packpath' options.txt /*'packpath'*
|
||||
'para' options.txt /*'para'*
|
||||
'paragraphs' options.txt /*'paragraphs'*
|
||||
'paste' options.txt /*'paste'*
|
||||
@@ -746,6 +749,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
|
||||
'pmbcs' options.txt /*'pmbcs'*
|
||||
'pmbfn' options.txt /*'pmbfn'*
|
||||
'popt' options.txt /*'popt'*
|
||||
'pp' options.txt /*'pp'*
|
||||
'preserveindent' options.txt /*'preserveindent'*
|
||||
'previewheight' options.txt /*'previewheight'*
|
||||
'previewwindow' options.txt /*'previewwindow'*
|
||||
@@ -1270,7 +1274,6 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
|
||||
+scrollbind various.txt /*+scrollbind*
|
||||
+signs various.txt /*+signs*
|
||||
+smartindent various.txt /*+smartindent*
|
||||
+sniff various.txt /*+sniff*
|
||||
+startuptime various.txt /*+startuptime*
|
||||
+statusline various.txt /*+statusline*
|
||||
+sun_workshop various.txt /*+sun_workshop*
|
||||
@@ -1285,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*
|
||||
@@ -1321,6 +1325,7 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
|
||||
--literal starting.txt /*--literal*
|
||||
--nofork starting.txt /*--nofork*
|
||||
--noplugin starting.txt /*--noplugin*
|
||||
--not-a-term starting.txt /*--not-a-term*
|
||||
--remote remote.txt /*--remote*
|
||||
--remote-expr remote.txt /*--remote-expr*
|
||||
--remote-send remote.txt /*--remote-send*
|
||||
@@ -1632,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*
|
||||
@@ -2616,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*
|
||||
@@ -2856,8 +2866,6 @@ $VIM_POSIX vi_diff.txt /*$VIM_POSIX*
|
||||
:smile index.txt /*:smile*
|
||||
:sn windows.txt /*:sn*
|
||||
:snext windows.txt /*:snext*
|
||||
:sni if_sniff.txt /*:sni*
|
||||
:sniff if_sniff.txt /*:sniff*
|
||||
:sno change.txt /*:sno*
|
||||
:snomagic change.txt /*:snomagic*
|
||||
:snor map.txt /*:snor*
|
||||
@@ -3540,6 +3548,7 @@ CTRL-\_CTRL-N intro.txt /*CTRL-\\_CTRL-N*
|
||||
CTRL-] tagsrch.txt /*CTRL-]*
|
||||
CTRL-^ editing.txt /*CTRL-^*
|
||||
CTRL-{char} intro.txt /*CTRL-{char}*
|
||||
Channel eval.txt /*Channel*
|
||||
Chinese mbyte.txt /*Chinese*
|
||||
Cmd-event autocmd.txt /*Cmd-event*
|
||||
CmdUndefined autocmd.txt /*CmdUndefined*
|
||||
@@ -3563,7 +3572,6 @@ D change.txt /*D*
|
||||
DOS os_dos.txt /*DOS*
|
||||
DOS-format editing.txt /*DOS-format*
|
||||
DOS-format-write editing.txt /*DOS-format-write*
|
||||
DPMI os_msdos.txt /*DPMI*
|
||||
Dictionaries eval.txt /*Dictionaries*
|
||||
Dictionary eval.txt /*Dictionary*
|
||||
Dictionary-function eval.txt /*Dictionary-function*
|
||||
@@ -3756,12 +3764,7 @@ E270 if_ruby.txt /*E270*
|
||||
E271 if_ruby.txt /*E271*
|
||||
E272 if_ruby.txt /*E272*
|
||||
E273 if_ruby.txt /*E273*
|
||||
E274 if_sniff.txt /*E274*
|
||||
E275 if_sniff.txt /*E275*
|
||||
E276 if_sniff.txt /*E276*
|
||||
E277 remote.txt /*E277*
|
||||
E278 if_sniff.txt /*E278*
|
||||
E279 if_sniff.txt /*E279*
|
||||
E28 syntax.txt /*E28*
|
||||
E280 if_tcl.txt /*E280*
|
||||
E281 if_tcl.txt /*E281*
|
||||
@@ -3944,11 +3947,6 @@ E447 editing.txt /*E447*
|
||||
E448 various.txt /*E448*
|
||||
E449 eval.txt /*E449*
|
||||
E45 message.txt /*E45*
|
||||
E450 os_msdos.txt /*E450*
|
||||
E451 os_msdos.txt /*E451*
|
||||
E452 os_msdos.txt /*E452*
|
||||
E453 os_msdos.txt /*E453*
|
||||
E454 os_msdos.txt /*E454*
|
||||
E455 print.txt /*E455*
|
||||
E456 print.txt /*E456*
|
||||
E457 print.txt /*E457*
|
||||
@@ -4220,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*
|
||||
@@ -4427,7 +4424,6 @@ E893 eval.txt /*E893*
|
||||
E894 eval.txt /*E894*
|
||||
E895 if_mzsch.txt /*E895*
|
||||
E896 channel.txt /*E896*
|
||||
E897 channel.txt /*E897*
|
||||
E898 channel.txt /*E898*
|
||||
E899 channel.txt /*E899*
|
||||
E90 message.txt /*E90*
|
||||
@@ -4447,7 +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*
|
||||
@@ -4515,6 +4523,7 @@ InsertEnter autocmd.txt /*InsertEnter*
|
||||
InsertLeave autocmd.txt /*InsertLeave*
|
||||
J change.txt /*J*
|
||||
Japanese mbyte.txt /*Japanese*
|
||||
Job eval.txt /*Job*
|
||||
K various.txt /*K*
|
||||
KDE gui_x11.txt /*KDE*
|
||||
KVim gui_x11.txt /*KVim*
|
||||
@@ -4659,6 +4668,7 @@ ShellCmdPost autocmd.txt /*ShellCmdPost*
|
||||
ShellFilterPost autocmd.txt /*ShellFilterPost*
|
||||
SourceCmd autocmd.txt /*SourceCmd*
|
||||
SourcePre autocmd.txt /*SourcePre*
|
||||
Special eval.txt /*Special*
|
||||
SpellFileMissing autocmd.txt /*SpellFileMissing*
|
||||
StdinReadPost autocmd.txt /*StdinReadPost*
|
||||
StdinReadPre autocmd.txt /*StdinReadPre*
|
||||
@@ -4879,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*
|
||||
@@ -5168,9 +5179,15 @@ cc change.txt /*cc*
|
||||
ceil() eval.txt /*ceil()*
|
||||
ch.vim syntax.txt /*ch.vim*
|
||||
ch_close() eval.txt /*ch_close()*
|
||||
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()*
|
||||
ch_read() eval.txt /*ch_read()*
|
||||
ch_readraw() eval.txt /*ch_readraw()*
|
||||
ch_sendexpr() eval.txt /*ch_sendexpr()*
|
||||
ch_sendraw() eval.txt /*ch_sendraw()*
|
||||
@@ -5203,12 +5220,15 @@ changetick eval.txt /*changetick*
|
||||
changing change.txt /*changing*
|
||||
channel channel.txt /*channel*
|
||||
channel-callback channel.txt /*channel-callback*
|
||||
channel-close channel.txt /*channel-close*
|
||||
channel-commands channel.txt /*channel-commands*
|
||||
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*
|
||||
@@ -5222,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-#*
|
||||
@@ -5273,6 +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*
|
||||
cmdarg-variable eval.txt /*cmdarg-variable*
|
||||
cmdbang-variable eval.txt /*cmdbang-variable*
|
||||
cmdline-arguments vi_diff.txt /*cmdline-arguments*
|
||||
@@ -5599,8 +5621,6 @@ dos-locations os_dos.txt /*dos-locations*
|
||||
dos-shell os_dos.txt /*dos-shell*
|
||||
dos-standard-mappings os_dos.txt /*dos-standard-mappings*
|
||||
dos-temp-files os_dos.txt /*dos-temp-files*
|
||||
dos16 os_msdos.txt /*dos16*
|
||||
dos32 os_msdos.txt /*dos32*
|
||||
dosbatch.vim syntax.txt /*dosbatch.vim*
|
||||
double-click term.txt /*double-click*
|
||||
download intro.txt /*download*
|
||||
@@ -5639,6 +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_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*
|
||||
@@ -6026,6 +6051,7 @@ ft-xml-omni insert.txt /*ft-xml-omni*
|
||||
ft-xml-syntax syntax.txt /*ft-xml-syntax*
|
||||
ft-xpm-syntax syntax.txt /*ft-xpm-syntax*
|
||||
ft-yaml-syntax syntax.txt /*ft-yaml-syntax*
|
||||
ft-zsh-syntax syntax.txt /*ft-zsh-syntax*
|
||||
ft_ada.txt ft_ada.txt /*ft_ada.txt*
|
||||
ft_sql.txt ft_sql.txt /*ft_sql.txt*
|
||||
ftdetect filetype.txt /*ftdetect*
|
||||
@@ -6433,7 +6459,6 @@ gui-shell-win32 gui_w32.txt /*gui-shell-win32*
|
||||
gui-start gui.txt /*gui-start*
|
||||
gui-toolbar gui.txt /*gui-toolbar*
|
||||
gui-vert-scroll gui.txt /*gui-vert-scroll*
|
||||
gui-w16 gui_w16.txt /*gui-w16*
|
||||
gui-w32 gui_w32.txt /*gui-w32*
|
||||
gui-w32-cmdargs gui_w32.txt /*gui-w32-cmdargs*
|
||||
gui-w32-dialogs gui_w32.txt /*gui-w32-dialogs*
|
||||
@@ -6455,7 +6480,6 @@ gui-x11-printing gui_x11.txt /*gui-x11-printing*
|
||||
gui-x11-start gui_x11.txt /*gui-x11-start*
|
||||
gui-x11-various gui_x11.txt /*gui-x11-various*
|
||||
gui.txt gui.txt /*gui.txt*
|
||||
gui_w16.txt gui_w16.txt /*gui_w16.txt*
|
||||
gui_w32.txt gui_w32.txt /*gui_w32.txt*
|
||||
gui_x11.txt gui_x11.txt /*gui_x11.txt*
|
||||
guifontwide_gtk2 options.txt /*guifontwide_gtk2*
|
||||
@@ -6758,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*
|
||||
@@ -6819,6 +6848,7 @@ iquote motion.txt /*iquote*
|
||||
is motion.txt /*is*
|
||||
isdirectory() eval.txt /*isdirectory()*
|
||||
islocked() eval.txt /*islocked()*
|
||||
isnan() eval.txt /*isnan()*
|
||||
it motion.txt /*it*
|
||||
italic syntax.txt /*italic*
|
||||
items() eval.txt /*items()*
|
||||
@@ -6832,22 +6862,26 @@ java.vim syntax.txt /*java.vim*
|
||||
javascript-cinoptions indent.txt /*javascript-cinoptions*
|
||||
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-killonexit channel.txt /*job-killonexit*
|
||||
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()*
|
||||
job_stop() eval.txt /*job_stop()*
|
||||
@@ -7098,7 +7132,6 @@ message.txt message.txt /*message.txt*
|
||||
messages message.txt /*messages*
|
||||
meta intro.txt /*meta*
|
||||
min() eval.txt /*min()*
|
||||
minimal-features os_msdos.txt /*minimal-features*
|
||||
missing-options vi_diff.txt /*missing-options*
|
||||
mkdir() eval.txt /*mkdir()*
|
||||
mlang.txt mlang.txt /*mlang.txt*
|
||||
@@ -7129,18 +7162,7 @@ mouse_win-variable eval.txt /*mouse_win-variable*
|
||||
movement intro.txt /*movement*
|
||||
ms-dos os_msdos.txt /*ms-dos*
|
||||
msdos os_msdos.txt /*msdos*
|
||||
msdos-arrows os_msdos.txt /*msdos-arrows*
|
||||
msdos-clipboard-limits os_msdos.txt /*msdos-clipboard-limits*
|
||||
msdos-compiling os_msdos.txt /*msdos-compiling*
|
||||
msdos-copy-paste os_msdos.txt /*msdos-copy-paste*
|
||||
msdos-fname-extensions os_msdos.txt /*msdos-fname-extensions*
|
||||
msdos-limitations os_msdos.txt /*msdos-limitations*
|
||||
msdos-linked-files os_msdos.txt /*msdos-linked-files*
|
||||
msdos-longfname os_msdos.txt /*msdos-longfname*
|
||||
msdos-mode gui_w32.txt /*msdos-mode*
|
||||
msdos-problems os_msdos.txt /*msdos-problems*
|
||||
msdos-termcap os_msdos.txt /*msdos-termcap*
|
||||
msdos-versions os_msdos.txt /*msdos-versions*
|
||||
msql.vim syntax.txt /*msql.vim*
|
||||
mswin.vim gui_w32.txt /*mswin.vim*
|
||||
multi-byte mbyte.txt /*multi-byte*
|
||||
@@ -7509,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*
|
||||
@@ -7577,7 +7600,15 @@ os_unix.txt os_unix.txt /*os_unix.txt*
|
||||
os_vms.txt os_vms.txt /*os_vms.txt*
|
||||
os_win32.txt os_win32.txt /*os_win32.txt*
|
||||
other-features vi_diff.txt /*other-features*
|
||||
out_buf channel.txt /*out_buf*
|
||||
out_cb channel.txt /*out_cb*
|
||||
out_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*
|
||||
page_down intro.txt /*page_down*
|
||||
@@ -7980,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()*
|
||||
@@ -8024,10 +8056,6 @@ slice eval.txt /*slice*
|
||||
slow-fast-terminal term.txt /*slow-fast-terminal*
|
||||
slow-start starting.txt /*slow-start*
|
||||
slow-terminal term.txt /*slow-terminal*
|
||||
sniff if_sniff.txt /*sniff*
|
||||
sniff-commands if_sniff.txt /*sniff-commands*
|
||||
sniff-compiling if_sniff.txt /*sniff-compiling*
|
||||
sniff-intro if_sniff.txt /*sniff-intro*
|
||||
socket-interface channel.txt /*socket-interface*
|
||||
sort() eval.txt /*sort()*
|
||||
sorting change.txt /*sorting*
|
||||
@@ -8194,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()*
|
||||
@@ -8575,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*
|
||||
@@ -8746,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_!*
|
||||
@@ -8919,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*
|
||||
@@ -8995,25 +9027,13 @@ w: eval.txt /*w:*
|
||||
w:current_syntax syntax.txt /*w:current_syntax*
|
||||
w:quickfix_title quickfix.txt /*w:quickfix_title*
|
||||
w:var eval.txt /*w:var*
|
||||
waittime channel.txt /*waittime*
|
||||
warningmsg-variable eval.txt /*warningmsg-variable*
|
||||
white-space pattern.txt /*white-space*
|
||||
whitespace pattern.txt /*whitespace*
|
||||
wildcard editing.txt /*wildcard*
|
||||
wildcards editing.txt /*wildcards*
|
||||
wildmenumode() eval.txt /*wildmenumode()*
|
||||
win16-!start gui_w16.txt /*win16-!start*
|
||||
win16-clipboard gui_w16.txt /*win16-clipboard*
|
||||
win16-colors gui_w16.txt /*win16-colors*
|
||||
win16-default-editor gui_w16.txt /*win16-default-editor*
|
||||
win16-dialogs gui_w16.txt /*win16-dialogs*
|
||||
win16-drag-n-drop gui_w16.txt /*win16-drag-n-drop*
|
||||
win16-gui gui_w16.txt /*win16-gui*
|
||||
win16-maximized gui_w16.txt /*win16-maximized*
|
||||
win16-printing gui_w16.txt /*win16-printing*
|
||||
win16-shell gui_w16.txt /*win16-shell*
|
||||
win16-start gui_w16.txt /*win16-start*
|
||||
win16-truetype gui_w16.txt /*win16-truetype*
|
||||
win16-various gui_w16.txt /*win16-various*
|
||||
win32 os_win32.txt /*win32*
|
||||
win32-!start gui_w32.txt /*win32-!start*
|
||||
win32-PATH os_win32.txt /*win32-PATH*
|
||||
@@ -9028,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*
|
||||
@@ -9190,6 +9216,7 @@ zn fold.txt /*zn*
|
||||
zo fold.txt /*zo*
|
||||
zr fold.txt /*zr*
|
||||
zs scroll.txt /*zs*
|
||||
zsh.vim syntax.txt /*zsh.vim*
|
||||
zt scroll.txt /*zt*
|
||||
zuG spell.txt /*zuG*
|
||||
zuW spell.txt /*zuW*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
*todo.txt* For Vim version 7.4. Last change: 2016 Feb 20
|
||||
*todo.txt* For Vim version 7.4. Last change: 2016 Mar 26
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -34,108 +34,51 @@ not be repeated below, unless there is extra information.
|
||||
*known-bugs*
|
||||
-------------------- Known bugs and current work -----------------------
|
||||
|
||||
assert_matches('pattern', value)
|
||||
|
||||
+channel:
|
||||
- channel needs both stdout and stderr (GUI implementation, queues)
|
||||
- ch_read() for stderr
|
||||
- implement TODO items in ":help channel":
|
||||
- implement ch_setoptions(handle, {options})
|
||||
- job_setoptions(job, {options})
|
||||
- ch_close() closes stdin/stdout/stderr
|
||||
- out-cb
|
||||
- err-cb
|
||||
- exit-cb move code from mch_clear_job()
|
||||
- job argument: killonexit
|
||||
- ch_getjob(handle)
|
||||
- ch_read(handle [, timeout])
|
||||
- ch_readall(handle [, timeout])
|
||||
- job_info() should remove usable info: process ID, run/dead, etc.
|
||||
- job_maystart()
|
||||
- job_gethandle(), job_sethandle()
|
||||
- add ch_status(): Whether channel is open. Perhaps also mode, timeout.
|
||||
- When channel closes invoke "close-cb".
|
||||
- Add "call" to call a function with a list of arguments. (Damien)
|
||||
merge "expr" and "eval", send something back if there is a third arg?
|
||||
- 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.
|
||||
- Support channel without socket support. Useful for starting a job with
|
||||
pipes. Need another feature, +socket ?
|
||||
- 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 message in queue but there is no callback, drop it after a while?
|
||||
- Crash when closing channel after ch_sendexpr() with callback and outstanding
|
||||
request (Christian Robinson).
|
||||
- cleanup on exit? in mch_getout() and getout().
|
||||
- On Mac a 1 msec waittime is needed in ch_open(), why?
|
||||
- Add more log calls, basically at every branch, before every callback, etc.
|
||||
- Add timestamp to queued messages and callbacks with ID, remove after a
|
||||
minute.
|
||||
- add remark about undo sync, is there a way to force it?
|
||||
- When decoding json, don't read all the typeahead at once, use the reader
|
||||
properly.
|
||||
- When a message in the queue but there is no callback, drop it after a while?
|
||||
Add timestamp to queued messages and callbacks with ID, remove after a
|
||||
minute. Option to set the droptime.
|
||||
- Add 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"]
|
||||
- json: implement UTF-16 surrogate pair.
|
||||
- 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}.
|
||||
|
||||
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
|
||||
Partial:
|
||||
- Maybe we also need VAR_PARTIAL support in if_mzsch.
|
||||
|
||||
Patch on #608: (Ken Takata)
|
||||
https://bitbucket.org/k_takata/vim-ktakata-mq/src/479934b94fd56b064c9e4bd8737585c5df69d56a/fix-gvimext-loadlibrary.patch?fileviewer=file-view-default
|
||||
Packages:
|
||||
- make package for editexisting, others?
|
||||
|
||||
This difference is unexpected:
|
||||
echo v:true == 1
|
||||
1
|
||||
echo [v:true] == [1]
|
||||
0
|
||||
It's because tv_equal() works different.
|
||||
Make it so that the window ID can be used where currently a window nr is used
|
||||
|
||||
Compiler warnings. (John Marriott, Feb 17)
|
||||
Fix to support --nofork for Windows batch files. (Kevin Cantú, 2016 Feb 23,
|
||||
#658, #659) Also add "setlocal" at top of batch file?
|
||||
|
||||
Compiler warnings in if_ole.cpp. Patch by Ken Takata, Feb 18.
|
||||
|
||||
Add "runtime/bundles" ?
|
||||
runtime/bundles/netrw/spec.vim
|
||||
runtime/bundles/netrw/autoload/netrw.vim
|
||||
runtime/bundles/netrw/syntax/netrw.vim
|
||||
etc.
|
||||
Need an alternative for 'runtimepath' that tells where bundles are to be
|
||||
found. 'bundlepath' ?
|
||||
The plugins under 'bundlepath' would always be loaded. Also have a path for
|
||||
optional plugins? 'optbundlepath'? Or have directories "bundlesdef" and
|
||||
"bundlesopt"?
|
||||
Then use a command "loadplugin" to find a plugin in "optional".
|
||||
"bundles" is used by some plugin managers, need another name. "packages"?
|
||||
Add a "requires" / "provides" mechanism?
|
||||
if my_feature_enabled
|
||||
require +python
|
||||
endif
|
||||
require my_other_plugin
|
||||
~/vim/packages/netrw/def/netrw/plugin/netrw.vim
|
||||
~/vim/packages/netrw/opt/nwdebug/plugin/nwdebug.vim
|
||||
|
||||
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
|
||||
@@ -179,35 +122,78 @@ 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 for clearing history. (Yegappan Lakshmanan, 2016 Jan 31, second message
|
||||
has tests)
|
||||
Patch to have better check for {action} argument of setqflist().
|
||||
Nikolai Pavlov, Feb 25, #661. Can be even more strict.
|
||||
Also see patch from Hirohito Higash, Feb 25.
|
||||
Updated patch, 2016 Mar 25.
|
||||
|
||||
Patch to update the GTK icon cache when installing. (Kazunobu Kuriyama, 2016
|
||||
Feb 3)
|
||||
|
||||
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)
|
||||
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
|
||||
>
|
||||
@@ -222,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.
|
||||
|
||||
@@ -232,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?
|
||||
@@ -239,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)
|
||||
|
||||
@@ -251,12 +236,9 @@ directory exists. (Sergio Gallelli, 2013 Dec 29)
|
||||
Patch to avoid redrawing tabline when the popup menu is visible.
|
||||
(Christian Brabandt, 2016 Jan 28)
|
||||
|
||||
Win32: patch to use 64 bit stat() if possible. (Ken Takata, 2014 May 12)
|
||||
More tests May 14. Update May 29. Update Aug 10.
|
||||
Now part of large file patches. (Ken Takata, 2016 Feb 1)
|
||||
Two patches now?
|
||||
Patch to add {skip} argument to search(). (Christian Brabandt, 2016 Feb 24)
|
||||
|
||||
Patch to support 64 bit ints for Number. (Ken Takata, 2016 Jan 21)
|
||||
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
|
||||
@@ -285,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)
|
||||
@@ -308,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).
|
||||
@@ -335,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?
|
||||
|
||||
@@ -346,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
|
||||
@@ -396,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.
|
||||
@@ -415,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.
|
||||
@@ -474,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.
|
||||
|
||||
@@ -1579,8 +1564,6 @@ still delete them. Also convert all buffer file names?
|
||||
|
||||
Update src/testdir/main.aap.
|
||||
|
||||
"vim -c 'sniff connect'" hangs Vim. (Dominique Pelle, 2008 Dec 7)
|
||||
|
||||
Something wrong with session that has "cd" commands and "badd", in such a way
|
||||
that Vim doesn't find the edited file in the buffer list, causing the
|
||||
ATTENTION message? (Tony Mechelynck, 2008 Dec 1)
|
||||
@@ -1766,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)
|
||||
|
||||
@@ -2736,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
|
||||
@@ -3797,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.
|
||||
@@ -3818,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
|
||||
@@ -3842,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_29.txt* For Vim version 7.4. Last change: 2008 Jun 28
|
||||
*usr_29.txt* For Vim version 7.4. Last change: 2016 Feb 27
|
||||
|
||||
VIM USER MANUAL - by Bram Moolenaar
|
||||
|
||||
@@ -265,9 +265,6 @@ doesn't work if the tags file isn't sorted.
|
||||
The 'taglength' option can be used to tell Vim the number of significant
|
||||
characters in a tag.
|
||||
|
||||
When you use the SNiFF+ program, you can use the Vim interface to it |sniff|.
|
||||
SNiFF+ is a commercial program.
|
||||
|
||||
Cscope is a free program. It does not only find places where an identifier is
|
||||
declared, but also where it is used. See |cscope|.
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -592,6 +592,7 @@ String manipulation: *string-functions*
|
||||
match() position where a pattern matches in a string
|
||||
matchend() position where a pattern match ends in a string
|
||||
matchstr() match of a pattern in a string
|
||||
matchstrpos() match and postions of a pattern in a string
|
||||
matchlist() like matchstr() and also return submatches
|
||||
stridx() first index of a short string in a long string
|
||||
strridx() last index of a short string in a long string
|
||||
@@ -889,9 +890,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 +935,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 18
|
||||
*various.txt* For Vim version 7.4. Last change: 2016 Mar 20
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -411,7 +411,6 @@ m *+ruby/dyn* Ruby interface |ruby-dynamic| |/dyn|
|
||||
N *+scrollbind* |'scrollbind'|
|
||||
B *+signs* |:sign|
|
||||
N *+smartindent* |'smartindent'|
|
||||
m *+sniff* SniFF interface |sniff|
|
||||
N *+startuptime* |--startuptime| argument
|
||||
N *+statusline* Options 'statusline', 'rulerformat' and special
|
||||
formats of 'titlestring' and 'iconstring'
|
||||
@@ -427,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,4 +1,4 @@
|
||||
*version5.txt* For Vim version 7.4. Last change: 2016 Jan 03
|
||||
*version5.txt* For Vim version 7.4. Last change: 2016 Feb 27
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -934,7 +934,7 @@ Don't add "-L/usr/lib" to the link line, causes problems on a few systems.
|
||||
When compiling, allow a choice for minimal, normal or maximal features in an
|
||||
easy way, by changing a single line in src/feature.h.
|
||||
The DOS16 version has been compiled with minimal features to avoid running
|
||||
out of memory too quickly. |dos16|
|
||||
out of memory too quickly.
|
||||
The Win32, DJGPP, and OS/2 versions use maximal features, because they have
|
||||
enough memory.
|
||||
The Amiga version is available with normal and maximal features.
|
||||
|
||||
96
runtime/ftplugin/eiffel.vim
Normal file
96
runtime/ftplugin/eiffel.vim
Normal file
@@ -0,0 +1,96 @@
|
||||
" Vim filetype plugin
|
||||
" Language: Eiffel
|
||||
" Maintainer: Doug Kearns <dougkearns@gmail.com>
|
||||
" Last Change: 2010 Aug 29
|
||||
|
||||
if (exists("b:did_ftplugin"))
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
setlocal comments=:--
|
||||
setlocal commentstring=--\ %s
|
||||
|
||||
setlocal formatoptions-=t formatoptions+=croql
|
||||
|
||||
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
|
||||
let b:browsefilter = "Eiffel Source Files (*.e)\t*.e\n" .
|
||||
\ "Eiffel Control Files (*.ecf, *.ace, *.xace)\t*.ecf;*.ace;*.xace\n" .
|
||||
\ "All Files (*.*)\t*.*\n"
|
||||
endif
|
||||
|
||||
if exists("loaded_matchit") && !exists("b:match_words")
|
||||
let b:match_ignorecase = 0
|
||||
" Silly \%^ trick to match note at head of pair and in middle prevents
|
||||
" 'g%' wrapping from 'note' to 'end'
|
||||
let b:match_words = '\%^:' .
|
||||
\ '\<\%(^note\|indexing\|class\|^obsolete\|inherit\|insert\|^create\|convert\|feature\|^invariant\)\>:' .
|
||||
\ '^end\>,' .
|
||||
\ '\<\%(do\|deferred\|external\|once\%(\s\+"\)\@!\|check\|debug\|if\|inspect\|from\|across\)\>:' .
|
||||
\ '\%(\%(^\s\+\)\@<=\%(then\|until\|loop\)\|\%(then\|until\|loop\)\s\+[^ -]\|' .
|
||||
\ '\<\%(ensure\%(\s\+then\)\=\|rescue\|_then\|elseif\|else\|when\|\s\@<=invariant\|_until\|_loop\|variant\|_as\|alias\)\>\):' .
|
||||
\ '\s\@<=end\>'
|
||||
let b:match_skip = 's:\<eiffel\%(Comment\|String\|Operator\)\>'
|
||||
noremap [% <Nop>
|
||||
noremap ]% <Nop>
|
||||
vnoremap a% <Nop>
|
||||
endif
|
||||
|
||||
let b:undo_ftplugin = "setl fo< com< cms<" .
|
||||
\ "| unlet! b:browsefilter b:match_ignorecase b:match_words b:match_skip"
|
||||
|
||||
if !exists("g:no_plugin_maps") && !exists("g:no_eiffel_maps")
|
||||
function! s:DoMotion(pattern, count, flags) abort
|
||||
normal! m'
|
||||
for i in range(a:count)
|
||||
call search(a:pattern, a:flags)
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
let sections = '^\%(note\|indexing\|' .
|
||||
\ '\%(\%(deferred\|expanded\|external\|frozen\)\s\+\)*class\|' .
|
||||
\ 'obsolete\|inherit\|insert\|create\|convert\|feature\|' .
|
||||
\ 'invariant\|end\)\>'
|
||||
|
||||
nnoremap <silent> <buffer> ]] :<C-U>call <SID>DoMotion(sections, v:count1, 'W')<CR>
|
||||
xnoremap <silent> <buffer> ]] :<C-U>exe "normal! gv"<Bar>call <SID>DoMotion(sections, v:count1, 'W')<CR>
|
||||
nnoremap <silent> <buffer> [[ :<C-U>call <SID>DoMotion(sections, v:count1, 'Wb')<CR>
|
||||
xnoremap <silent> <buffer> [[ :<C-U>exe "normal! gv"<Bar>call <SID>DoMotion(sections, v:count1, 'Wb')<CR>
|
||||
|
||||
function! s:DoFeatureMotion(count, flags)
|
||||
let view = winsaveview()
|
||||
call cursor(1, 1)
|
||||
let [features_start, _] = searchpos('^feature\>')
|
||||
call search('^\s\+\a') " find the first feature
|
||||
let spaces = indent(line('.'))
|
||||
let [features_end, _] = searchpos('^\%(invariant\|note\|end\)\>')
|
||||
call winrestview(view)
|
||||
call s:DoMotion('\%>' . features_start . 'l\%<' . features_end . 'l^\s*\%' . (spaces + 1) . 'v\zs\a', a:count, a:flags)
|
||||
endfunction
|
||||
|
||||
nnoremap <silent> <buffer> ]m :<C-U>call <SID>DoFeatureMotion(v:count1, 'W')<CR>
|
||||
xnoremap <silent> <buffer> ]m :<C-U>exe "normal! gv"<Bar>call <SID>DoFeatureMotion(v:count1, 'W')<CR>
|
||||
nnoremap <silent> <buffer> [m :<C-U>call <SID>DoFeatureMotion(v:count1, 'Wb')<CR>
|
||||
xnoremap <silent> <buffer> [m :<C-U>exe "normal! gv"<Bar>call <SID>DoFeatureMotion(v:count1, 'Wb')<CR>
|
||||
|
||||
let comment_block_start = '^\%(\s\+--.*\n\)\@<!\s\+--'
|
||||
let comment_block_end = '^\s\+--.*\n\%(\s\+--\)\@!'
|
||||
|
||||
nnoremap <silent> <buffer> ]- :<C-U>call <SID>DoMotion(comment_block_start, 1, 'W')<CR>
|
||||
xnoremap <silent> <buffer> ]- :<C-U>exe "normal! gv"<Bar>call <SID>DoMotion(comment_block_start, 1, 'W')<CR>
|
||||
nnoremap <silent> <buffer> [- :<C-U>call <SID>DoMotion(comment_block_end, 1, 'Wb')<CR>
|
||||
xnoremap <silent> <buffer> [- :<C-U>exe "normal! gv"<Bar>call <SID>DoMotion(comment_block_end, 1, 'Wb')<CR>
|
||||
|
||||
let b:undo_ftplugin = b:undo_ftplugin .
|
||||
\ "| silent! execute 'unmap <buffer> [[' | silent! execute 'unmap <buffer> ]]'" .
|
||||
\ "| silent! execute 'unmap <buffer> [m' | silent! execute 'unmap <buffer> ]m'" .
|
||||
\ "| silent! execute 'unmap <buffer> [-' | silent! execute 'unmap <buffer> ]-'"
|
||||
endif
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: nowrap sw=2 sts=2 ts=8
|
||||
@@ -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.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
" Maintainer: Christian Brabandt <cb@256bit.org>
|
||||
" Previous Maintainer: Peter Aronoff <telemachus@arpinum.org>
|
||||
" Original Author: Nikolai Weibull <now@bitwi.se>
|
||||
" Latest Revision: 2016-01-15
|
||||
" Latest Revision: 2016-02-15
|
||||
" License: Vim (see :h license)
|
||||
" Repository: https://github.com/chrisbra/vim-sh-indent
|
||||
|
||||
@@ -12,14 +12,14 @@ if exists("b:did_indent")
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
let b:undo_indent = 'setlocal indentexpr< indentkeys< smartindent<'
|
||||
|
||||
setlocal indentexpr=GetShIndent()
|
||||
setlocal indentkeys+=0=then,0=do,0=else,0=elif,0=fi,0=esac,0=done,0=end,),0=;;,0=;&
|
||||
setlocal indentkeys+=0=fin,0=fil,0=fip,0=fir,0=fix
|
||||
setlocal indentkeys-=:,0#
|
||||
setlocal nosmartindent
|
||||
|
||||
let b:undo_indent = 'setlocal indentexpr< indentkeys< smartindent<'
|
||||
|
||||
if exists("*GetShIndent")
|
||||
finish
|
||||
endif
|
||||
@@ -67,7 +67,7 @@ function! GetShIndent()
|
||||
if !s:is_case_ended(line)
|
||||
let ind += s:indent_value('case-statements')
|
||||
endif
|
||||
elseif line =~ '^\s*\<\k\+\>\s*()\s*{' || line =~ '^\s*{'
|
||||
elseif line =~ '^\s*\<\k\+\>\s*()\s*{' || line =~ '^\s*{' || line =~ '^\s*function\s*\w\S\+\s*\%(()\)\?\s*{'
|
||||
if line !~ '}\s*\%(#.*\)\=$'
|
||||
let ind += s:indent_value('default')
|
||||
endif
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -8,23 +8,26 @@ maze Macros that solve a maze (amazing!).
|
||||
urm Macros that simulate a simple computer: "Universal Register Machine"
|
||||
|
||||
|
||||
|
||||
The other files contain some handy utilities. They also serve as examples for
|
||||
how to use Vi and Vim functionality.
|
||||
|
||||
dvorak for when you use a Dvorak keyboard
|
||||
|
||||
justify.vim user function for justifying text
|
||||
|
||||
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
|
||||
|
||||
swapmous.vim swap left and right mouse buttons
|
||||
|
||||
editexisting.vim when editing a file that is already edited with
|
||||
another Vim instance
|
||||
The following have been moved to an optional package. Add the command to your
|
||||
vimrc file to use the package:
|
||||
|
||||
This one is only for Unix. It can be found in the extra archive:
|
||||
file_select.vim macros that make a handy file selector
|
||||
packadd! dvorak " Dvorak keyboard support; adds mappings
|
||||
|
||||
packadd! editexisting " when editing a file that is already edited with
|
||||
" another Vim instance, go to that Vim instance
|
||||
|
||||
packadd! justify " justifying text.
|
||||
|
||||
packadd! matchit " makes the % command work better
|
||||
|
||||
packadd! shellmenu " menus for editing shell scripts in the GUI version
|
||||
|
||||
packadd! swapmouse " swap left and right mouse buttons
|
||||
|
||||
@@ -1,164 +0,0 @@
|
||||
When using a dvorak keyboard this file may be of help to you.
|
||||
These mappings have been made by Lawrence Kesteloot <kesteloo@cs.unc.edu>.
|
||||
What they do is that the most often used keys, like hjkl, are put in a more
|
||||
easy to use position.
|
||||
It may take some time to learn using this.
|
||||
|
||||
Put these lines in your .vimrc:
|
||||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
" Key to go into dvorak mode:
|
||||
map ,d :source ~/.dvorak
|
||||
" Key to get out of dvorak mode:
|
||||
map ,q :source ~/.qwerty
|
||||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
|
||||
write these lines into the file ~/.dvorak:
|
||||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
" Dvorak keyboard, only in insert mode and ex mode.
|
||||
" You may want to add a list of map's too.
|
||||
imap! a a
|
||||
imap! b x
|
||||
imap! c j
|
||||
imap! d e
|
||||
imap! e .
|
||||
imap! f u
|
||||
imap! g i
|
||||
imap! h d
|
||||
imap! i c
|
||||
imap! j h
|
||||
imap! k t
|
||||
imap! l n
|
||||
imap! m m
|
||||
imap! n b
|
||||
imap! o r
|
||||
imap! p l
|
||||
imap! q '
|
||||
imap! r p
|
||||
imap! s o
|
||||
imap! t y
|
||||
imap! u g
|
||||
imap! v k
|
||||
imap! w ,
|
||||
imap! x q
|
||||
imap! y f
|
||||
imap! z ;
|
||||
imap! ; s
|
||||
imap! ' -
|
||||
imap! " _
|
||||
imap! , w
|
||||
imap! . v
|
||||
imap! / z
|
||||
imap! A A
|
||||
imap! B X
|
||||
imap! C J
|
||||
imap! D E
|
||||
imap! E >
|
||||
imap! F U
|
||||
imap! G I
|
||||
imap! H D
|
||||
imap! I C
|
||||
imap! J H
|
||||
imap! K T
|
||||
imap! L N
|
||||
imap! M M
|
||||
imap! N B
|
||||
imap! O R
|
||||
imap! P L
|
||||
imap! Q "
|
||||
imap! R P
|
||||
imap! S O
|
||||
imap! T Y
|
||||
imap! U G
|
||||
imap! V K
|
||||
imap! W <
|
||||
imap! X Q
|
||||
imap! Y F
|
||||
imap! Z :
|
||||
imap! < W
|
||||
imap! > V
|
||||
imap! ? Z
|
||||
imap! : S
|
||||
imap! [ /
|
||||
imap! ] =
|
||||
imap! { ?
|
||||
imap! } +
|
||||
imap! - [
|
||||
imap! _ {
|
||||
imap! = ]
|
||||
imap! + }
|
||||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
|
||||
write these lines into the file ~/.qwerty
|
||||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
" Qwerty keyboard
|
||||
unmap! a
|
||||
unmap! b
|
||||
unmap! c
|
||||
unmap! d
|
||||
unmap! e
|
||||
unmap! f
|
||||
unmap! g
|
||||
unmap! h
|
||||
unmap! i
|
||||
unmap! j
|
||||
unmap! k
|
||||
unmap! l
|
||||
unmap! m
|
||||
unmap! n
|
||||
unmap! o
|
||||
unmap! p
|
||||
unmap! q
|
||||
unmap! r
|
||||
unmap! s
|
||||
unmap! t
|
||||
unmap! u
|
||||
unmap! v
|
||||
unmap! w
|
||||
unmap! x
|
||||
unmap! y
|
||||
unmap! z
|
||||
unmap! ;
|
||||
unmap! '
|
||||
unmap! \"
|
||||
unmap! ,
|
||||
unmap! .
|
||||
unmap! /
|
||||
unmap! A
|
||||
unmap! B
|
||||
unmap! C
|
||||
unmap! D
|
||||
unmap! E
|
||||
unmap! F
|
||||
unmap! G
|
||||
unmap! H
|
||||
unmap! I
|
||||
unmap! J
|
||||
unmap! K
|
||||
unmap! L
|
||||
unmap! M
|
||||
unmap! N
|
||||
unmap! O
|
||||
unmap! P
|
||||
unmap! Q
|
||||
unmap! R
|
||||
unmap! S
|
||||
unmap! T
|
||||
unmap! U
|
||||
unmap! V
|
||||
unmap! W
|
||||
unmap! X
|
||||
unmap! Y
|
||||
unmap! Z
|
||||
unmap! <
|
||||
unmap! >
|
||||
unmap! ?
|
||||
unmap! :
|
||||
unmap! [
|
||||
unmap! ]
|
||||
unmap! {
|
||||
unmap! }
|
||||
unmap! -
|
||||
unmap! _
|
||||
unmap! =
|
||||
unmap! +
|
||||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
@@ -1,119 +1,3 @@
|
||||
" Vim Plugin: Edit the file with an existing Vim if possible
|
||||
" Maintainer: Bram Moolenaar
|
||||
" Last Change: 2014 Dec 06
|
||||
|
||||
" This is a plugin, drop it in your (Unix) ~/.vim/plugin or (Win32)
|
||||
" $VIM/vimfiles/plugin directory. Or make a symbolic link, so that you
|
||||
" automatically use the latest version.
|
||||
|
||||
" This plugin serves two purposes:
|
||||
" 1. On startup, if we were invoked with one file name argument and the file
|
||||
" is not modified then try to find another Vim instance that is editing
|
||||
" this file. If there is one then bring it to the foreground and exit.
|
||||
" 2. When a file is edited and a swap file exists for it, try finding that
|
||||
" other Vim and bring it to the foreground. Requires Vim 7, because it
|
||||
" uses the SwapExists autocommand event.
|
||||
if v:version < 700
|
||||
finish
|
||||
endif
|
||||
|
||||
" Function that finds the Vim instance that is editing "filename" and brings
|
||||
" it to the foreground.
|
||||
func s:EditElsewhere(filename)
|
||||
let fname_esc = substitute(a:filename, "'", "''", "g")
|
||||
|
||||
let servers = serverlist()
|
||||
while servers != ''
|
||||
" Get next server name in "servername"; remove it from "servers".
|
||||
let i = match(servers, "\n")
|
||||
if i == -1
|
||||
let servername = servers
|
||||
let servers = ''
|
||||
else
|
||||
let servername = strpart(servers, 0, i)
|
||||
let servers = strpart(servers, i + 1)
|
||||
endif
|
||||
|
||||
" Skip ourselves.
|
||||
if servername ==? v:servername
|
||||
continue
|
||||
endif
|
||||
|
||||
" Check if this server is editing our file.
|
||||
if remote_expr(servername, "bufloaded('" . fname_esc . "')")
|
||||
" Yes, bring it to the foreground.
|
||||
if has("win32")
|
||||
call remote_foreground(servername)
|
||||
endif
|
||||
call remote_expr(servername, "foreground()")
|
||||
|
||||
if remote_expr(servername, "exists('*EditExisting')")
|
||||
" Make sure the file is visible in a window (not hidden).
|
||||
" If v:swapcommand exists and is set, send it to the server.
|
||||
if exists("v:swapcommand")
|
||||
let c = substitute(v:swapcommand, "'", "''", "g")
|
||||
call remote_expr(servername, "EditExisting('" . fname_esc . "', '" . c . "')")
|
||||
else
|
||||
call remote_expr(servername, "EditExisting('" . fname_esc . "', '')")
|
||||
endif
|
||||
endif
|
||||
|
||||
if !(has('vim_starting') && has('gui_running') && has('gui_win32'))
|
||||
" Tell the user what is happening. Not when the GUI is starting
|
||||
" though, it would result in a message box.
|
||||
echomsg "File is being edited by " . servername
|
||||
sleep 2
|
||||
endif
|
||||
return 'q'
|
||||
endif
|
||||
endwhile
|
||||
return ''
|
||||
endfunc
|
||||
|
||||
" When the plugin is loaded and there is one file name argument: Find another
|
||||
" Vim server that is editing this file right now.
|
||||
if argc() == 1 && !&modified
|
||||
if s:EditElsewhere(expand("%:p")) == 'q'
|
||||
quit
|
||||
endif
|
||||
endif
|
||||
|
||||
" Setup for handling the situation that an existing swap file is found.
|
||||
try
|
||||
au! SwapExists * let v:swapchoice = s:EditElsewhere(expand("<afile>:p"))
|
||||
catch
|
||||
" Without SwapExists we don't do anything for ":edit" commands
|
||||
endtry
|
||||
|
||||
" Function used on the server to make the file visible and possibly execute a
|
||||
" command.
|
||||
func! EditExisting(fname, command)
|
||||
" Get the window number of the file in the current tab page.
|
||||
let winnr = bufwinnr(a:fname)
|
||||
if winnr <= 0
|
||||
" Not found, look in other tab pages.
|
||||
let bufnr = bufnr(a:fname)
|
||||
for i in range(tabpagenr('$'))
|
||||
if index(tabpagebuflist(i + 1), bufnr) >= 0
|
||||
" Make this tab page the current one and find the window number.
|
||||
exe 'tabnext ' . (i + 1)
|
||||
let winnr = bufwinnr(a:fname)
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
if winnr > 0
|
||||
exe winnr . "wincmd w"
|
||||
elseif exists('*fnameescape')
|
||||
exe "split " . fnameescape(a:fname)
|
||||
else
|
||||
exe "split " . escape(a:fname, " \t\n*?[{`$\\%#'\"|!<")
|
||||
endif
|
||||
|
||||
if a:command != ''
|
||||
exe "normal! " . a:command
|
||||
endif
|
||||
|
||||
redraw
|
||||
endfunc
|
||||
" Load the editexisting package.
|
||||
" For those users who were loading the editexisting plugin from here.
|
||||
packadd editexisting
|
||||
|
||||
@@ -1,316 +1,3 @@
|
||||
" Function to left and right align text.
|
||||
"
|
||||
" Written by: Preben "Peppe" Guldberg <c928400@student.dtu.dk>
|
||||
" Created: 980806 14:13 (or around that time anyway)
|
||||
" Revised: 001103 00:36 (See "Revisions" below)
|
||||
|
||||
|
||||
" function Justify( [ textwidth [, maxspaces [, indent] ] ] )
|
||||
"
|
||||
" Justify() will left and right align a line by filling in an
|
||||
" appropriate amount of spaces. Extra spaces are added to existing
|
||||
" spaces starting from the right side of the line. As an example, the
|
||||
" following documentation has been justified.
|
||||
"
|
||||
" The function takes the following arguments:
|
||||
|
||||
" textwidth argument
|
||||
" ------------------
|
||||
" If not specified, the value of the 'textwidth' option is used. If
|
||||
" 'textwidth' is zero a value of 80 is used.
|
||||
"
|
||||
" Additionally the arguments 'tw' and '' are accepted. The value of
|
||||
" 'textwidth' will be used. These are handy, if you just want to specify
|
||||
" the maxspaces argument.
|
||||
|
||||
" maxspaces argument
|
||||
" ------------------
|
||||
" If specified, alignment will only be done, if the longest space run
|
||||
" after alignment is no longer than maxspaces.
|
||||
"
|
||||
" An argument of '' is accepted, should the user like to specify all
|
||||
" arguments.
|
||||
"
|
||||
" To aid user defined commands, negative values are accepted aswell.
|
||||
" Using a negative value specifies the default behaviour: any length of
|
||||
" space runs will be used to justify the text.
|
||||
|
||||
" indent argument
|
||||
" ---------------
|
||||
" This argument specifies how a line should be indented. The default is
|
||||
" to keep the current indentation.
|
||||
"
|
||||
" Negative values: Keep current amount of leading whitespace.
|
||||
" Positive values: Indent all lines with leading whitespace using this
|
||||
" amount of whitespace.
|
||||
"
|
||||
" Note that the value 0, needs to be quoted as a string. This value
|
||||
" leads to a left flushed text.
|
||||
"
|
||||
" Additionally units of 'shiftwidth'/'sw' and 'tabstop'/'ts' may be
|
||||
" added. In this case, if the value of indent is positive, the amount of
|
||||
" whitespace to be added will be multiplied by the value of the
|
||||
" 'shiftwidth' and 'tabstop' settings. If these units are used, the
|
||||
" argument must be given as a string, eg. Justify('','','2sw').
|
||||
"
|
||||
" If the values of 'sw' or 'tw' are negative, they are treated as if
|
||||
" they were 0, which means that the text is flushed left. There is no
|
||||
" check if a negative number prefix is used to change the sign of a
|
||||
" negative 'sw' or 'ts' value.
|
||||
"
|
||||
" As with the other arguments, '' may be used to get the default
|
||||
" behaviour.
|
||||
|
||||
|
||||
" Notes:
|
||||
"
|
||||
" If the line, adjusted for space runs and leading/trailing whitespace,
|
||||
" is wider than the used textwidth, the line will be left untouched (no
|
||||
" whitespace removed). This should be equivalent to the behaviour of
|
||||
" :left, :right and :center.
|
||||
"
|
||||
" If the resulting line is shorter than the used textwidth it is left
|
||||
" untouched.
|
||||
"
|
||||
" All space runs in the line are truncated before the alignment is
|
||||
" carried out.
|
||||
"
|
||||
" If you have set 'noexpandtab', :retab! is used to replace space runs
|
||||
" with whitespace using the value of 'tabstop'. This should be
|
||||
" conformant with :left, :right and :center.
|
||||
"
|
||||
" If joinspaces is set, an extra space is added after '.', '?' and '!'.
|
||||
" If 'cpooptions' include 'j', extra space is only added after '.'.
|
||||
" (This may on occasion conflict with maxspaces.)
|
||||
|
||||
|
||||
" Related mappings:
|
||||
"
|
||||
" Mappings that will align text using the current text width, using at
|
||||
" most four spaces in a space run and keeping current indentation.
|
||||
nmap _j :%call Justify('tw',4)<CR>
|
||||
vmap _j :call Justify('tw',4)<CR>
|
||||
"
|
||||
" Mappings that will remove space runs and format lines (might be useful
|
||||
" prior to aligning the text).
|
||||
nmap ,gq :%s/\s\+/ /g<CR>gq1G
|
||||
vmap ,gq :s/\s\+/ /g<CR>gvgq
|
||||
|
||||
|
||||
" User defined command:
|
||||
"
|
||||
" The following is an ex command that works as a shortcut to the Justify
|
||||
" function. Arguments to Justify() can be added after the command.
|
||||
com! -range -nargs=* Justify <line1>,<line2>call Justify(<f-args>)
|
||||
"
|
||||
" The following commands are all equivalent:
|
||||
"
|
||||
" 1. Simplest use of Justify():
|
||||
" :call Justify()
|
||||
" :Justify
|
||||
"
|
||||
" 2. The _j mapping above via the ex command:
|
||||
" :%Justify tw 4
|
||||
"
|
||||
" 3. Justify visualised text at 72nd column while indenting all
|
||||
" previously indented text two shiftwidths
|
||||
" :'<,'>call Justify(72,'','2sw')
|
||||
" :'<,'>Justify 72 -1 2sw
|
||||
"
|
||||
" This documentation has been justified using the following command:
|
||||
":se et|kz|1;/^" function Justify(/+,'z-g/^" /s/^" //|call Justify(70,3)|s/^/" /
|
||||
|
||||
" Revisions:
|
||||
" 001103: If 'joinspaces' was set, calculations could be wrong.
|
||||
" Tabs at start of line could also lead to errors.
|
||||
" Use setline() instead of "exec 's/foo/bar/' - safer.
|
||||
" Cleaned up the code a bit.
|
||||
"
|
||||
" Todo: Convert maps to the new script specific form
|
||||
|
||||
" Error function
|
||||
function! Justify_error(message)
|
||||
echohl Error
|
||||
echo "Justify([tw, [maxspaces [, indent]]]): " . a:message
|
||||
echohl None
|
||||
endfunction
|
||||
|
||||
|
||||
" Now for the real thing
|
||||
function! Justify(...) range
|
||||
|
||||
if a:0 > 3
|
||||
call Justify_error("Too many arguments (max 3)")
|
||||
return 1
|
||||
endif
|
||||
|
||||
" Set textwidth (accept 'tw' and '' as arguments)
|
||||
if a:0 >= 1
|
||||
if a:1 =~ '^\(tw\)\=$'
|
||||
let tw = &tw
|
||||
elseif a:1 =~ '^\d\+$'
|
||||
let tw = a:1
|
||||
else
|
||||
call Justify_error("tw must be a number (>0), '' or 'tw'")
|
||||
return 2
|
||||
endif
|
||||
else
|
||||
let tw = &tw
|
||||
endif
|
||||
if tw == 0
|
||||
let tw = 80
|
||||
endif
|
||||
|
||||
" Set maximum number of spaces between WORDs
|
||||
if a:0 >= 2
|
||||
if a:2 == ''
|
||||
let maxspaces = tw
|
||||
elseif a:2 =~ '^-\d\+$'
|
||||
let maxspaces = tw
|
||||
elseif a:2 =~ '^\d\+$'
|
||||
let maxspaces = a:2
|
||||
else
|
||||
call Justify_error("maxspaces must be a number or ''")
|
||||
return 3
|
||||
endif
|
||||
else
|
||||
let maxspaces = tw
|
||||
endif
|
||||
if maxspaces <= 1
|
||||
call Justify_error("maxspaces should be larger than 1")
|
||||
return 4
|
||||
endif
|
||||
|
||||
" Set the indentation style (accept sw and ts units)
|
||||
let indent_fix = ''
|
||||
if a:0 >= 3
|
||||
if (a:3 == '') || a:3 =~ '^-[1-9]\d*\(shiftwidth\|sw\|tabstop\|ts\)\=$'
|
||||
let indent = -1
|
||||
elseif a:3 =~ '^-\=0\(shiftwidth\|sw\|tabstop\|ts\)\=$'
|
||||
let indent = 0
|
||||
elseif a:3 =~ '^\d\+\(shiftwidth\|sw\|tabstop\|ts\)\=$'
|
||||
let indent = substitute(a:3, '\D', '', 'g')
|
||||
elseif a:3 =~ '^\(shiftwidth\|sw\|tabstop\|ts\)$'
|
||||
let indent = 1
|
||||
else
|
||||
call Justify_error("indent: a number with 'sw'/'ts' unit")
|
||||
return 5
|
||||
endif
|
||||
if indent >= 0
|
||||
while indent > 0
|
||||
let indent_fix = indent_fix . ' '
|
||||
let indent = indent - 1
|
||||
endwhile
|
||||
let indent_sw = 0
|
||||
if a:3 =~ '\(shiftwidth\|sw\)'
|
||||
let indent_sw = &sw
|
||||
elseif a:3 =~ '\(tabstop\|ts\)'
|
||||
let indent_sw = &ts
|
||||
endif
|
||||
let indent_fix2 = ''
|
||||
while indent_sw > 0
|
||||
let indent_fix2 = indent_fix2 . indent_fix
|
||||
let indent_sw = indent_sw - 1
|
||||
endwhile
|
||||
let indent_fix = indent_fix2
|
||||
endif
|
||||
else
|
||||
let indent = -1
|
||||
endif
|
||||
|
||||
" Avoid substitution reports
|
||||
let save_report = &report
|
||||
set report=1000000
|
||||
|
||||
" Check 'joinspaces' and 'cpo'
|
||||
if &js == 1
|
||||
if &cpo =~ 'j'
|
||||
let join_str = '\(\. \)'
|
||||
else
|
||||
let join_str = '\([.!?!] \)'
|
||||
endif
|
||||
endif
|
||||
|
||||
let cur = a:firstline
|
||||
while cur <= a:lastline
|
||||
|
||||
let str_orig = getline(cur)
|
||||
let save_et = &et
|
||||
set et
|
||||
exec cur . "retab"
|
||||
let &et = save_et
|
||||
let str = getline(cur)
|
||||
|
||||
let indent_str = indent_fix
|
||||
let indent_n = strlen(indent_str)
|
||||
" Shall we remember the current indentation
|
||||
if indent < 0
|
||||
let indent_orig = matchstr(str_orig, '^\s*')
|
||||
if strlen(indent_orig) > 0
|
||||
let indent_str = indent_orig
|
||||
let indent_n = strlen(matchstr(str, '^\s*'))
|
||||
endif
|
||||
endif
|
||||
|
||||
" Trim trailing, leading and running whitespace
|
||||
let str = substitute(str, '\s\+$', '', '')
|
||||
let str = substitute(str, '^\s\+', '', '')
|
||||
let str = substitute(str, '\s\+', ' ', 'g')
|
||||
let str_n = strdisplaywidth(str)
|
||||
|
||||
" Possible addition of space after punctuation
|
||||
if exists("join_str")
|
||||
let str = substitute(str, join_str, '\1 ', 'g')
|
||||
endif
|
||||
let join_n = strdisplaywidth(str) - str_n
|
||||
|
||||
" Can extraspaces be added?
|
||||
" Note that str_n may be less than strlen(str) [joinspaces above]
|
||||
if strdisplaywidth(str) <= tw - indent_n && str_n > 0
|
||||
" How many spaces should be added
|
||||
let s_add = tw - str_n - indent_n - join_n
|
||||
let s_nr = strlen(substitute(str, '\S', '', 'g') ) - join_n
|
||||
let s_dup = s_add / s_nr
|
||||
let s_mod = s_add % s_nr
|
||||
|
||||
" Test if the changed line fits with tw
|
||||
if 0 <= (str_n + (maxspaces - 1)*s_nr + indent_n) - tw
|
||||
|
||||
" Duplicate spaces
|
||||
while s_dup > 0
|
||||
let str = substitute(str, '\( \+\)', ' \1', 'g')
|
||||
let s_dup = s_dup - 1
|
||||
endwhile
|
||||
|
||||
" Add extra spaces from the end
|
||||
while s_mod > 0
|
||||
let str = substitute(str, '\(\(\s\+\S\+\)\{' . s_mod . '}\)$', ' \1', '')
|
||||
let s_mod = s_mod - 1
|
||||
endwhile
|
||||
|
||||
" Indent the line
|
||||
if indent_n > 0
|
||||
let str = substitute(str, '^', indent_str, '' )
|
||||
endif
|
||||
|
||||
" Replace the line
|
||||
call setline(cur, str)
|
||||
|
||||
" Convert to whitespace
|
||||
if &et == 0
|
||||
exec cur . 'retab!'
|
||||
endif
|
||||
|
||||
endif " Change of line
|
||||
endif " Possible change
|
||||
|
||||
let cur = cur + 1
|
||||
endwhile
|
||||
|
||||
norm ^
|
||||
|
||||
let &report = save_report
|
||||
|
||||
endfunction
|
||||
|
||||
" EOF vim: tw=78 ts=8 sw=4 sts=4 noet ai
|
||||
" Load the justify package.
|
||||
" For those users who were loading the justify plugin from here.
|
||||
packadd justify
|
||||
|
||||
@@ -1,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,94 +1,3 @@
|
||||
" When you're writing shell scripts and you are in doubt which test to use,
|
||||
" which shell environment variables are defined, what the syntax of the case
|
||||
" statement is, and you need to invoke 'man sh'?
|
||||
"
|
||||
" Your problems are over now!
|
||||
"
|
||||
" Attached is a Vim script file for turning gvim into a shell script editor.
|
||||
" It may also be used as an example how to use menus in Vim.
|
||||
"
|
||||
" Written by: Lennart Schultz <les@dmi.min.dk>
|
||||
|
||||
imenu Stmts.for for in
|
||||
do
|
||||
|
||||
doneki kk0elli
|
||||
imenu Stmts.case case in
|
||||
) ;;
|
||||
esacbki k0elli
|
||||
imenu Stmts.if if
|
||||
then
|
||||
|
||||
fiki kk0elli
|
||||
imenu Stmts.if-else if
|
||||
then
|
||||
|
||||
else
|
||||
|
||||
fiki kki kk0elli
|
||||
imenu Stmts.elif elif
|
||||
then
|
||||
|
||||
ki kk0elli
|
||||
imenu Stmts.while while
|
||||
do
|
||||
|
||||
doneki kk0elli
|
||||
imenu Stmts.break break
|
||||
imenu Stmts.continue continue
|
||||
imenu Stmts.function () {
|
||||
|
||||
}ki k0i
|
||||
imenu Stmts.return return
|
||||
imenu Stmts.return-true return 0
|
||||
imenu Stmts.return-false return 1
|
||||
imenu Stmts.exit exit
|
||||
imenu Stmts.shift shift
|
||||
imenu Stmts.trap trap
|
||||
imenu Test.existence [ -e ]hi
|
||||
imenu Test.existence - file [ -f ]hi
|
||||
imenu Test.existence - file (not empty) [ -s ]hi
|
||||
imenu Test.existence - directory [ -d ]hi
|
||||
imenu Test.existence - executable [ -x ]hi
|
||||
imenu Test.existence - readable [ -r ]hi
|
||||
imenu Test.existence - writable [ -w ]hi
|
||||
imenu Test.String is empty [ x = "x$" ]hhi
|
||||
imenu Test.String is not empty [ x != "x$" ]hhi
|
||||
imenu Test.Strings is equal [ "" = "" ]hhhhhhhi
|
||||
imenu Test.Strings is not equal [ "" != "" ]hhhhhhhhi
|
||||
imenu Test.Values is greater than [ -gt ]hhhhhhi
|
||||
imenu Test.Values is greater equal [ -ge ]hhhhhhi
|
||||
imenu Test.Values is equal [ -eq ]hhhhhhi
|
||||
imenu Test.Values is not equal [ -ne ]hhhhhhi
|
||||
imenu Test.Values is less than [ -lt ]hhhhhhi
|
||||
imenu Test.Values is less equal [ -le ]hhhhhhi
|
||||
imenu ParmSub.Substitute word if parm not set ${:-}hhi
|
||||
imenu ParmSub.Set parm to word if not set ${:=}hhi
|
||||
imenu ParmSub.Substitute word if parm set else nothing ${:+}hhi
|
||||
imenu ParmSub.If parm not set print word and exit ${:?}hhi
|
||||
imenu SpShVars.Number of positional parameters ${#}
|
||||
imenu SpShVars.All positional parameters (quoted spaces) ${*}
|
||||
imenu SpShVars.All positional parameters (unquoted spaces) ${@}
|
||||
imenu SpShVars.Flags set ${-}
|
||||
imenu SpShVars.Return code of last command ${?}
|
||||
imenu SpShVars.Process number of this shell ${$}
|
||||
imenu SpShVars.Process number of last background command ${!}
|
||||
imenu Environ.HOME ${HOME}
|
||||
imenu Environ.PATH ${PATH}
|
||||
imenu Environ.CDPATH ${CDPATH}
|
||||
imenu Environ.MAIL ${MAIL}
|
||||
imenu Environ.MAILCHECK ${MAILCHECK}
|
||||
imenu Environ.PS1 ${PS1}
|
||||
imenu Environ.PS2 ${PS2}
|
||||
imenu Environ.IFS ${IFS}
|
||||
imenu Environ.SHACCT ${SHACCT}
|
||||
imenu Environ.SHELL ${SHELL}
|
||||
imenu Environ.LC_CTYPE ${LC_CTYPE}
|
||||
imenu Environ.LC_MESSAGES ${LC_MESSAGES}
|
||||
imenu Builtins.cd cd
|
||||
imenu Builtins.echo echo
|
||||
imenu Builtins.eval eval
|
||||
imenu Builtins.exec exec
|
||||
imenu Builtins.export export
|
||||
imenu Builtins.getopts getopts
|
||||
imenu Builtins.hash hash
|
||||
" Load the shellmenu package.
|
||||
" For those users who were loading the shellmenu plugin from here.
|
||||
packadd shellmenu
|
||||
|
||||
@@ -1,22 +1,3 @@
|
||||
" These macros swap the left and right mouse buttons (for left handed)
|
||||
" Don't forget to do ":set mouse=a" or the mouse won't work at all
|
||||
noremap <LeftMouse> <RightMouse>
|
||||
noremap <2-LeftMouse> <2-RightMouse>
|
||||
noremap <3-LeftMouse> <3-RightMouse>
|
||||
noremap <4-LeftMouse> <4-RightMouse>
|
||||
noremap <LeftDrag> <RightDrag>
|
||||
noremap <LeftRelease> <RightRelease>
|
||||
noremap <RightMouse> <LeftMouse>
|
||||
noremap <2-RightMouse> <2-LeftMouse>
|
||||
noremap <3-RightMouse> <3-LeftMouse>
|
||||
noremap <4-RightMouse> <4-LeftMouse>
|
||||
noremap <RightDrag> <LeftDrag>
|
||||
noremap <RightRelease> <LeftRelease>
|
||||
noremap g<LeftMouse> <C-RightMouse>
|
||||
noremap g<RightMouse> <C-LeftMouse>
|
||||
noremap! <LeftMouse> <RightMouse>
|
||||
noremap! <LeftDrag> <RightDrag>
|
||||
noremap! <LeftRelease> <RightRelease>
|
||||
noremap! <RightMouse> <LeftMouse>
|
||||
noremap! <RightDrag> <LeftDrag>
|
||||
noremap! <RightRelease> <LeftRelease>
|
||||
" Load the swapmouse package.
|
||||
" For those users who were loading the swapmous plugin from here.
|
||||
packadd swapmouse
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
" These commands create the option window.
|
||||
"
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2015 Nov 10
|
||||
" Last Change: 2016 Mar 19
|
||||
|
||||
" If there already is an option window, jump to that one.
|
||||
if bufwinnr("option-window") > 0
|
||||
@@ -228,6 +228,8 @@ else
|
||||
endif
|
||||
call append("$", "runtimepath\tlist of directories used for runtime files and plugins")
|
||||
call <SID>OptionG("rtp", &rtp)
|
||||
call append("$", "packpath\tlist of directories used for plugin packages")
|
||||
call <SID>OptionG("pp", &pp)
|
||||
call append("$", "helpfile\tname of the main help file")
|
||||
call <SID>OptionG("hf", &hf)
|
||||
|
||||
@@ -1252,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
|
||||
|
||||
|
||||
|
||||
72
runtime/pack/dist/opt/dvorak/dvorak/disable.vim
vendored
Normal file
72
runtime/pack/dist/opt/dvorak/dvorak/disable.vim
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
" Back to Qwerty keyboard after using Dvorak.
|
||||
|
||||
iunmap a
|
||||
iunmap b
|
||||
iunmap c
|
||||
iunmap d
|
||||
iunmap e
|
||||
iunmap f
|
||||
iunmap g
|
||||
iunmap h
|
||||
iunmap i
|
||||
iunmap j
|
||||
iunmap k
|
||||
iunmap l
|
||||
iunmap m
|
||||
iunmap n
|
||||
iunmap o
|
||||
iunmap p
|
||||
iunmap q
|
||||
iunmap r
|
||||
iunmap s
|
||||
iunmap t
|
||||
iunmap u
|
||||
iunmap v
|
||||
iunmap w
|
||||
iunmap x
|
||||
iunmap y
|
||||
iunmap z
|
||||
iunmap ;
|
||||
iunmap '
|
||||
iunmap "
|
||||
iunmap ,
|
||||
iunmap .
|
||||
iunmap /
|
||||
iunmap A
|
||||
iunmap B
|
||||
iunmap C
|
||||
iunmap D
|
||||
iunmap E
|
||||
iunmap F
|
||||
iunmap G
|
||||
iunmap H
|
||||
iunmap I
|
||||
iunmap J
|
||||
iunmap K
|
||||
iunmap L
|
||||
iunmap M
|
||||
iunmap N
|
||||
iunmap O
|
||||
iunmap P
|
||||
iunmap Q
|
||||
iunmap R
|
||||
iunmap S
|
||||
iunmap T
|
||||
iunmap U
|
||||
iunmap V
|
||||
iunmap W
|
||||
iunmap X
|
||||
iunmap Y
|
||||
iunmap Z
|
||||
iunmap <
|
||||
iunmap >
|
||||
iunmap ?
|
||||
iunmap :
|
||||
iunmap [
|
||||
iunmap ]
|
||||
iunmap {
|
||||
iunmap }
|
||||
iunmap -
|
||||
iunmap _
|
||||
iunmap =
|
||||
iunmap +
|
||||
77
runtime/pack/dist/opt/dvorak/dvorak/enable.vim
vendored
Normal file
77
runtime/pack/dist/opt/dvorak/dvorak/enable.vim
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
" Dvorak keyboard, only in Insert mode.
|
||||
"
|
||||
" Change "inoremap" to "map!" to also use in Ex mode.
|
||||
" Also change disable.vim then: "iunmap" to "unmap!".
|
||||
"
|
||||
" You may want to add a list of map's too.
|
||||
|
||||
inoremap a a
|
||||
inoremap b x
|
||||
inoremap c j
|
||||
inoremap d e
|
||||
inoremap e .
|
||||
inoremap f u
|
||||
inoremap g i
|
||||
inoremap h d
|
||||
inoremap i c
|
||||
inoremap j h
|
||||
inoremap k t
|
||||
inoremap l n
|
||||
inoremap m m
|
||||
inoremap n b
|
||||
inoremap o r
|
||||
inoremap p l
|
||||
inoremap q '
|
||||
inoremap r p
|
||||
inoremap s o
|
||||
inoremap t y
|
||||
inoremap u g
|
||||
inoremap v k
|
||||
inoremap w ,
|
||||
inoremap x q
|
||||
inoremap y f
|
||||
inoremap z ;
|
||||
inoremap ; s
|
||||
inoremap ' -
|
||||
inoremap " _
|
||||
inoremap , w
|
||||
inoremap . v
|
||||
inoremap / z
|
||||
inoremap A A
|
||||
inoremap B X
|
||||
inoremap C J
|
||||
inoremap D E
|
||||
inoremap E >
|
||||
inoremap F U
|
||||
inoremap G I
|
||||
inoremap H D
|
||||
inoremap I C
|
||||
inoremap J H
|
||||
inoremap K T
|
||||
inoremap L N
|
||||
inoremap M M
|
||||
inoremap N B
|
||||
inoremap O R
|
||||
inoremap P L
|
||||
inoremap Q "
|
||||
inoremap R P
|
||||
inoremap S O
|
||||
inoremap T Y
|
||||
inoremap U G
|
||||
inoremap V K
|
||||
inoremap W <
|
||||
inoremap X Q
|
||||
inoremap Y F
|
||||
inoremap Z :
|
||||
inoremap < W
|
||||
inoremap > V
|
||||
inoremap ? Z
|
||||
inoremap : S
|
||||
inoremap [ /
|
||||
inoremap ] =
|
||||
inoremap { ?
|
||||
inoremap } +
|
||||
inoremap - [
|
||||
inoremap _ {
|
||||
inoremap = ]
|
||||
inoremap + }
|
||||
16
runtime/pack/dist/opt/dvorak/plugin/dvorak.vim
vendored
Normal file
16
runtime/pack/dist/opt/dvorak/plugin/dvorak.vim
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
" When using a dvorak keyboard this file may be of help to you.
|
||||
" These mappings have been made by Lawrence Kesteloot <kesteloo@cs.unc.edu>.
|
||||
" What they do is that the most often used keys, like hjkl, are put in a more
|
||||
" easy to use position.
|
||||
" It may take some time to learn using this.
|
||||
|
||||
if exists("g:loaded_dvorak_plugin")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_dvorak_plugin = 1
|
||||
|
||||
" Key to go into dvorak mode:
|
||||
map ,d :runtime dvorak/enable.vim<CR>
|
||||
|
||||
" Key to get out of dvorak mode:
|
||||
map ,q :runtime dvorak/disable.vim<CR>
|
||||
114
runtime/pack/dist/opt/editexisting/plugin/editexisting.vim
vendored
Normal file
114
runtime/pack/dist/opt/editexisting/plugin/editexisting.vim
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
" Vim Plugin: Edit the file with an existing Vim if possible
|
||||
" Maintainer: Bram Moolenaar
|
||||
" Last Change: 2016 Mar 28
|
||||
|
||||
" To use add ":packadd! editexisting" in your vimrc file.
|
||||
|
||||
" This plugin serves two purposes:
|
||||
" 1. On startup, if we were invoked with one file name argument and the file
|
||||
" is not modified then try to find another Vim instance that is editing
|
||||
" this file. If there is one then bring it to the foreground and exit.
|
||||
" 2. When a file is edited and a swap file exists for it, try finding that
|
||||
" other Vim and bring it to the foreground. Requires Vim 7, because it
|
||||
" uses the SwapExists autocommand event.
|
||||
|
||||
" Function that finds the Vim instance that is editing "filename" and brings
|
||||
" it to the foreground.
|
||||
func s:EditElsewhere(filename)
|
||||
let fname_esc = substitute(a:filename, "'", "''", "g")
|
||||
|
||||
let servers = serverlist()
|
||||
while servers != ''
|
||||
" Get next server name in "servername"; remove it from "servers".
|
||||
let i = match(servers, "\n")
|
||||
if i == -1
|
||||
let servername = servers
|
||||
let servers = ''
|
||||
else
|
||||
let servername = strpart(servers, 0, i)
|
||||
let servers = strpart(servers, i + 1)
|
||||
endif
|
||||
|
||||
" Skip ourselves.
|
||||
if servername ==? v:servername
|
||||
continue
|
||||
endif
|
||||
|
||||
" Check if this server is editing our file.
|
||||
if remote_expr(servername, "bufloaded('" . fname_esc . "')")
|
||||
" Yes, bring it to the foreground.
|
||||
if has("win32")
|
||||
call remote_foreground(servername)
|
||||
endif
|
||||
call remote_expr(servername, "foreground()")
|
||||
|
||||
if remote_expr(servername, "exists('*EditExisting')")
|
||||
" Make sure the file is visible in a window (not hidden).
|
||||
" If v:swapcommand exists and is set, send it to the server.
|
||||
if exists("v:swapcommand")
|
||||
let c = substitute(v:swapcommand, "'", "''", "g")
|
||||
call remote_expr(servername, "EditExisting('" . fname_esc . "', '" . c . "')")
|
||||
else
|
||||
call remote_expr(servername, "EditExisting('" . fname_esc . "', '')")
|
||||
endif
|
||||
endif
|
||||
|
||||
if !(has('vim_starting') && has('gui_running') && has('gui_win32'))
|
||||
" Tell the user what is happening. Not when the GUI is starting
|
||||
" though, it would result in a message box.
|
||||
echomsg "File is being edited by " . servername
|
||||
sleep 2
|
||||
endif
|
||||
return 'q'
|
||||
endif
|
||||
endwhile
|
||||
return ''
|
||||
endfunc
|
||||
|
||||
" When the plugin is loaded and there is one file name argument: Find another
|
||||
" Vim server that is editing this file right now.
|
||||
if argc() == 1 && !&modified
|
||||
if s:EditElsewhere(expand("%:p")) == 'q'
|
||||
quit
|
||||
endif
|
||||
endif
|
||||
|
||||
" Setup for handling the situation that an existing swap file is found.
|
||||
try
|
||||
au! SwapExists * let v:swapchoice = s:EditElsewhere(expand("<afile>:p"))
|
||||
catch
|
||||
" Without SwapExists we don't do anything for ":edit" commands
|
||||
endtry
|
||||
|
||||
" Function used on the server to make the file visible and possibly execute a
|
||||
" command.
|
||||
func! EditExisting(fname, command)
|
||||
" Get the window number of the file in the current tab page.
|
||||
let winnr = bufwinnr(a:fname)
|
||||
if winnr <= 0
|
||||
" Not found, look in other tab pages.
|
||||
let bufnr = bufnr(a:fname)
|
||||
for i in range(tabpagenr('$'))
|
||||
if index(tabpagebuflist(i + 1), bufnr) >= 0
|
||||
" Make this tab page the current one and find the window number.
|
||||
exe 'tabnext ' . (i + 1)
|
||||
let winnr = bufwinnr(a:fname)
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
if winnr > 0
|
||||
exe winnr . "wincmd w"
|
||||
elseif exists('*fnameescape')
|
||||
exe "split " . fnameescape(a:fname)
|
||||
else
|
||||
exe "split " . escape(a:fname, " \t\n*?[{`$\\%#'\"|!<")
|
||||
endif
|
||||
|
||||
if a:command != ''
|
||||
exe "normal! " . a:command
|
||||
endif
|
||||
|
||||
redraw
|
||||
endfunc
|
||||
316
runtime/pack/dist/opt/justify/plugin/justify.vim
vendored
Normal file
316
runtime/pack/dist/opt/justify/plugin/justify.vim
vendored
Normal file
@@ -0,0 +1,316 @@
|
||||
" Function to left and right align text.
|
||||
"
|
||||
" Written by: Preben "Peppe" Guldberg <c928400@student.dtu.dk>
|
||||
" Created: 980806 14:13 (or around that time anyway)
|
||||
" Revised: 001103 00:36 (See "Revisions" below)
|
||||
|
||||
|
||||
" function Justify( [ textwidth [, maxspaces [, indent] ] ] )
|
||||
"
|
||||
" Justify() will left and right align a line by filling in an
|
||||
" appropriate amount of spaces. Extra spaces are added to existing
|
||||
" spaces starting from the right side of the line. As an example, the
|
||||
" following documentation has been justified.
|
||||
"
|
||||
" The function takes the following arguments:
|
||||
|
||||
" textwidth argument
|
||||
" ------------------
|
||||
" If not specified, the value of the 'textwidth' option is used. If
|
||||
" 'textwidth' is zero a value of 80 is used.
|
||||
"
|
||||
" Additionally the arguments 'tw' and '' are accepted. The value of
|
||||
" 'textwidth' will be used. These are handy, if you just want to specify
|
||||
" the maxspaces argument.
|
||||
|
||||
" maxspaces argument
|
||||
" ------------------
|
||||
" If specified, alignment will only be done, if the longest space run
|
||||
" after alignment is no longer than maxspaces.
|
||||
"
|
||||
" An argument of '' is accepted, should the user like to specify all
|
||||
" arguments.
|
||||
"
|
||||
" To aid user defined commands, negative values are accepted aswell.
|
||||
" Using a negative value specifies the default behaviour: any length of
|
||||
" space runs will be used to justify the text.
|
||||
|
||||
" indent argument
|
||||
" ---------------
|
||||
" This argument specifies how a line should be indented. The default is
|
||||
" to keep the current indentation.
|
||||
"
|
||||
" Negative values: Keep current amount of leading whitespace.
|
||||
" Positive values: Indent all lines with leading whitespace using this
|
||||
" amount of whitespace.
|
||||
"
|
||||
" Note that the value 0, needs to be quoted as a string. This value
|
||||
" leads to a left flushed text.
|
||||
"
|
||||
" Additionally units of 'shiftwidth'/'sw' and 'tabstop'/'ts' may be
|
||||
" added. In this case, if the value of indent is positive, the amount of
|
||||
" whitespace to be added will be multiplied by the value of the
|
||||
" 'shiftwidth' and 'tabstop' settings. If these units are used, the
|
||||
" argument must be given as a string, eg. Justify('','','2sw').
|
||||
"
|
||||
" If the values of 'sw' or 'tw' are negative, they are treated as if
|
||||
" they were 0, which means that the text is flushed left. There is no
|
||||
" check if a negative number prefix is used to change the sign of a
|
||||
" negative 'sw' or 'ts' value.
|
||||
"
|
||||
" As with the other arguments, '' may be used to get the default
|
||||
" behaviour.
|
||||
|
||||
|
||||
" Notes:
|
||||
"
|
||||
" If the line, adjusted for space runs and leading/trailing whitespace,
|
||||
" is wider than the used textwidth, the line will be left untouched (no
|
||||
" whitespace removed). This should be equivalent to the behaviour of
|
||||
" :left, :right and :center.
|
||||
"
|
||||
" If the resulting line is shorter than the used textwidth it is left
|
||||
" untouched.
|
||||
"
|
||||
" All space runs in the line are truncated before the alignment is
|
||||
" carried out.
|
||||
"
|
||||
" If you have set 'noexpandtab', :retab! is used to replace space runs
|
||||
" with whitespace using the value of 'tabstop'. This should be
|
||||
" conformant with :left, :right and :center.
|
||||
"
|
||||
" If joinspaces is set, an extra space is added after '.', '?' and '!'.
|
||||
" If 'cpooptions' include 'j', extra space is only added after '.'.
|
||||
" (This may on occasion conflict with maxspaces.)
|
||||
|
||||
|
||||
" Related mappings:
|
||||
"
|
||||
" Mappings that will align text using the current text width, using at
|
||||
" most four spaces in a space run and keeping current indentation.
|
||||
nmap _j :%call Justify('tw',4)<CR>
|
||||
vmap _j :call Justify('tw',4)<CR>
|
||||
"
|
||||
" Mappings that will remove space runs and format lines (might be useful
|
||||
" prior to aligning the text).
|
||||
nmap ,gq :%s/\s\+/ /g<CR>gq1G
|
||||
vmap ,gq :s/\s\+/ /g<CR>gvgq
|
||||
|
||||
|
||||
" User defined command:
|
||||
"
|
||||
" The following is an ex command that works as a shortcut to the Justify
|
||||
" function. Arguments to Justify() can be added after the command.
|
||||
com! -range -nargs=* Justify <line1>,<line2>call Justify(<f-args>)
|
||||
"
|
||||
" The following commands are all equivalent:
|
||||
"
|
||||
" 1. Simplest use of Justify():
|
||||
" :call Justify()
|
||||
" :Justify
|
||||
"
|
||||
" 2. The _j mapping above via the ex command:
|
||||
" :%Justify tw 4
|
||||
"
|
||||
" 3. Justify visualised text at 72nd column while indenting all
|
||||
" previously indented text two shiftwidths
|
||||
" :'<,'>call Justify(72,'','2sw')
|
||||
" :'<,'>Justify 72 -1 2sw
|
||||
"
|
||||
" This documentation has been justified using the following command:
|
||||
":se et|kz|1;/^" function Justify(/+,'z-g/^" /s/^" //|call Justify(70,3)|s/^/" /
|
||||
|
||||
" Revisions:
|
||||
" 001103: If 'joinspaces' was set, calculations could be wrong.
|
||||
" Tabs at start of line could also lead to errors.
|
||||
" Use setline() instead of "exec 's/foo/bar/' - safer.
|
||||
" Cleaned up the code a bit.
|
||||
"
|
||||
" Todo: Convert maps to the new script specific form
|
||||
|
||||
" Error function
|
||||
function! Justify_error(message)
|
||||
echohl Error
|
||||
echo "Justify([tw, [maxspaces [, indent]]]): " . a:message
|
||||
echohl None
|
||||
endfunction
|
||||
|
||||
|
||||
" Now for the real thing
|
||||
function! Justify(...) range
|
||||
|
||||
if a:0 > 3
|
||||
call Justify_error("Too many arguments (max 3)")
|
||||
return 1
|
||||
endif
|
||||
|
||||
" Set textwidth (accept 'tw' and '' as arguments)
|
||||
if a:0 >= 1
|
||||
if a:1 =~ '^\(tw\)\=$'
|
||||
let tw = &tw
|
||||
elseif a:1 =~ '^\d\+$'
|
||||
let tw = a:1
|
||||
else
|
||||
call Justify_error("tw must be a number (>0), '' or 'tw'")
|
||||
return 2
|
||||
endif
|
||||
else
|
||||
let tw = &tw
|
||||
endif
|
||||
if tw == 0
|
||||
let tw = 80
|
||||
endif
|
||||
|
||||
" Set maximum number of spaces between WORDs
|
||||
if a:0 >= 2
|
||||
if a:2 == ''
|
||||
let maxspaces = tw
|
||||
elseif a:2 =~ '^-\d\+$'
|
||||
let maxspaces = tw
|
||||
elseif a:2 =~ '^\d\+$'
|
||||
let maxspaces = a:2
|
||||
else
|
||||
call Justify_error("maxspaces must be a number or ''")
|
||||
return 3
|
||||
endif
|
||||
else
|
||||
let maxspaces = tw
|
||||
endif
|
||||
if maxspaces <= 1
|
||||
call Justify_error("maxspaces should be larger than 1")
|
||||
return 4
|
||||
endif
|
||||
|
||||
" Set the indentation style (accept sw and ts units)
|
||||
let indent_fix = ''
|
||||
if a:0 >= 3
|
||||
if (a:3 == '') || a:3 =~ '^-[1-9]\d*\(shiftwidth\|sw\|tabstop\|ts\)\=$'
|
||||
let indent = -1
|
||||
elseif a:3 =~ '^-\=0\(shiftwidth\|sw\|tabstop\|ts\)\=$'
|
||||
let indent = 0
|
||||
elseif a:3 =~ '^\d\+\(shiftwidth\|sw\|tabstop\|ts\)\=$'
|
||||
let indent = substitute(a:3, '\D', '', 'g')
|
||||
elseif a:3 =~ '^\(shiftwidth\|sw\|tabstop\|ts\)$'
|
||||
let indent = 1
|
||||
else
|
||||
call Justify_error("indent: a number with 'sw'/'ts' unit")
|
||||
return 5
|
||||
endif
|
||||
if indent >= 0
|
||||
while indent > 0
|
||||
let indent_fix = indent_fix . ' '
|
||||
let indent = indent - 1
|
||||
endwhile
|
||||
let indent_sw = 0
|
||||
if a:3 =~ '\(shiftwidth\|sw\)'
|
||||
let indent_sw = &sw
|
||||
elseif a:3 =~ '\(tabstop\|ts\)'
|
||||
let indent_sw = &ts
|
||||
endif
|
||||
let indent_fix2 = ''
|
||||
while indent_sw > 0
|
||||
let indent_fix2 = indent_fix2 . indent_fix
|
||||
let indent_sw = indent_sw - 1
|
||||
endwhile
|
||||
let indent_fix = indent_fix2
|
||||
endif
|
||||
else
|
||||
let indent = -1
|
||||
endif
|
||||
|
||||
" Avoid substitution reports
|
||||
let save_report = &report
|
||||
set report=1000000
|
||||
|
||||
" Check 'joinspaces' and 'cpo'
|
||||
if &js == 1
|
||||
if &cpo =~ 'j'
|
||||
let join_str = '\(\. \)'
|
||||
else
|
||||
let join_str = '\([.!?!] \)'
|
||||
endif
|
||||
endif
|
||||
|
||||
let cur = a:firstline
|
||||
while cur <= a:lastline
|
||||
|
||||
let str_orig = getline(cur)
|
||||
let save_et = &et
|
||||
set et
|
||||
exec cur . "retab"
|
||||
let &et = save_et
|
||||
let str = getline(cur)
|
||||
|
||||
let indent_str = indent_fix
|
||||
let indent_n = strlen(indent_str)
|
||||
" Shall we remember the current indentation
|
||||
if indent < 0
|
||||
let indent_orig = matchstr(str_orig, '^\s*')
|
||||
if strlen(indent_orig) > 0
|
||||
let indent_str = indent_orig
|
||||
let indent_n = strlen(matchstr(str, '^\s*'))
|
||||
endif
|
||||
endif
|
||||
|
||||
" Trim trailing, leading and running whitespace
|
||||
let str = substitute(str, '\s\+$', '', '')
|
||||
let str = substitute(str, '^\s\+', '', '')
|
||||
let str = substitute(str, '\s\+', ' ', 'g')
|
||||
let str_n = strdisplaywidth(str)
|
||||
|
||||
" Possible addition of space after punctuation
|
||||
if exists("join_str")
|
||||
let str = substitute(str, join_str, '\1 ', 'g')
|
||||
endif
|
||||
let join_n = strdisplaywidth(str) - str_n
|
||||
|
||||
" Can extraspaces be added?
|
||||
" Note that str_n may be less than strlen(str) [joinspaces above]
|
||||
if strdisplaywidth(str) <= tw - indent_n && str_n > 0
|
||||
" How many spaces should be added
|
||||
let s_add = tw - str_n - indent_n - join_n
|
||||
let s_nr = strlen(substitute(str, '\S', '', 'g') ) - join_n
|
||||
let s_dup = s_add / s_nr
|
||||
let s_mod = s_add % s_nr
|
||||
|
||||
" Test if the changed line fits with tw
|
||||
if 0 <= (str_n + (maxspaces - 1)*s_nr + indent_n) - tw
|
||||
|
||||
" Duplicate spaces
|
||||
while s_dup > 0
|
||||
let str = substitute(str, '\( \+\)', ' \1', 'g')
|
||||
let s_dup = s_dup - 1
|
||||
endwhile
|
||||
|
||||
" Add extra spaces from the end
|
||||
while s_mod > 0
|
||||
let str = substitute(str, '\(\(\s\+\S\+\)\{' . s_mod . '}\)$', ' \1', '')
|
||||
let s_mod = s_mod - 1
|
||||
endwhile
|
||||
|
||||
" Indent the line
|
||||
if indent_n > 0
|
||||
let str = substitute(str, '^', indent_str, '' )
|
||||
endif
|
||||
|
||||
" Replace the line
|
||||
call setline(cur, str)
|
||||
|
||||
" Convert to whitespace
|
||||
if &et == 0
|
||||
exec cur . 'retab!'
|
||||
endif
|
||||
|
||||
endif " Change of line
|
||||
endif " Possible change
|
||||
|
||||
let cur = cur + 1
|
||||
endwhile
|
||||
|
||||
norm ^
|
||||
|
||||
let &report = save_report
|
||||
|
||||
endfunction
|
||||
|
||||
" EOF vim: tw=78 ts=8 sw=4 sts=4 noet ai
|
||||
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:
|
||||
94
runtime/pack/dist/opt/shellmenu/plugin/shellmenu.vim
vendored
Normal file
94
runtime/pack/dist/opt/shellmenu/plugin/shellmenu.vim
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
" When you're writing shell scripts and you are in doubt which test to use,
|
||||
" which shell environment variables are defined, what the syntax of the case
|
||||
" statement is, and you need to invoke 'man sh'?
|
||||
"
|
||||
" Your problems are over now!
|
||||
"
|
||||
" Attached is a Vim script file for turning gvim into a shell script editor.
|
||||
" It may also be used as an example how to use menus in Vim.
|
||||
"
|
||||
" Written by: Lennart Schultz <les@dmi.min.dk>
|
||||
|
||||
imenu Stmts.for for in
|
||||
do
|
||||
|
||||
doneki kk0elli
|
||||
imenu Stmts.case case in
|
||||
) ;;
|
||||
esacbki k0elli
|
||||
imenu Stmts.if if
|
||||
then
|
||||
|
||||
fiki kk0elli
|
||||
imenu Stmts.if-else if
|
||||
then
|
||||
|
||||
else
|
||||
|
||||
fiki kki kk0elli
|
||||
imenu Stmts.elif elif
|
||||
then
|
||||
|
||||
ki kk0elli
|
||||
imenu Stmts.while while
|
||||
do
|
||||
|
||||
doneki kk0elli
|
||||
imenu Stmts.break break
|
||||
imenu Stmts.continue continue
|
||||
imenu Stmts.function () {
|
||||
|
||||
}ki k0i
|
||||
imenu Stmts.return return
|
||||
imenu Stmts.return-true return 0
|
||||
imenu Stmts.return-false return 1
|
||||
imenu Stmts.exit exit
|
||||
imenu Stmts.shift shift
|
||||
imenu Stmts.trap trap
|
||||
imenu Test.existence [ -e ]hi
|
||||
imenu Test.existence - file [ -f ]hi
|
||||
imenu Test.existence - file (not empty) [ -s ]hi
|
||||
imenu Test.existence - directory [ -d ]hi
|
||||
imenu Test.existence - executable [ -x ]hi
|
||||
imenu Test.existence - readable [ -r ]hi
|
||||
imenu Test.existence - writable [ -w ]hi
|
||||
imenu Test.String is empty [ x = "x$" ]hhi
|
||||
imenu Test.String is not empty [ x != "x$" ]hhi
|
||||
imenu Test.Strings is equal [ "" = "" ]hhhhhhhi
|
||||
imenu Test.Strings is not equal [ "" != "" ]hhhhhhhhi
|
||||
imenu Test.Values is greater than [ -gt ]hhhhhhi
|
||||
imenu Test.Values is greater equal [ -ge ]hhhhhhi
|
||||
imenu Test.Values is equal [ -eq ]hhhhhhi
|
||||
imenu Test.Values is not equal [ -ne ]hhhhhhi
|
||||
imenu Test.Values is less than [ -lt ]hhhhhhi
|
||||
imenu Test.Values is less equal [ -le ]hhhhhhi
|
||||
imenu ParmSub.Substitute word if parm not set ${:-}hhi
|
||||
imenu ParmSub.Set parm to word if not set ${:=}hhi
|
||||
imenu ParmSub.Substitute word if parm set else nothing ${:+}hhi
|
||||
imenu ParmSub.If parm not set print word and exit ${:?}hhi
|
||||
imenu SpShVars.Number of positional parameters ${#}
|
||||
imenu SpShVars.All positional parameters (quoted spaces) ${*}
|
||||
imenu SpShVars.All positional parameters (unquoted spaces) ${@}
|
||||
imenu SpShVars.Flags set ${-}
|
||||
imenu SpShVars.Return code of last command ${?}
|
||||
imenu SpShVars.Process number of this shell ${$}
|
||||
imenu SpShVars.Process number of last background command ${!}
|
||||
imenu Environ.HOME ${HOME}
|
||||
imenu Environ.PATH ${PATH}
|
||||
imenu Environ.CDPATH ${CDPATH}
|
||||
imenu Environ.MAIL ${MAIL}
|
||||
imenu Environ.MAILCHECK ${MAILCHECK}
|
||||
imenu Environ.PS1 ${PS1}
|
||||
imenu Environ.PS2 ${PS2}
|
||||
imenu Environ.IFS ${IFS}
|
||||
imenu Environ.SHACCT ${SHACCT}
|
||||
imenu Environ.SHELL ${SHELL}
|
||||
imenu Environ.LC_CTYPE ${LC_CTYPE}
|
||||
imenu Environ.LC_MESSAGES ${LC_MESSAGES}
|
||||
imenu Builtins.cd cd
|
||||
imenu Builtins.echo echo
|
||||
imenu Builtins.eval eval
|
||||
imenu Builtins.exec exec
|
||||
imenu Builtins.export export
|
||||
imenu Builtins.getopts getopts
|
||||
imenu Builtins.hash hash
|
||||
22
runtime/pack/dist/opt/swapmouse/plugin/swapmouse.vim
vendored
Normal file
22
runtime/pack/dist/opt/swapmouse/plugin/swapmouse.vim
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
" These macros swap the left and right mouse buttons (for left handed)
|
||||
" Don't forget to do ":set mouse=a" or the mouse won't work at all
|
||||
noremap <LeftMouse> <RightMouse>
|
||||
noremap <2-LeftMouse> <2-RightMouse>
|
||||
noremap <3-LeftMouse> <3-RightMouse>
|
||||
noremap <4-LeftMouse> <4-RightMouse>
|
||||
noremap <LeftDrag> <RightDrag>
|
||||
noremap <LeftRelease> <RightRelease>
|
||||
noremap <RightMouse> <LeftMouse>
|
||||
noremap <2-RightMouse> <2-LeftMouse>
|
||||
noremap <3-RightMouse> <3-LeftMouse>
|
||||
noremap <4-RightMouse> <4-LeftMouse>
|
||||
noremap <RightDrag> <LeftDrag>
|
||||
noremap <RightRelease> <LeftRelease>
|
||||
noremap g<LeftMouse> <C-RightMouse>
|
||||
noremap g<RightMouse> <C-LeftMouse>
|
||||
noremap! <LeftMouse> <RightMouse>
|
||||
noremap! <LeftDrag> <RightDrag>
|
||||
noremap! <LeftRelease> <RightRelease>
|
||||
noremap! <RightMouse> <LeftMouse>
|
||||
noremap! <RightDrag> <LeftDrag>
|
||||
noremap! <RightRelease> <LeftRelease>
|
||||
@@ -1,15 +1,16 @@
|
||||
" Vim syntax file
|
||||
" Language: Fortran 2008 (and older: Fortran 2003, 95, 90, and 77)
|
||||
" Version: 0.96
|
||||
" Last Change: 2015 Nov. 30
|
||||
" Version: 0.97
|
||||
" Last Change: 2016 Feb. 26
|
||||
" Maintainer: Ajit J. Thakkar <ajit@unb.ca>; <http://www2.unb.ca/~ajit/>
|
||||
" Usage: For instructions, do :help fortran-syntax from Vim
|
||||
" Credits:
|
||||
" Version 0.1 was based on the fortran 77 syntax file by Mario Eusebio and
|
||||
" Preben Guldberg. Useful suggestions and contributions were made by: Andrej Panjkov,
|
||||
" Bram Moolenaar, Thomas Olsen, Michael Sternberg, Christian Reile,
|
||||
" Version 0.1 (April 2000) was based on the fortran 77 syntax file by Mario Eusebio and
|
||||
" Preben Guldberg. Since then, useful suggestions and contributions have been made,
|
||||
" in chronological order, by:
|
||||
" Andrej Panjkov, Bram Moolenaar, Thomas Olsen, Michael Sternberg, Christian Reile,
|
||||
" Walter Dieudonn<6E>, Alexander Wagner, Roman Bertle, Charles Rendleman,
|
||||
" Andrew Griffiths, Joe Krahn, Hendrik Merx, and Matt Thompson.
|
||||
" Andrew Griffiths, Joe Krahn, Hendrik Merx, Matt Thompson, and Jan Hermann.
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
@@ -407,7 +408,7 @@ if exists("fortran_fold")
|
||||
else
|
||||
syn region fortran77Loop transparent fold keepend start="\<do\s\+\z(\d\+\)" end="^\s*\z1\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData
|
||||
syn region fortran90Loop transparent fold keepend extend start="\(\<end\s\+\)\@<!\<do\(\s\+\a\|\s*$\)" skip="^\s*[!#].*$" excludenl end="\<end\s*do\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData
|
||||
syn region fortranIfBlock transparent fold keepend extend start="\(\<e\(nd\|lse\)\s\+\)\@<!\<if\s*(.\+)\s*then\>" skip="^\s*[!#].*$" end="\<end\s*if\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData
|
||||
syn region fortranIfBlock transparent fold keepend extend start="\(\<e\(nd\|lse\)\s\+\)\@<!\<if\s*(\(.\|&\s*\n\)\+)\(\s\|&\s*\n\)*then\>" skip="^\s*[!#].*$" end="\<end\s*if\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData
|
||||
syn region fortranCase transparent fold keepend extend start="\<select\s*case\>" skip="^\s*[!#].*$" end="\<end\s*select\>" contains=ALLBUT,fortranUnitHeader,fortranStructure,fortranStorageClass,fortranType,fortranProgram,fortranModule,fortranSubroutine,fortranFunction,fortranBlockData
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -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.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user