mirror of
https://github.com/neovim/neovim.git
synced 2025-09-05 19:08:15 +00:00
Compare commits
437 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0542baac28 | ||
![]() |
7be113d795 | ||
![]() |
ecd7beb6e4 | ||
![]() |
0de6f450e4 | ||
![]() |
4b95bb582d | ||
![]() |
42736d6a2a | ||
![]() |
cbf2a86c1d | ||
![]() |
2c154216a4 | ||
![]() |
e00bc61325 | ||
![]() |
b1854cefea | ||
![]() |
ca292c9768 | ||
![]() |
38ee85d000 | ||
![]() |
6d727657c8 | ||
![]() |
b6a090b4fd | ||
![]() |
4f8964cc00 | ||
![]() |
5c06f350ce | ||
![]() |
81591b146a | ||
![]() |
a46fc0d754 | ||
![]() |
d152e2f3fd | ||
![]() |
5f0260808c | ||
![]() |
6b1c8bbc18 | ||
![]() |
c685879eea | ||
![]() |
4fad66fbe6 | ||
![]() |
42033bc5bd | ||
![]() |
7a4d069bcc | ||
![]() |
cf52b881d9 | ||
![]() |
acbce46782 | ||
![]() |
c3a7a94a12 | ||
![]() |
1d4563771b | ||
![]() |
927e3e32d7 | ||
![]() |
44e6ee930f | ||
![]() |
5e241b5f50 | ||
![]() |
f1fed42ca7 | ||
![]() |
108d54bbd4 | ||
![]() |
c66ca17ca1 | ||
![]() |
34317846d6 | ||
![]() |
4e66bc99e4 | ||
![]() |
2e5736e2cd | ||
![]() |
830bf8665b | ||
![]() |
caa33aaaf8 | ||
![]() |
c0fd830be4 | ||
![]() |
7231438f12 | ||
![]() |
aba853a156 | ||
![]() |
49f73e5275 | ||
![]() |
defa86b08a | ||
![]() |
458b1fc0e7 | ||
![]() |
c91e9c1c7a | ||
![]() |
c69cfd7d1c | ||
![]() |
12ed735719 | ||
![]() |
9d9d93aee3 | ||
![]() |
10c72cd365 | ||
![]() |
d28d108648 | ||
![]() |
01ef6fc3d2 | ||
![]() |
35231312d7 | ||
![]() |
3f7a2d785d | ||
![]() |
708617ebb6 | ||
![]() |
91507c271e | ||
![]() |
0c799a8f10 | ||
![]() |
0b686e9b61 | ||
![]() |
9d2985ecba | ||
![]() |
4539d867d4 | ||
![]() |
5e1dc26f74 | ||
![]() |
598f5af58b | ||
![]() |
84eed76b55 | ||
![]() |
7e48c23a50 | ||
![]() |
c5bc0ea04c | ||
![]() |
05d1211424 | ||
![]() |
7baa96b717 | ||
![]() |
ae9a3d3b99 | ||
![]() |
795f2bb9b9 | ||
![]() |
2e1217da46 | ||
![]() |
0213e99aaf | ||
![]() |
aa0e09d251 | ||
![]() |
21dfbfbb9a | ||
![]() |
f3e8ca3bf5 | ||
![]() |
ff6ec703d5 | ||
![]() |
527ba2b12a | ||
![]() |
6a3f8d48d0 | ||
![]() |
1e0e301062 | ||
![]() |
3ccf69c1de | ||
![]() |
d0689eb0b2 | ||
![]() |
e31f9007e4 | ||
![]() |
e4e7b2d239 | ||
![]() |
c04ffe866d | ||
![]() |
bd33f1165b | ||
![]() |
3089c86f4e | ||
![]() |
9147331e21 | ||
![]() |
4ab3fe8eaa | ||
![]() |
b3ece5c81c | ||
![]() |
18f56c8e90 | ||
![]() |
5072ab9e5b | ||
![]() |
4804001aff | ||
![]() |
32d9c19e29 | ||
![]() |
01f1028496 | ||
![]() |
b8bb1f6729 | ||
![]() |
9ef4be9aab | ||
![]() |
654e92186b | ||
![]() |
9b545dd3db | ||
![]() |
37e64d79cc | ||
![]() |
87ff2682d7 | ||
![]() |
349fa0048b | ||
![]() |
3a802e3c16 | ||
![]() |
797d72a997 | ||
![]() |
0a1b852cd1 | ||
![]() |
36c0ec6dd4 | ||
![]() |
d37c2e5dc2 | ||
![]() |
859e9fa65f | ||
![]() |
ed198737fd | ||
![]() |
49cf0b6ac4 | ||
![]() |
7cd204dbfa | ||
![]() |
e8c0f90962 | ||
![]() |
561c1e39e0 | ||
![]() |
13841a56b4 | ||
![]() |
6143cfdeec | ||
![]() |
3d49fc1f50 | ||
![]() |
93f3896300 | ||
![]() |
242c3d5f0b | ||
![]() |
cc1ec959f1 | ||
![]() |
5b514b5988 | ||
![]() |
c5f5f427c6 | ||
![]() |
fb4d5b0516 | ||
![]() |
f25797f869 | ||
![]() |
90bf31c742 | ||
![]() |
26b90e95e7 | ||
![]() |
e350902b7d | ||
![]() |
2a6c5bb0c4 | ||
![]() |
0f32088ea2 | ||
![]() |
e828a5a76b | ||
![]() |
e8ddbbdf07 | ||
![]() |
c853fd6fab | ||
![]() |
714ec09c6d | ||
![]() |
e7e2844d46 | ||
![]() |
f6f77272b3 | ||
![]() |
f96dfae52f | ||
![]() |
fb503d73da | ||
![]() |
6bc0d9b8c7 | ||
![]() |
b5dfdf0669 | ||
![]() |
9e5dca8490 | ||
![]() |
763422b036 | ||
![]() |
d6e27f90b9 | ||
![]() |
43309d1993 | ||
![]() |
d357a42389 | ||
![]() |
9755a2ffd5 | ||
![]() |
c5c8a82134 | ||
![]() |
d7b942b54e | ||
![]() |
fdc48cad7d | ||
![]() |
459a6ff058 | ||
![]() |
8b8db9e158 | ||
![]() |
9ca90fdb9f | ||
![]() |
500c485e36 | ||
![]() |
e62f681d2d | ||
![]() |
f2af6177fb | ||
![]() |
d733beb0be | ||
![]() |
c377c8be61 | ||
![]() |
31df051ed9 | ||
![]() |
f6968dc0f7 | ||
![]() |
e904186277 | ||
![]() |
1ff162c0d9 | ||
![]() |
82f30bfeda | ||
![]() |
6636e2a259 | ||
![]() |
5bcb7aa8bf | ||
![]() |
1ad5a970ce | ||
![]() |
978c1fd11f | ||
![]() |
e19234f391 | ||
![]() |
13262aef7a | ||
![]() |
d1070787ca | ||
![]() |
2d961403ba | ||
![]() |
caf85b80ae | ||
![]() |
9d4fcec7c6 | ||
![]() |
6a6f188d2a | ||
![]() |
9706664b88 | ||
![]() |
16da3a6fe0 | ||
![]() |
657ba62a84 | ||
![]() |
73da9fdafd | ||
![]() |
6bbd4b2298 | ||
![]() |
869a9078e1 | ||
![]() |
fbd6b10e1b | ||
![]() |
acdc0b1955 | ||
![]() |
c40b3b680d | ||
![]() |
6fc122e600 | ||
![]() |
0fa4f98a05 | ||
![]() |
97caabc49a | ||
![]() |
3a2903c836 | ||
![]() |
4169fc8281 | ||
![]() |
b268ba353a | ||
![]() |
885db120fa | ||
![]() |
9477c5bb5b | ||
![]() |
719dae2e01 | ||
![]() |
3bb388664d | ||
![]() |
c91a0dca02 | ||
![]() |
f3efb724af | ||
![]() |
40f853398e | ||
![]() |
59aa2eb501 | ||
![]() |
9d087206ab | ||
![]() |
41ab095399 | ||
![]() |
79d77da8a0 | ||
![]() |
819b79dbc5 | ||
![]() |
c9b9f052cc | ||
![]() |
294c0ba014 | ||
![]() |
5060ebc5d0 | ||
![]() |
5a61ff188c | ||
![]() |
22fe76aec4 | ||
![]() |
6a2d40497a | ||
![]() |
51937e1322 | ||
![]() |
e9fd1244b7 | ||
![]() |
8fb7972517 | ||
![]() |
3a54ce5a73 | ||
![]() |
68f7464eed | ||
![]() |
6b7faf22f4 | ||
![]() |
6bc3bcefc6 | ||
![]() |
538255c228 | ||
![]() |
cb351c678b | ||
![]() |
f098e53e6f | ||
![]() |
0190b9fb92 | ||
![]() |
b182f247ec | ||
![]() |
ef4676ed5b | ||
![]() |
baaddf358b | ||
![]() |
53eddb881c | ||
![]() |
1dde512498 | ||
![]() |
892f55bd20 | ||
![]() |
f1bc50d7da | ||
![]() |
d545c8e1ce | ||
![]() |
1dd98a03aa | ||
![]() |
8fd12805d7 | ||
![]() |
4192c411a8 | ||
![]() |
cb03517fd3 | ||
![]() |
4408431086 | ||
![]() |
27ced483cc | ||
![]() |
26a6ed55c6 | ||
![]() |
9b0b281b75 | ||
![]() |
c13f72ee0a | ||
![]() |
1984072822 | ||
![]() |
31f6334aa8 | ||
![]() |
91d13bd861 | ||
![]() |
09e0c96201 | ||
![]() |
1b61bd93ae | ||
![]() |
61024fb4a8 | ||
![]() |
50bd8297e6 | ||
![]() |
d8079e5ab7 | ||
![]() |
b6300742d2 | ||
![]() |
a8f9d56796 | ||
![]() |
153e6835f1 | ||
![]() |
2ef1b68751 | ||
![]() |
e83845285c | ||
![]() |
d57f25e5ef | ||
![]() |
1ebb75b1ec | ||
![]() |
b1edc8abb7 | ||
![]() |
7bc86b2bbc | ||
![]() |
d4f32d0789 | ||
![]() |
31a29e41b0 | ||
![]() |
fdb0a5e24e | ||
![]() |
c3990ba0e6 | ||
![]() |
eeec0cab58 | ||
![]() |
91e9c0a7ee | ||
![]() |
6186df3562 | ||
![]() |
db324879d2 | ||
![]() |
de802fd4d2 | ||
![]() |
aeebed8d61 | ||
![]() |
9959113746 | ||
![]() |
c8b6ec2e6a | ||
![]() |
3a59b04c19 | ||
![]() |
724675061c | ||
![]() |
b0aa748e14 | ||
![]() |
7531410169 | ||
![]() |
42731a9a15 | ||
![]() |
87fa495b21 | ||
![]() |
7e6a8310b7 | ||
![]() |
beb2e4f095 | ||
![]() |
9c2f4ce20d | ||
![]() |
22dfe6925d | ||
![]() |
45d5b78aec | ||
![]() |
36ffb6a7d8 | ||
![]() |
78ea090f29 | ||
![]() |
50c26017a3 | ||
![]() |
6f55d1377f | ||
![]() |
ddb9f02712 | ||
![]() |
f610b807b4 | ||
![]() |
b6f8c35cf7 | ||
![]() |
9114790c4c | ||
![]() |
641d424290 | ||
![]() |
6e55d99f43 | ||
![]() |
6ca089fd8d | ||
![]() |
e74c2334f2 | ||
![]() |
4ce24ff9da | ||
![]() |
9e1c659666 | ||
![]() |
9419a4c86c | ||
![]() |
dafca1ad68 | ||
![]() |
e161d6a19d | ||
![]() |
1144cc6d9e | ||
![]() |
45598d2e5e | ||
![]() |
49735d6fae | ||
![]() |
d533edf61e | ||
![]() |
68bcb32ec4 | ||
![]() |
e65895941c | ||
![]() |
54d41ff049 | ||
![]() |
b9da0bd2c5 | ||
![]() |
dabf009283 | ||
![]() |
e6d32c1010 | ||
![]() |
3c53371b0c | ||
![]() |
b94891421a | ||
![]() |
e54c0ab367 | ||
![]() |
7307096c5e | ||
![]() |
9d170a493e | ||
![]() |
e2ad3fbf27 | ||
![]() |
a20a00459c | ||
![]() |
66fa1538ed | ||
![]() |
7063dd9d64 | ||
![]() |
6cf24be295 | ||
![]() |
baf91a455c | ||
![]() |
bba6315580 | ||
![]() |
911421d328 | ||
![]() |
13e5724621 | ||
![]() |
764f576d64 | ||
![]() |
efe8311371 | ||
![]() |
8c24592da2 | ||
![]() |
7bf0cfb01f | ||
![]() |
4a6b4bbf93 | ||
![]() |
7b6786f6f9 | ||
![]() |
c12801986c | ||
![]() |
e1079c2a28 | ||
![]() |
19b47b043d | ||
![]() |
89a7a4f02c | ||
![]() |
dc6cc4787c | ||
![]() |
3a9da803cc | ||
![]() |
21eee40cdb | ||
![]() |
bc1a5db6cc | ||
![]() |
6e9f329d05 | ||
![]() |
0c536b5d8a | ||
![]() |
c4199d1866 | ||
![]() |
cd08e6cf72 | ||
![]() |
c61bf43a90 | ||
![]() |
fee961c8dd | ||
![]() |
c28fb221ba | ||
![]() |
df99e43ba4 | ||
![]() |
5f42184873 | ||
![]() |
172d099c32 | ||
![]() |
ca93b4a299 | ||
![]() |
df072c3b2b | ||
![]() |
7eb4d2f79d | ||
![]() |
a34d3a7244 | ||
![]() |
d61826a85c | ||
![]() |
d5aaa18316 | ||
![]() |
2daf54ee8d | ||
![]() |
ac819b8994 | ||
![]() |
b801291bec | ||
![]() |
c6f5d6b7e0 | ||
![]() |
4ceacb37d5 | ||
![]() |
13db9236fe | ||
![]() |
c4c2969624 | ||
![]() |
ca65514a24 | ||
![]() |
395ef5642e | ||
![]() |
8dc6c1a7ff | ||
![]() |
0991041ae7 | ||
![]() |
0ebd30fba7 | ||
![]() |
aa6705875d | ||
![]() |
4c9e5676cd | ||
![]() |
bccb49bedb | ||
![]() |
f8a8a56908 | ||
![]() |
1c9d7270a8 | ||
![]() |
fe06e2a4a0 | ||
![]() |
d9d2c2fcc0 | ||
![]() |
df99c6493d | ||
![]() |
522b885a0d | ||
![]() |
3c24704ac8 | ||
![]() |
31257b450b | ||
![]() |
d61a50758c | ||
![]() |
6127eaef05 | ||
![]() |
cd321b7d0f | ||
![]() |
73b8424fad | ||
![]() |
0f381f26cb | ||
![]() |
e75e9c10dc | ||
![]() |
9bba8ba372 | ||
![]() |
626065d385 | ||
![]() |
5d8d24f0c2 | ||
![]() |
a9c5423263 | ||
![]() |
2f6d3e599b | ||
![]() |
c9e39f8227 | ||
![]() |
f8fc8f51c0 | ||
![]() |
94dfb6cea2 | ||
![]() |
0253766b5d | ||
![]() |
a371f1027e | ||
![]() |
f175b281cf | ||
![]() |
c6ac4f84b1 | ||
![]() |
acb7c826b3 | ||
![]() |
98a08c3e5a | ||
![]() |
1c22cab2fd | ||
![]() |
e536abc1e1 | ||
![]() |
7e2348f2b1 | ||
![]() |
87e054bb24 | ||
![]() |
a2d25b7bf8 | ||
![]() |
3bd3b3b768 | ||
![]() |
de3a515123 | ||
![]() |
5e59916e84 | ||
![]() |
abe00d583e | ||
![]() |
8fb7273ac0 | ||
![]() |
0ade1bb706 | ||
![]() |
9ce81f7b2b | ||
![]() |
7fd771619f | ||
![]() |
10a54ad12e | ||
![]() |
0b5a7e4ad5 | ||
![]() |
8d6e3f2b88 | ||
![]() |
c41bacc67c | ||
![]() |
e968d72cae | ||
![]() |
999af47be8 | ||
![]() |
0b3ec84840 | ||
![]() |
e587b490a0 | ||
![]() |
59468e3495 | ||
![]() |
1995be8451 | ||
![]() |
86a95c5117 | ||
![]() |
97c6d80ca7 | ||
![]() |
39c628d031 | ||
![]() |
0089ef6b65 | ||
![]() |
703cf3197f | ||
![]() |
bed61041a0 | ||
![]() |
9da4d0dfee | ||
![]() |
eb2d547bd5 | ||
![]() |
48dbb75ff6 | ||
![]() |
7bc627b3c8 | ||
![]() |
4af6ec746c | ||
![]() |
7a589e4a9e | ||
![]() |
41a64586c7 | ||
![]() |
c826ebd3de | ||
![]() |
c79bf4ec99 | ||
![]() |
db2aa27df1 | ||
![]() |
470883d705 | ||
![]() |
f5d3f3da6f | ||
![]() |
10b014ca7b | ||
![]() |
728d582333 | ||
![]() |
8a7b15cf35 | ||
![]() |
6d8a509e51 | ||
![]() |
4d253b4df5 | ||
![]() |
46475a1021 | ||
![]() |
2f2e729899 | ||
![]() |
ad43480952 | ||
![]() |
8d8af65659 | ||
![]() |
605e74327a | ||
![]() |
a4cb500d98 |
@@ -2,7 +2,7 @@
|
||||
:: MSYS2, this allows using all the dependencies and tools available
|
||||
:: in MSYS2, but we cannot build inside the MSYS2 shell.
|
||||
echo on
|
||||
if "%TARGET%" == "MINGW_32" (
|
||||
if "%CONFIGURATION%" == "MINGW_32" (
|
||||
set ARCH=i686
|
||||
set BITS=32
|
||||
) else (
|
||||
@@ -12,9 +12,12 @@ if "%TARGET%" == "MINGW_32" (
|
||||
:: We cannot have sh.exe in the PATH (MinGW)
|
||||
set PATH=%PATH:C:\Program Files\Git\usr\bin;=%
|
||||
set PATH=C:\msys64\mingw%BITS%\bin;C:\Windows\System32;C:\Windows;%PATH%
|
||||
:: The default cpack in the PATH is not CMake
|
||||
set PATH=C:\Program Files (x86)\CMake\bin\cpack.exe;%PATH%
|
||||
|
||||
:: Build third-party dependencies
|
||||
C:\msys64\usr\bin\bash -lc "pacman --verbose --noconfirm -Su" || goto :error
|
||||
C:\msys64\usr\bin\bash -lc "pacman --verbose --noconfirm --needed -S mingw-w64-%ARCH%-cmake mingw-w64-%ARCH%-perl mingw-w64-%ARCH%-python2 mingw-w64-%ARCH%-diffutils" || goto :error
|
||||
C:\msys64\usr\bin\bash -lc "pacman --verbose --noconfirm --needed -S mingw-w64-%ARCH%-cmake mingw-w64-%ARCH%-perl mingw-w64-%ARCH%-python2 mingw-w64-%ARCH%-diffutils gperf" || goto :error
|
||||
|
||||
mkdir .deps
|
||||
cd .deps
|
||||
@@ -22,6 +25,20 @@ cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release ..\third-party\ || goto :e
|
||||
mingw32-make VERBOSE=1 || goto :error
|
||||
cd ..
|
||||
|
||||
:: Build Neovim
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUSTED_OUTPUT_TYPE=gtest -DGPERF_PRG="C:\msys64\usr\bin\gperf.exe" .. || goto :error
|
||||
mingw32-make VERBOSE=1 || goto :error
|
||||
bin\nvim --version || goto :error
|
||||
|
||||
:: Functional tests
|
||||
mingw32-make functionaltest VERBOSE=1 || goto :error
|
||||
|
||||
:: Build artifacts
|
||||
cpack -G ZIP -C Release
|
||||
if defined APPVEYOR_REPO_TAG_NAME cpack -G NSIS -C Release
|
||||
|
||||
goto :EOF
|
||||
:error
|
||||
exit /b %errorlevel%
|
@@ -1,22 +0,0 @@
|
||||
echo on
|
||||
if "%TARGET%" == "MINGW_32" (
|
||||
set ARCH=i686
|
||||
set BITS=32
|
||||
) else (
|
||||
set ARCH=x86_64
|
||||
set BITS=64
|
||||
)
|
||||
:: We cannot have sh.exe in the PATH (MinGW)
|
||||
set PATH=%PATH:C:\Program Files\Git\usr\bin;=%
|
||||
set PATH=C:\msys64\mingw%BITS%\bin;C:\Windows\System32;C:\Windows;%PATH%
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release .. || goto :error
|
||||
mingw32-make VERBOSE=1 || goto :error
|
||||
bin\nvim --version || goto :error
|
||||
cd ..
|
||||
|
||||
goto :EOF
|
||||
:error
|
||||
exit /b %errorlevel%
|
20
.travis.yml
20
.travis.yml
@@ -9,9 +9,7 @@ env:
|
||||
# http://docs.travis-ci.com/user/speeding-up-the-build/#Paralellizing-your-build-on-one-VM
|
||||
- MAKE_CMD="make -j2"
|
||||
# Update PATH for pip.
|
||||
- PATH="$(python2.7 -c 'import site; print(site.getuserbase())')/bin:$PATH"
|
||||
# LLVM symbolizer path.
|
||||
- LLVM_SYMBOLIZER="$(which llvm-symbolizer-3.4)"
|
||||
- PATH="$(python2.7 -c 'import site; print(site.getuserbase())')/bin:/usr/lib/llvm-symbolizer-3.8/bin:$PATH"
|
||||
# Build directory for Neovim.
|
||||
- BUILD_DIR="$TRAVIS_BUILD_DIR/build"
|
||||
# Build directory for third-party dependencies.
|
||||
@@ -36,9 +34,8 @@ env:
|
||||
-DCMAKE_TOOLCHAIN_FILE=$TRAVIS_BUILD_DIR/cmake/i386-linux-gnu.toolchain.cmake"
|
||||
# Environment variables for Clang sanitizers.
|
||||
- ASAN_OPTIONS="detect_leaks=1:check_initialization_order=1:log_path=$LOG_DIR/asan"
|
||||
- ASAN_SYMBOLIZER_PATH="$LLVM_SYMBOLIZER"
|
||||
- TSAN_OPTIONS="external_symbolizer_path=$LLVM_SYMBOLIZER log_path=$LOG_DIR/tsan"
|
||||
- UBSAN_OPTIONS="log_path=$LOG_DIR/ubsan"
|
||||
- TSAN_OPTIONS="log_path=$LOG_DIR/tsan"
|
||||
- UBSAN_OPTIONS="print_stacktrace=1 log_path=$LOG_DIR/ubsan"
|
||||
# Environment variables for Valgrind.
|
||||
- VALGRIND_LOG="$LOG_DIR/valgrind-%p.log"
|
||||
# Cache marker for third-party dependencies cache.
|
||||
@@ -70,15 +67,17 @@ matrix:
|
||||
compiler: gcc-5 -m32
|
||||
env: BUILD_32BIT=ON
|
||||
- os: linux
|
||||
compiler: clang
|
||||
compiler: clang-3.8
|
||||
env: CLANG_SANITIZER=ASAN_UBSAN
|
||||
- os: linux
|
||||
compiler: clang
|
||||
compiler: clang-3.8
|
||||
env: CLANG_SANITIZER=TSAN
|
||||
- os: osx
|
||||
compiler: clang
|
||||
osx_image: xcode7.3 # macOS 10.11
|
||||
- os: osx
|
||||
compiler: gcc-4.9
|
||||
osx_image: xcode7.3 # macOS 10.11
|
||||
fast_finish: true
|
||||
|
||||
before_install: .ci/before_install.sh
|
||||
@@ -94,11 +93,12 @@ addons:
|
||||
# TODO: Remove PPA when Travis gets Python >=3.3.
|
||||
- deadsnakes
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.8
|
||||
packages:
|
||||
- autoconf
|
||||
- automake
|
||||
- build-essential
|
||||
- clang-3.4
|
||||
- clang-3.8
|
||||
- cmake
|
||||
- g++-5-multilib
|
||||
- g++-multilib
|
||||
@@ -107,7 +107,7 @@ addons:
|
||||
- gdb
|
||||
- libc6-dev-i386
|
||||
- libtool
|
||||
- llvm-3.4-dev
|
||||
- llvm-3.8-dev
|
||||
- pkg-config
|
||||
- python3.3-dev
|
||||
- unzip
|
||||
|
@@ -8,6 +8,9 @@ endif()
|
||||
# Point CMake at any custom modules we may ship
|
||||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
||||
|
||||
# We don't support building in-tree.
|
||||
include(PreventInTreeBuilds)
|
||||
|
||||
# Prefer our bundled versions of dependencies.
|
||||
set(DEPS_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/.deps/usr" CACHE PATH "Path prefix for finding dependencies")
|
||||
if(CMAKE_CROSSCOMPILING AND NOT UNIX)
|
||||
@@ -56,12 +59,17 @@ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
|
||||
STRINGS "Debug" "Dev" "Release" "MinSizeRel" "RelWithDebInfo")
|
||||
|
||||
# If not in a git repo (e.g., a tarball) these tokens define the complete
|
||||
# version string, else it is combined with the result of `git describe`.
|
||||
# version string, else they are combined with the result of `git describe`.
|
||||
set(NVIM_VERSION_MAJOR 0)
|
||||
set(NVIM_VERSION_MINOR 1)
|
||||
set(NVIM_VERSION_PATCH 5)
|
||||
set(NVIM_VERSION_PATCH 7)
|
||||
set(NVIM_VERSION_PRERELEASE "") # for package maintainers
|
||||
|
||||
# API level
|
||||
set(NVIM_API_LEVEL 1) # Bump this after any API change.
|
||||
set(NVIM_API_LEVEL_COMPAT 0) # Adjust this after a _breaking_ API change.
|
||||
set(NVIM_API_PRERELEASE false)
|
||||
|
||||
file(TO_CMAKE_PATH ${CMAKE_CURRENT_LIST_DIR}/.git FORCED_GIT_DIR)
|
||||
include(GetGitRevisionDescription)
|
||||
get_git_head_revision(GIT_REFSPEC NVIM_VERSION_COMMIT)
|
||||
@@ -253,6 +261,10 @@ option(
|
||||
if(TRAVIS_CI_BUILD)
|
||||
message(STATUS "Travis CI build enabled.")
|
||||
add_definitions(-Werror)
|
||||
if(DEFINED ENV{BUILD_32BIT})
|
||||
# Get some test coverage for unsigned char
|
||||
add_definitions(-funsigned-char)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
@@ -328,7 +340,12 @@ if((CLANG_ASAN_UBSAN OR CLANG_MSAN OR CLANG_TSAN) AND NOT CMAKE_C_COMPILER_ID MA
|
||||
message(FATAL_ERROR "Sanitizers are only supported for Clang.")
|
||||
endif()
|
||||
|
||||
option(ENABLE_JEMALLOC "enable jemalloc" ON)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
|
||||
message(STATUS "detected OpenBSD; disabled jemalloc. #5318")
|
||||
option(ENABLE_JEMALLOC "enable jemalloc" OFF)
|
||||
else()
|
||||
option(ENABLE_JEMALLOC "enable jemalloc" ON)
|
||||
endif()
|
||||
|
||||
if (ENABLE_JEMALLOC)
|
||||
if(CLANG_ASAN_UBSAN OR CLANG_MSAN OR CLANG_TSAN)
|
||||
@@ -395,7 +412,7 @@ endif()
|
||||
message(STATUS "Using the Lua interpreter ${LUA_PRG}.")
|
||||
|
||||
# Setup busted.
|
||||
find_program(BUSTED_PRG busted)
|
||||
find_program(BUSTED_PRG NAMES busted busted.bat)
|
||||
find_program(BUSTED_LUA_PRG busted-lua)
|
||||
if(NOT BUSTED_OUTPUT_TYPE)
|
||||
if(WIN32)
|
||||
@@ -407,6 +424,8 @@ endif()
|
||||
|
||||
find_program(LUACHECK_PRG luacheck)
|
||||
|
||||
find_program(GPERF_PRG gperf)
|
||||
|
||||
include(InstallHelpers)
|
||||
|
||||
file(GLOB MANPAGES
|
||||
@@ -498,6 +517,7 @@ if(BUSTED_PRG)
|
||||
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
|
||||
-DBUILD_DIR=${CMAKE_BINARY_DIR}
|
||||
-DTEST_TYPE=unit
|
||||
-DSYSTEM_NAME=${CMAKE_SYSTEM_NAME}
|
||||
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
|
||||
DEPENDS ${UNITTEST_PREREQS}
|
||||
${TEST_TARGET_ARGS})
|
||||
@@ -516,6 +536,7 @@ if(BUSTED_PRG)
|
||||
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
|
||||
-DBUILD_DIR=${CMAKE_BINARY_DIR}
|
||||
-DTEST_TYPE=functional
|
||||
-DSYSTEM_NAME=${CMAKE_SYSTEM_NAME}
|
||||
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
|
||||
DEPENDS ${FUNCTIONALTEST_PREREQS}
|
||||
${TEST_TARGET_ARGS})
|
||||
@@ -530,6 +551,7 @@ if(BUSTED_PRG)
|
||||
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
|
||||
-DBUILD_DIR=${CMAKE_BINARY_DIR}
|
||||
-DTEST_TYPE=benchmark
|
||||
-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
|
||||
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
|
||||
DEPENDS ${BENCHMARK_PREREQS}
|
||||
${TEST_TARGET_ARGS})
|
||||
@@ -546,6 +568,7 @@ if(BUSTED_LUA_PRG)
|
||||
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
|
||||
-DBUILD_DIR=${CMAKE_BINARY_DIR}
|
||||
-DTEST_TYPE=functional
|
||||
-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
|
||||
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
|
||||
DEPENDS ${FUNCTIONALTEST_PREREQS}
|
||||
${TEST_TARGET_ARGS})
|
||||
@@ -556,6 +579,7 @@ if(LUACHECK_PRG)
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DLUACHECK_PRG=${LUACHECK_PRG}
|
||||
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
|
||||
-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
|
||||
-P ${PROJECT_SOURCE_DIR}/cmake/RunTestsLint.cmake)
|
||||
endif()
|
||||
|
||||
|
@@ -38,15 +38,25 @@ Pull requests ("PRs")
|
||||
- Try to [tidy your history][git-history-rewriting]: combine related commits
|
||||
with interactive rebasing, separate monolithic commits, etc.
|
||||
|
||||
### Stages: WIP, RFC
|
||||
### Stages: WIP, RFC, RDY
|
||||
|
||||
Pull requests have two stages: `[WIP]` (Work In Progress) and `[RFC]` (Request
|
||||
For Comment).
|
||||
Pull requests have three stages: `[WIP]` (Work In Progress), `[RFC]` (Request
|
||||
For Comment) and `[RDY]` (Ready).
|
||||
|
||||
- Untagged PRs are assumed to be `[RFC]`, i.e. the work is ready for review and
|
||||
you would like feedback.
|
||||
- Preprend `[WIP]` to the PR title if you are _not_ ready for feedback and the
|
||||
- Untagged PRs are assumed to be `[RFC]`, i.e. you are requesting a review.
|
||||
- Prepend `[WIP]` to the PR title if you are _not_ requesting feedback and the
|
||||
work is still in flux.
|
||||
- Prepend `[RDY]` to the PR title if you are _done_ with the PR and are only
|
||||
waiting on it to be merged.
|
||||
|
||||
For example, a typical workflow is:
|
||||
|
||||
1. You open a `[WIP]` PR where the work is _not_ ready for feedback, you just want to
|
||||
let others know what you are doing.
|
||||
2. Once the PR is ready for review, you replace `[WIP]` in the title with `[RFC]`.
|
||||
You may add fix up commits to address issues that come up during review.
|
||||
3. Once the PR is ready for merging, you rebase/squash your work appropriately and
|
||||
then replace `[RFC]` in the title with `[RDY]`.
|
||||
|
||||
### Commit messages
|
||||
|
||||
|
24
README.md
24
README.md
@@ -1,20 +1,24 @@
|
||||

|
||||
[](https://neovim.io)
|
||||
|
||||
[Website] | [Community] | [Wiki] | [Documentation] | [Mailing List] | [Twitter] | [Bountysource]
|
||||
[Wiki](https://github.com/neovim/neovim/wiki) |
|
||||
[Documentation](https://neovim.io/doc) |
|
||||
[Twitter](https://twitter.com/Neovim) |
|
||||
[Community](https://neovim.io/community/) |
|
||||
[Gitter **Chat**](https://gitter.im/neovim/neovim)
|
||||
|
||||
[](https://travis-ci.org/neovim/neovim)
|
||||
[](https://ci.appveyor.com/project/neovim/neovim/branch/master)
|
||||
[](https://waffle.io/neovim/neovim)
|
||||
[](https://coveralls.io/r/neovim/neovim)
|
||||
[](https://scan.coverity.com/projects/2227)
|
||||
[](http://neovim.io/doc/reports/clang)
|
||||
[](https://gitter.im/neovim/neovim?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://neovim.io/doc/reports/clang)
|
||||
<a href="https://buildd.debian.org/neovim"><img src="https://www.debian.org/logos/openlogo-nd-25.png" width="13" height="15">Debian</a>
|
||||
|
||||
Neovim is a project that seeks to aggressively refactor Vim in order to:
|
||||
|
||||
- Simplify maintenance and encourage [contributions](CONTRIBUTING.md)
|
||||
- Split the work between multiple developers
|
||||
- Enable the implementation of new/modern UIs without modifications to the core
|
||||
- Enable advanced [external UIs] without modifications to the core
|
||||
- Improve extensibility with a new [plugin architecture](https://github.com/neovim/neovim/wiki/Plugin-UI-architecture)
|
||||
|
||||
For more details, see
|
||||
@@ -45,7 +49,7 @@ See the [Roadmap].
|
||||
How do I get it?
|
||||
----------------
|
||||
|
||||
There is a formula for OSX/homebrew, a PKGBUILD for Arch Linux, RPM, deb, and
|
||||
There is a Debian package, homebrew formula, PKGBUILD for Arch Linux, RPM, and
|
||||
more. See [the wiki](https://github.com/neovim/neovim/wiki/Installing-Neovim)!
|
||||
|
||||
License
|
||||
@@ -74,15 +78,9 @@ See `LICENSE` for details.
|
||||
You can also sponsor the development of Vim. Vim sponsors can vote for
|
||||
features. The money goes to Uganda anyway.
|
||||
|
||||
[Website]: http://neovim.io
|
||||
[Community]: http://neovim.io/community/
|
||||
[Wiki]: https://github.com/neovim/neovim/wiki
|
||||
[Documentation]: http://neovim.io/doc
|
||||
[Mailing List]: https://groups.google.com/forum/#!forum/neovim
|
||||
[Twitter]: http://twitter.com/Neovim
|
||||
[Bountysource]: https://www.bountysource.com/teams/neovim
|
||||
[license-commit]: https://github.com/neovim/neovim/commit/b17d9691a24099c9210289f16afb1a498a89d803
|
||||
[nvim-features]: https://neovim.io/doc/user/vim_diff.html#nvim-features
|
||||
[Roadmap]: https://neovim.io/roadmap/
|
||||
[external UIs]: https://github.com/neovim/neovim/wiki/Related-projects#gui-projects
|
||||
|
||||
<!-- vim: set tw=80: -->
|
||||
|
22
appveyor.yml
22
appveyor.yml
@@ -1,22 +1,10 @@
|
||||
version: '{build}'
|
||||
skip_tags: true
|
||||
environment:
|
||||
# The default cpack in the PATH is not CMake
|
||||
CPACK: C:\Program Files (x86)\CMake\bin\cpack.exe
|
||||
matrix:
|
||||
- TARGET: MINGW_64
|
||||
BUILD_DEPS_SCRIPT: .ci\msys_build_deps.bat
|
||||
BUILD_SCRIPT: .ci\msys_build.bat
|
||||
- TARGET: MINGW_32
|
||||
BUILD_DEPS_SCRIPT: .ci\msys_build_deps.bat
|
||||
BUILD_SCRIPT: .ci\msys_build.bat
|
||||
configuration:
|
||||
- MINGW_64
|
||||
- MINGW_32
|
||||
install: []
|
||||
build_script:
|
||||
- if defined BUILD_DEPS_SCRIPT call %BUILD_DEPS_SCRIPT%
|
||||
- call %BUILD_SCRIPT%
|
||||
# Build artifacts
|
||||
- cd build
|
||||
- '"%CPACK%" -G NSIS -C Release'
|
||||
- '"%CPACK%" -G ZIP -C Release'
|
||||
- call .ci\build.bat
|
||||
artifacts:
|
||||
- path: build/Neovim.zip
|
||||
- path: build/Neovim.exe
|
||||
|
23
cmake/PreventInTreeBuilds.cmake
Normal file
23
cmake/PreventInTreeBuilds.cmake
Normal file
@@ -0,0 +1,23 @@
|
||||
function(PreventInTreeBuilds)
|
||||
get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH)
|
||||
get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH)
|
||||
|
||||
if("${srcdir}" STREQUAL "${bindir}")
|
||||
message("")
|
||||
message("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
|
||||
message("Neovim doesn't support in-tree builds. It's recommended that you")
|
||||
message("use a build/ subdirectory:")
|
||||
message(" mkdir build")
|
||||
message(" cd build")
|
||||
message(" cmake <OPTIONS> ..")
|
||||
message("")
|
||||
message("Make sure to cleanup some CMake artifacts from this failed build")
|
||||
message("with:")
|
||||
message(" rm -rf CMakeFiles CMakeCache.txt")
|
||||
message("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
|
||||
message("")
|
||||
message(FATAL_ERROR "Stopping build.")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
PreventInTreeBuilds()
|
@@ -28,6 +28,7 @@ if(DEFINED ENV{TEST_FILTER})
|
||||
set(TEST_TAG "--filter=$ENV{TEST_FILTER}")
|
||||
endif()
|
||||
|
||||
set(ENV{SYSTEM_NAME} ${SYSTEM_NAME})
|
||||
execute_process(
|
||||
COMMAND ${BUSTED_PRG} ${TEST_TAG} ${TEST_FILTER} -v -o ${BUSTED_OUTPUT_TYPE}
|
||||
--lua=${LUA_PRG} --lazy --helper=${TEST_DIR}/${TEST_TYPE}/preload.lua
|
||||
|
@@ -142,12 +142,16 @@ configure_file (
|
||||
find_program(WHOAMI_PROG whoami)
|
||||
find_program(HOSTNAME_PROG hostname)
|
||||
|
||||
if (NOT DEFINED USERNAME AND EXISTS ${WHOAMI_PROG})
|
||||
if (DEFINED ENV{USERNAME})
|
||||
set(USERNAME $ENV{USERNAME})
|
||||
elseif (NOT DEFINED USERNAME AND EXISTS ${WHOAMI_PROG})
|
||||
execute_process(COMMAND ${WHOAMI_PROG}
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
OUTPUT_VARIABLE USERNAME)
|
||||
endif()
|
||||
if (EXISTS ${HOSTNAME_PROG})
|
||||
if (DEFINED ENV{HOSTNAME})
|
||||
set(HOSTNAME $ENV{HOSTNAME})
|
||||
elseif (EXISTS ${HOSTNAME_PROG})
|
||||
execute_process(COMMAND ${HOSTNAME_PROG}
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
OUTPUT_VARIABLE HOSTNAME)
|
||||
|
@@ -7,6 +7,10 @@
|
||||
#define NVIM_VERSION_PRERELEASE "@NVIM_VERSION_PRERELEASE@"
|
||||
#cmakedefine NVIM_VERSION_MEDIUM "@NVIM_VERSION_MEDIUM@"
|
||||
|
||||
#define NVIM_API_LEVEL @NVIM_API_LEVEL@
|
||||
#define NVIM_API_LEVEL_COMPAT @NVIM_API_LEVEL_COMPAT@
|
||||
#define NVIM_API_PRERELEASE @NVIM_API_PRERELEASE@
|
||||
|
||||
#define NVIM_VERSION_CFLAGS "@NVIM_VERSION_CFLAGS@"
|
||||
#define NVIM_VERSION_BUILD_TYPE "@NVIM_VERSION_BUILD_TYPE@"
|
||||
|
||||
|
@@ -3,6 +3,7 @@ set(GENERATED_RUNTIME_DIR ${PROJECT_BINARY_DIR}/runtime)
|
||||
set(GENERATED_SYN_VIM ${GENERATED_RUNTIME_DIR}/syntax/vim/generated.vim)
|
||||
set(GENERATED_HELP_TAGS ${GENERATED_RUNTIME_DIR}/doc/tags)
|
||||
set(GENERATED_PACKAGE_DIR ${GENERATED_RUNTIME_DIR}/pack/dist/opt)
|
||||
set(FUNCS_DATA ${PROJECT_BINARY_DIR}/funcs_data.mpack)
|
||||
|
||||
file(MAKE_DIRECTORY ${GENERATED_RUNTIME_DIR})
|
||||
file(MAKE_DIRECTORY ${GENERATED_RUNTIME_DIR}/syntax)
|
||||
@@ -10,13 +11,14 @@ file(MAKE_DIRECTORY ${GENERATED_RUNTIME_DIR}/syntax/vim)
|
||||
|
||||
add_custom_command(OUTPUT ${GENERATED_SYN_VIM}
|
||||
COMMAND ${LUA_PRG} ${SYN_VIM_GENERATOR}
|
||||
${PROJECT_SOURCE_DIR}/src/nvim ${GENERATED_SYN_VIM}
|
||||
${PROJECT_SOURCE_DIR}/src/nvim ${GENERATED_SYN_VIM} ${FUNCS_DATA}
|
||||
DEPENDS
|
||||
${SYN_VIM_GENERATOR}
|
||||
${PROJECT_SOURCE_DIR}/src/nvim/ex_cmds.lua
|
||||
${PROJECT_SOURCE_DIR}/src/nvim/auevents.lua
|
||||
${PROJECT_SOURCE_DIR}/src/nvim/options.lua
|
||||
${PROJECT_SOURCE_DIR}/src/nvim/eval.c
|
||||
${FUNCS_DATA}
|
||||
)
|
||||
|
||||
if(POLICY CMP0054)
|
||||
|
@@ -9,49 +9,65 @@ function! s:enhance_syntax() abort
|
||||
highlight link healthInfo ModeMsg
|
||||
|
||||
syntax keyword healthSuccess SUCCESS
|
||||
highlight link healthSuccess Function
|
||||
highlight link healthSuccess ModeMsg
|
||||
|
||||
syntax keyword healthSuggestion SUGGESTION
|
||||
syntax keyword healthSuggestion SUGGESTIONS
|
||||
highlight link healthSuggestion String
|
||||
|
||||
syntax match healthHelp "|.\{-}|" contains=healthBar
|
||||
syntax match healthBar "|" contained conceal
|
||||
highlight link healthHelp Identifier
|
||||
|
||||
" We do not care about markdown syntax errors in :CheckHealth output.
|
||||
highlight! link markdownError Normal
|
||||
|
||||
" We don't need code blocks.
|
||||
silent! syntax clear markdownCodeBlock
|
||||
endfunction
|
||||
|
||||
" Runs the specified healthchecks.
|
||||
" Runs all discovered healthchecks if a:plugin_names is empty.
|
||||
function! health#check(plugin_names) abort
|
||||
let report = ''
|
||||
|
||||
let healthchecks = empty(a:plugin_names)
|
||||
\ ? s:discover_health_checks()
|
||||
\ : s:to_fn_names(a:plugin_names)
|
||||
|
||||
tabnew
|
||||
setlocal wrap breakindent
|
||||
setlocal filetype=markdown bufhidden=wipe
|
||||
setlocal conceallevel=2 concealcursor=nc
|
||||
setlocal keywordprg=:help
|
||||
call s:enhance_syntax()
|
||||
|
||||
if empty(healthchecks)
|
||||
let report = "ERROR: No healthchecks found."
|
||||
call setline(1, 'ERROR: No healthchecks found.')
|
||||
else
|
||||
redraw|echo 'Running healthchecks...'
|
||||
for c in healthchecks
|
||||
let report .= printf("\n%s\n%s", c, repeat('=',80))
|
||||
let output = ''
|
||||
call append('$', split(printf("\n%s\n%s", c, repeat('=',72)), "\n"))
|
||||
try
|
||||
let report .= execute('call '.c.'()')
|
||||
catch /^Vim\%((\a\+)\)\=:E117/
|
||||
let report .= execute(
|
||||
\ 'call health#report_error(''No healthcheck found for "'
|
||||
\ .s:to_plugin_name(c)
|
||||
\ .'" plugin.'')')
|
||||
let output = "\n\n".execute('call '.c.'()')
|
||||
catch
|
||||
let report .= execute(
|
||||
\ 'call health#report_error(''Failed to run healthcheck for "'
|
||||
\ .s:to_plugin_name(c)
|
||||
\ .'" plugin. Exception:''."\n".v:exception)')
|
||||
if v:exception =~# '^Vim\%((\a\+)\)\=:E117.*\V'.c
|
||||
let output = execute(
|
||||
\ 'call health#report_error(''No healthcheck found for "'
|
||||
\ .s:to_plugin_name(c)
|
||||
\ .'" plugin.'')')
|
||||
else
|
||||
let output = execute(
|
||||
\ 'call health#report_error(''Failed to run healthcheck for "'
|
||||
\ .s:to_plugin_name(c)
|
||||
\ .'" plugin. Exception:''."\n".v:throwpoint."\n".v:exception)')
|
||||
endif
|
||||
endtry
|
||||
let report .= "\n"
|
||||
call append('$', split(output, "\n") + [''])
|
||||
redraw
|
||||
endfor
|
||||
endif
|
||||
|
||||
tabnew
|
||||
setlocal bufhidden=wipe
|
||||
set filetype=markdown
|
||||
call s:enhance_syntax()
|
||||
call setline(1, split(report, "\n"))
|
||||
setlocal nomodified
|
||||
redraw|echo ''
|
||||
endfunction
|
||||
|
||||
" Starts a new report.
|
||||
@@ -71,6 +87,11 @@ function! s:indent_after_line1(s, columns) abort
|
||||
return join(lines, "\n")
|
||||
endfunction
|
||||
|
||||
" Changes ':help clipboard' to '|clipoard|'. Also removes surrounding quotes.
|
||||
function! s:help_to_link(s) abort
|
||||
return substitute(a:s, '\v[''"]?:h%[elp] ([^''"]+)[''"]?', '|\1|', 'g')
|
||||
endfunction
|
||||
|
||||
" Format a message for a specific report item
|
||||
function! s:format_report_message(status, msg, ...) abort " {{{
|
||||
let output = ' - ' . a:status . ': ' . s:indent_after_line1(a:msg, 4)
|
||||
@@ -86,13 +107,13 @@ function! s:format_report_message(status, msg, ...) abort " {{{
|
||||
|
||||
" Report each suggestion
|
||||
if len(suggestions) > 0
|
||||
let output .= "\n - SUGGESTIONS:"
|
||||
let output .= "\n - SUGGESTIONS:"
|
||||
endif
|
||||
for suggestion in suggestions
|
||||
let output .= "\n - " . s:indent_after_line1(suggestion, 10)
|
||||
let output .= "\n - " . s:indent_after_line1(suggestion, 10)
|
||||
endfor
|
||||
|
||||
return output
|
||||
return s:help_to_link(output)
|
||||
endfunction " }}}
|
||||
|
||||
" Use {msg} to report information in the current section
|
||||
|
@@ -1,152 +1,20 @@
|
||||
let s:bad_responses = [
|
||||
\ 'unable to parse python response',
|
||||
\ 'unable to parse',
|
||||
\ 'unable to get pypi response',
|
||||
\ 'unable to get neovim executable',
|
||||
\ 'unable to find neovim version'
|
||||
\ ]
|
||||
let s:suggest_faq = 'See https://github.com/neovim/neovim/wiki/FAQ'
|
||||
|
||||
function! s:is_bad_response(s) abort
|
||||
return index(s:bad_responses, a:s) >= 0
|
||||
endfunction
|
||||
|
||||
function! s:trim(s) abort
|
||||
return substitute(a:s, '^\_s*\|\_s*$', '', 'g')
|
||||
endfunction
|
||||
|
||||
" Simple version comparison.
|
||||
function! s:version_cmp(a, b) abort
|
||||
let a = split(a:a, '\.')
|
||||
let b = split(a:b, '\.')
|
||||
|
||||
for i in range(len(a))
|
||||
if a[i] > b[i]
|
||||
return 1
|
||||
elseif a[i] < b[i]
|
||||
return -1
|
||||
endif
|
||||
endfor
|
||||
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
" Fetch the contents of a URL.
|
||||
function! s:download(url) abort
|
||||
let content = ''
|
||||
if executable('curl')
|
||||
let content = system(['curl', '-sL', "'", a:url, "'"])
|
||||
function! s:check_config() abort
|
||||
call health#report_start('Configuration')
|
||||
let sensible_pi = globpath(&runtimepath, '**/sensible.vim', 1, 1)
|
||||
if empty(sensible_pi)
|
||||
call health#report_ok('no issues found')
|
||||
else
|
||||
call health#report_info("found sensible.vim plugin:\n".join(sensible_pi, "\n"))
|
||||
call health#report_error("sensible.vim plugin is not needed; Nvim has the same defaults built-in."
|
||||
\ ." Also, sensible.vim sets 'ttimeoutlen' to a sub-optimal value.",
|
||||
\ ["Remove sensible.vim plugin, or wrap it in a `if !has('nvim')` check."])
|
||||
endif
|
||||
|
||||
if empty(content) && executable('python')
|
||||
let script = "
|
||||
\try:\n
|
||||
\ from urllib.request import urlopen\n
|
||||
\except ImportError:\n
|
||||
\ from urllib2 import urlopen\n
|
||||
\\n
|
||||
\try:\n
|
||||
\ response = urlopen('".a:url."')\n
|
||||
\ print(response.read().decode('utf8'))\n
|
||||
\except Exception:\n
|
||||
\ pass\n
|
||||
\"
|
||||
let content = system(['python', '-c', "'", script, "'", '2>/dev/null'])
|
||||
endif
|
||||
|
||||
return content
|
||||
endfunction
|
||||
|
||||
|
||||
" Get the latest Neovim Python client version from PyPI. Result is cached.
|
||||
function! s:latest_pypi_version() abort
|
||||
if exists('s:pypi_version')
|
||||
return s:pypi_version
|
||||
endif
|
||||
|
||||
let s:pypi_version = 'unable to get pypi response'
|
||||
let pypi_info = s:download('https://pypi.python.org/pypi/neovim/json')
|
||||
if !empty(pypi_info)
|
||||
let pypi_data = json_decode(pypi_info)
|
||||
let s:pypi_version = get(get(pypi_data, 'info', {}), 'version', 'unable to parse')
|
||||
return s:pypi_version
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Get version information using the specified interpreter. The interpreter is
|
||||
" used directly in case breaking changes were introduced since the last time
|
||||
" Neovim's Python client was updated.
|
||||
"
|
||||
" Returns [
|
||||
" python executable version,
|
||||
" current nvim version,
|
||||
" current pypi nvim status,
|
||||
" installed version status
|
||||
" ]
|
||||
function! s:version_info(python) abort
|
||||
let pypi_version = s:latest_pypi_version()
|
||||
let python_version = s:trim(system([
|
||||
\ a:python,
|
||||
\ '-c',
|
||||
\ 'import sys; print(".".join(str(x) for x in sys.version_info[:3]))',
|
||||
\ ]))
|
||||
|
||||
if empty(python_version)
|
||||
let python_version = 'unable to parse python response'
|
||||
endif
|
||||
|
||||
let nvim_path = s:trim(system([
|
||||
\ a:python,
|
||||
\ '-c',
|
||||
\ 'import neovim; print(neovim.__file__)',
|
||||
\ '2>/dev/null']))
|
||||
|
||||
let nvim_path = s:trim(system([
|
||||
\ 'python3',
|
||||
\ '-c',
|
||||
\ 'import neovim; print(neovim.__file__)'
|
||||
\ ]))
|
||||
" \ '2>/dev/null']))
|
||||
|
||||
if empty(nvim_path)
|
||||
return [python_version, 'unable to find neovim executable', pypi_version, 'unable to get neovim executable']
|
||||
endif
|
||||
|
||||
let nvim_version = 'unable to find neovim version'
|
||||
let base = fnamemodify(nvim_path, ':h')
|
||||
for meta in glob(base.'-*/METADATA', 1, 1) + glob(base.'-*/PKG-INFO', 1, 1)
|
||||
for meta_line in readfile(meta)
|
||||
if meta_line =~# '^Version:'
|
||||
let nvim_version = matchstr(meta_line, '^Version: \zs\S\+')
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
||||
let version_status = 'unknown'
|
||||
if !s:is_bad_response(nvim_version) && !s:is_bad_response(pypi_version)
|
||||
if s:version_cmp(nvim_version, pypi_version) == -1
|
||||
let version_status = 'outdated'
|
||||
else
|
||||
let version_status = 'up to date'
|
||||
endif
|
||||
endif
|
||||
|
||||
return [python_version, nvim_version, pypi_version, version_status]
|
||||
endfunction
|
||||
|
||||
" Check the Python interpreter's usability.
|
||||
function! s:check_bin(bin) abort
|
||||
if !filereadable(a:bin)
|
||||
call health#report_error(printf('"%s" was not found.', a:bin))
|
||||
return 0
|
||||
elseif executable(a:bin) != 1
|
||||
call health#report_error(printf('"%s" is not executable.', a:bin))
|
||||
return 0
|
||||
endif
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
" Load the remote plugin manifest file and check for unregistered plugins
|
||||
function! s:check_manifest() abort
|
||||
function! s:check_rplugin_manifest() abort
|
||||
call health#report_start('Remote Plugins')
|
||||
let existing_rplugins = {}
|
||||
|
||||
@@ -204,236 +72,87 @@ function! s:check_manifest() abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:check_performance() abort
|
||||
call health#report_start('Performance')
|
||||
|
||||
function! s:check_python(version) abort
|
||||
call health#report_start('Python ' . a:version . ' provider')
|
||||
|
||||
let python_bin_name = 'python'.(a:version == 2 ? '2' : '3')
|
||||
let pyenv = resolve(exepath('pyenv'))
|
||||
let pyenv_root = exists('$PYENV_ROOT') ? resolve($PYENV_ROOT) : 'n'
|
||||
let venv = exists('$VIRTUAL_ENV') ? resolve($VIRTUAL_ENV) : ''
|
||||
let host_prog_var = python_bin_name.'_host_prog'
|
||||
let host_skip_var = python_bin_name.'_host_skip_check'
|
||||
let python_bin = ''
|
||||
let python_multiple = []
|
||||
|
||||
if exists('g:'.host_prog_var)
|
||||
call health#report_info(printf('Using: g:%s = "%s"', host_prog_var, get(g:, host_prog_var)))
|
||||
endif
|
||||
|
||||
let [python_bin_name, pythonx_errs] = provider#pythonx#Detect(a:version)
|
||||
if empty(python_bin_name)
|
||||
call health#report_warn('No Python interpreter was found with the neovim '
|
||||
\ . 'module. Using the first available for diagnostics.')
|
||||
if !empty(pythonx_errs)
|
||||
call health#report_warn(pythonx_errs)
|
||||
endif
|
||||
let old_skip = get(g:, host_skip_var, 0)
|
||||
let g:[host_skip_var] = 1
|
||||
let [python_bin_name, pythonx_errs] = provider#pythonx#Detect(a:version)
|
||||
let g:[host_skip_var] = old_skip
|
||||
endif
|
||||
|
||||
if !empty(python_bin_name)
|
||||
if exists('g:'.host_prog_var)
|
||||
let python_bin = exepath(python_bin_name)
|
||||
endif
|
||||
let python_bin_name = fnamemodify(python_bin_name, ':t')
|
||||
endif
|
||||
|
||||
if !empty(pythonx_errs)
|
||||
call health#report_error('Python provider error', pythonx_errs)
|
||||
endif
|
||||
|
||||
if !empty(python_bin_name) && empty(python_bin) && empty(pythonx_errs)
|
||||
if !exists('g:'.host_prog_var)
|
||||
call health#report_info(printf('`g:%s` is not set. Searching for '
|
||||
\ . '%s in the environment.', host_prog_var, python_bin_name))
|
||||
endif
|
||||
|
||||
if !empty(pyenv)
|
||||
if empty(pyenv_root)
|
||||
call health#report_warn(
|
||||
\ 'pyenv was found, but $PYENV_ROOT is not set.',
|
||||
\ ['Did you follow the final install instructions?']
|
||||
\ )
|
||||
else
|
||||
call health#report_ok(printf('pyenv found: "%s"', pyenv))
|
||||
endif
|
||||
|
||||
let python_bin = s:trim(system(
|
||||
\ printf('"%s" which %s 2>/dev/null', pyenv, python_bin_name)))
|
||||
|
||||
if empty(python_bin)
|
||||
call health#report_warn(printf('pyenv couldn''t find %s.', python_bin_name))
|
||||
endif
|
||||
endif
|
||||
|
||||
if empty(python_bin)
|
||||
let python_bin = exepath(python_bin_name)
|
||||
|
||||
if exists('$PATH')
|
||||
for path in split($PATH, ':')
|
||||
let path_bin = path.'/'.python_bin_name
|
||||
if path_bin != python_bin && index(python_multiple, path_bin) == -1
|
||||
\ && executable(path_bin)
|
||||
call add(python_multiple, path_bin)
|
||||
endif
|
||||
endfor
|
||||
|
||||
if len(python_multiple)
|
||||
" This is worth noting since the user may install something
|
||||
" that changes $PATH, like homebrew.
|
||||
call health#report_info(printf('There are multiple %s executables found. '
|
||||
\ . 'Set "g:%s" to avoid surprises.', python_bin_name, host_prog_var))
|
||||
endif
|
||||
|
||||
if python_bin =~# '\<shims\>'
|
||||
call health#report_warn(printf('"%s" appears to be a pyenv shim.', python_bin), [
|
||||
\ 'The "pyenv" executable is not in $PATH,',
|
||||
\ 'Your pyenv installation is broken. You should set '
|
||||
\ . '"g:'.host_prog_var.'" to avoid surprises.',
|
||||
\ ])
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
if !empty(python_bin)
|
||||
if empty(venv) && !empty(pyenv) && !exists('g:'.host_prog_var)
|
||||
\ && !empty(pyenv_root) && resolve(python_bin) !~# '^'.pyenv_root.'/'
|
||||
call health#report_warn('pyenv is not set up optimally.', [
|
||||
\ printf('Suggestion: Create a virtualenv specifically '
|
||||
\ . 'for Neovim using pyenv and use "g:%s". This will avoid '
|
||||
\ . 'the need to install Neovim''s Python client in each '
|
||||
\ . 'version/virtualenv.', host_prog_var)
|
||||
\ ])
|
||||
elseif !empty(venv) && exists('g:'.host_prog_var)
|
||||
if !empty(pyenv_root)
|
||||
let venv_root = pyenv_root
|
||||
else
|
||||
let venv_root = fnamemodify(venv, ':h')
|
||||
endif
|
||||
|
||||
if resolve(python_bin) !~# '^'.venv_root.'/'
|
||||
call health#report_warn('Your virtualenv is not set up optimally.', [
|
||||
\ printf('Suggestion: Create a virtualenv specifically '
|
||||
\ . 'for Neovim and use "g:%s". This will avoid '
|
||||
\ . 'the need to install Neovim''s Python client in each '
|
||||
\ . 'virtualenv.', host_prog_var)
|
||||
\ ])
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
if empty(python_bin) && !empty(python_bin_name)
|
||||
" An error message should have already printed.
|
||||
call health#report_error(printf('"%s" was not found.', python_bin_name))
|
||||
elseif !empty(python_bin) && !s:check_bin(python_bin)
|
||||
let python_bin = ''
|
||||
endif
|
||||
|
||||
" Check if $VIRTUAL_ENV is active
|
||||
let virtualenv_inactive = 0
|
||||
|
||||
if exists('$VIRTUAL_ENV')
|
||||
if !empty(pyenv)
|
||||
let pyenv_prefix = resolve(s:trim(system([pyenv, 'prefix'])))
|
||||
if $VIRTUAL_ENV != pyenv_prefix
|
||||
let virtualenv_inactive = 1
|
||||
endif
|
||||
elseif !empty(python_bin_name) && exepath(python_bin_name) !~# '^'.$VIRTUAL_ENV.'/'
|
||||
let virtualenv_inactive = 1
|
||||
endif
|
||||
endif
|
||||
|
||||
if virtualenv_inactive
|
||||
let suggestions = [
|
||||
\ 'If you are using Zsh, see: http://vi.stackexchange.com/a/7654/5229',
|
||||
\ ]
|
||||
" check buildtype
|
||||
let buildtype = matchstr(execute('version'), '\v\cbuild type:?\s*[^\n\r\t ]+')
|
||||
if empty(buildtype)
|
||||
call health#report_error('failed to get build type from :version')
|
||||
elseif buildtype =~# '\v(MinSizeRel|Release|RelWithDebInfo)'
|
||||
call health#report_ok(buildtype)
|
||||
else
|
||||
call health#report_info(buildtype)
|
||||
call health#report_warn(
|
||||
\ '$VIRTUAL_ENV exists but appears to be inactive. '
|
||||
\ . 'This could lead to unexpected results.',
|
||||
\ suggestions)
|
||||
\ "Non-optimized build-type. Nvim will be slower.",
|
||||
\ ["Install a different Nvim package, or rebuild with `CMAKE_BUILD_TYPE=RelWithDebInfo`.",
|
||||
\ s:suggest_faq])
|
||||
endif
|
||||
|
||||
" Diagnostic output
|
||||
call health#report_info('Executable: ' . (empty(python_bin) ? 'Not found' : python_bin))
|
||||
if len(python_multiple)
|
||||
for path_bin in python_multiple
|
||||
call health#report_info('Other python executable: ' . path_bin)
|
||||
endfor
|
||||
endif
|
||||
|
||||
if !empty(python_bin)
|
||||
let [pyversion, current, latest, status] = s:version_info(python_bin)
|
||||
if a:version != str2nr(pyversion)
|
||||
call health#report_warn('Got an unexpected version of Python.' .
|
||||
\ ' This could lead to confusing error messages.')
|
||||
endif
|
||||
if a:version == 3 && str2float(pyversion) < 3.3
|
||||
call health#report_warn('Python 3.3+ is recommended.')
|
||||
endif
|
||||
|
||||
call health#report_info('Python'.a:version.' version: ' . pyversion)
|
||||
call health#report_info(printf('%s-neovim Version: %s', python_bin_name, current))
|
||||
|
||||
if s:is_bad_response(current)
|
||||
let suggestions = [
|
||||
\ 'Error found was: ' . current,
|
||||
\ 'Use the command `$ pip' . a:version . ' install neovim`',
|
||||
\ ]
|
||||
call health#report_error(
|
||||
\ 'Neovim Python client is not installed.',
|
||||
\ suggestions)
|
||||
endif
|
||||
|
||||
if s:is_bad_response(latest)
|
||||
call health#report_warn('Unable to fetch latest Neovim Python client version.')
|
||||
endif
|
||||
|
||||
if s:is_bad_response(status)
|
||||
call health#report_warn('Latest Neovim Python client versions: ('.latest.')')
|
||||
else
|
||||
call health#report_ok('Latest Neovim Python client is installed: ('.status.')')
|
||||
endif
|
||||
endif
|
||||
|
||||
endfunction
|
||||
|
||||
function! s:check_ruby() abort
|
||||
call health#report_start('Ruby provider')
|
||||
let min_version = "0.2.4"
|
||||
let ruby_version = systemlist('ruby -v')[0]
|
||||
let ruby_prog = provider#ruby#Detect()
|
||||
let suggestions =
|
||||
\ ['Install or upgrade the neovim RubyGem using `gem install neovim`.']
|
||||
function! s:check_tmux() abort
|
||||
if empty($TMUX) || !executable('tmux')
|
||||
return
|
||||
endif
|
||||
call health#report_start('tmux')
|
||||
|
||||
if empty(ruby_prog)
|
||||
let ruby_prog = 'not found'
|
||||
let prog_vers = 'not found'
|
||||
call health#report_error('Missing Neovim RubyGem', suggestions)
|
||||
" check escape-time
|
||||
let suggestions = ["Set escape-time in ~/.tmux.conf:\nset-option -sg escape-time 10",
|
||||
\ s:suggest_faq]
|
||||
let cmd = 'tmux show-option -qvgs escape-time'
|
||||
let out = system(cmd)
|
||||
let tmux_esc_time = substitute(out, '\v(\s|\r|\n)', '', 'g')
|
||||
if v:shell_error
|
||||
call health#report_error('command failed: '.cmd."\n".out)
|
||||
elseif empty(tmux_esc_time)
|
||||
call health#report_error('escape-time is not set', suggestions)
|
||||
elseif tmux_esc_time > 300
|
||||
call health#report_error(
|
||||
\ 'escape-time ('.tmux_esc_time.') is higher than 300ms', suggestions)
|
||||
else
|
||||
silent let prog_vers = systemlist(ruby_prog . ' --version')[0]
|
||||
if v:shell_error
|
||||
let prog_vers = 'outdated'
|
||||
call health#report_warn('Neovim RubyGem is not up-to-date', suggestions)
|
||||
elseif s:version_cmp(prog_vers, min_version) == -1
|
||||
let prog_vers .= ' (outdated)'
|
||||
call health#report_warn('Neovim RubyGem is not up-to-date', suggestions)
|
||||
else
|
||||
call health#report_ok('Found Neovim RubyGem')
|
||||
endif
|
||||
call health#report_ok('escape-time: '.tmux_esc_time.'ms')
|
||||
endif
|
||||
|
||||
call health#report_info('Ruby Version: ' . ruby_version)
|
||||
call health#report_info('Host Executable: ' . ruby_prog)
|
||||
call health#report_info('Host Version: ' . prog_vers)
|
||||
" check $TERM
|
||||
call health#report_info('$TERM: '.$TERM)
|
||||
if $TERM !~# '\v(tmux-256color|screen-256color)'
|
||||
call health#report_error(
|
||||
\ '$TERM should be "screen-256color" or "tmux-256color" when running tmux.',
|
||||
\ ["Set default-terminal in ~/.tmux.conf:\nset-option -g default-terminal \"screen-256color\"",
|
||||
\ s:suggest_faq])
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:check_terminfo() abort
|
||||
if !executable('infocmp')
|
||||
return
|
||||
endif
|
||||
call health#report_start('terminfo')
|
||||
let suggestions = [
|
||||
\ "Set key_backspace to \\177 (ASCII BACKSPACE). Run these commands:\n"
|
||||
\ .'infocmp $TERM | sed ''s/kbs=^[hH]/kbs=\\177/'' > $TERM.ti'
|
||||
\ ."\n"
|
||||
\ .'tic $TERM.ti',
|
||||
\ s:suggest_faq]
|
||||
let cmd = 'infocmp -L'
|
||||
let out = system(cmd)
|
||||
let kbs_entry = matchstr(out, 'key_backspace=\S*')
|
||||
|
||||
if v:shell_error
|
||||
call health#report_error('command failed: '.cmd."\n".out)
|
||||
elseif !empty(matchstr(out, '\Vkey_backspace=^H'))
|
||||
call health#report_error('key_backspace (kbs) entry is ^H (ASCII DELETE): '
|
||||
\ .kbs_entry, suggestions)
|
||||
else
|
||||
call health#report_info('key_backspace terminfo entry: '
|
||||
\ .(empty(kbs_entry) ? '? (not found)' : kbs_entry))
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! health#nvim#check() abort
|
||||
call s:check_manifest()
|
||||
call s:check_python(2)
|
||||
call s:check_python(3)
|
||||
call s:check_ruby()
|
||||
call s:check_config()
|
||||
call s:check_performance()
|
||||
call s:check_rplugin_manifest()
|
||||
call s:check_terminfo()
|
||||
call s:check_tmux()
|
||||
endfunction
|
||||
|
451
runtime/autoload/health/provider.vim
Normal file
451
runtime/autoload/health/provider.vim
Normal file
@@ -0,0 +1,451 @@
|
||||
let s:shell_error = 0
|
||||
|
||||
function! s:is_bad_response(s) abort
|
||||
return a:s =~? '\v(^unable)|(^error)|(^outdated)'
|
||||
endfunction
|
||||
|
||||
function! s:trim(s) abort
|
||||
return substitute(a:s, '^\_s*\|\_s*$', '', 'g')
|
||||
endfunction
|
||||
|
||||
" Simple version comparison.
|
||||
function! s:version_cmp(a, b) abort
|
||||
let a = split(a:a, '\.', 0)
|
||||
let b = split(a:b, '\.', 0)
|
||||
|
||||
for i in range(len(a))
|
||||
if str2nr(a[i]) > str2nr(b[i])
|
||||
return 1
|
||||
elseif str2nr(a[i]) < str2nr(b[i])
|
||||
return -1
|
||||
endif
|
||||
endfor
|
||||
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
" Handler for s:system() function.
|
||||
function! s:system_handler(jobid, data, event) abort
|
||||
if a:event == 'stdout' || a:event == 'stderr'
|
||||
let self.output .= join(a:data, '')
|
||||
elseif a:event == 'exit'
|
||||
let s:shell_error = a:data
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Run a system command and timeout after 30 seconds.
|
||||
function! s:system(cmd, ...) abort
|
||||
let stdin = a:0 ? a:1 : ''
|
||||
let opts = {
|
||||
\ 'output': '',
|
||||
\ 'on_stdout': function('s:system_handler'),
|
||||
\ 'on_stderr': function('s:system_handler'),
|
||||
\ 'on_exit': function('s:system_handler'),
|
||||
\ }
|
||||
let jobid = jobstart(a:cmd, opts)
|
||||
|
||||
if jobid < 1
|
||||
call health#report_error(printf('Command error %d: %s', jobid,
|
||||
\ type(a:cmd) == type([]) ? join(a:cmd) : a:cmd)))
|
||||
let s:shell_error = 1
|
||||
return opts.output
|
||||
endif
|
||||
|
||||
if !empty(stdin)
|
||||
call jobsend(jobid, stdin)
|
||||
endif
|
||||
|
||||
let res = jobwait([jobid], 30000)
|
||||
if res[0] == -1
|
||||
call health#report_error(printf('Command timed out: %s',
|
||||
\ type(a:cmd) == type([]) ? join(a:cmd) : a:cmd))
|
||||
call jobstop(jobid)
|
||||
elseif s:shell_error != 0
|
||||
call health#report_error(printf("Command error (%d) %s: %s", jobid,
|
||||
\ type(a:cmd) == type([]) ? join(a:cmd) : a:cmd,
|
||||
\ opts.output))
|
||||
endif
|
||||
|
||||
return opts.output
|
||||
endfunction
|
||||
|
||||
function! s:systemlist(cmd, ...) abort
|
||||
let stdout = split(s:system(a:cmd, a:0 ? a:1 : ''), "\n")
|
||||
if a:0 > 1 && !empty(a:2)
|
||||
return filter(stdout, '!empty(v:val)')
|
||||
endif
|
||||
return stdout
|
||||
endfunction
|
||||
|
||||
" Fetch the contents of a URL.
|
||||
function! s:download(url) abort
|
||||
if executable('curl')
|
||||
let rv = s:system(['curl', '-sL', a:url])
|
||||
return s:shell_error ? 'curl error: '.s:shell_error : rv
|
||||
elseif executable('python')
|
||||
let script = "
|
||||
\try:\n
|
||||
\ from urllib.request import urlopen\n
|
||||
\except ImportError:\n
|
||||
\ from urllib2 import urlopen\n
|
||||
\\n
|
||||
\response = urlopen('".a:url."')\n
|
||||
\print(response.read().decode('utf8'))\n
|
||||
\"
|
||||
let rv = s:system(['python', '-c', script])
|
||||
return empty(rv) && s:shell_error
|
||||
\ ? 'python urllib.request error: '.s:shell_error
|
||||
\ : rv
|
||||
endif
|
||||
return 'missing `curl` and `python`, cannot make pypi request'
|
||||
endfunction
|
||||
|
||||
" Check for clipboard tools.
|
||||
function! s:check_clipboard() abort
|
||||
call health#report_start('Clipboard')
|
||||
|
||||
let clipboard_tool = provider#clipboard#Executable()
|
||||
if empty(clipboard_tool)
|
||||
call health#report_warn(
|
||||
\ "No clipboard tool found. Using the system clipboard won't work.",
|
||||
\ ['See |clipboard|.'])
|
||||
else
|
||||
call health#report_ok('Clipboard tool found: '. clipboard_tool)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Get the latest Neovim Python client version from PyPI.
|
||||
function! s:latest_pypi_version() abort
|
||||
let pypi_version = 'unable to get pypi response'
|
||||
let pypi_response = s:download('https://pypi.python.org/pypi/neovim/json')
|
||||
if !empty(pypi_response)
|
||||
try
|
||||
let pypi_data = json_decode(pypi_response)
|
||||
catch /E474/
|
||||
return 'error: '.pypi_response
|
||||
endtry
|
||||
let pypi_version = get(get(pypi_data, 'info', {}), 'version', 'unable to parse')
|
||||
endif
|
||||
return pypi_version
|
||||
endfunction
|
||||
|
||||
" Get version information using the specified interpreter. The interpreter is
|
||||
" used directly in case breaking changes were introduced since the last time
|
||||
" Neovim's Python client was updated.
|
||||
"
|
||||
" Returns: [
|
||||
" {python executable version},
|
||||
" {current nvim version},
|
||||
" {current pypi nvim status},
|
||||
" {installed version status}
|
||||
" ]
|
||||
function! s:version_info(python) abort
|
||||
let pypi_version = s:latest_pypi_version()
|
||||
let python_version = s:trim(s:system([
|
||||
\ a:python,
|
||||
\ '-c',
|
||||
\ 'import sys; print(".".join(str(x) for x in sys.version_info[:3]))',
|
||||
\ ]))
|
||||
|
||||
if empty(python_version)
|
||||
let python_version = 'unable to parse python response'
|
||||
endif
|
||||
|
||||
let nvim_path = s:trim(s:system([
|
||||
\ a:python,
|
||||
\ '-c',
|
||||
\ 'import neovim; print(neovim.__file__)']))
|
||||
let nvim_path = s:shell_error ? '' : nvim_path
|
||||
|
||||
if empty(nvim_path)
|
||||
return [python_version, 'unable to find nvim executable', pypi_version, 'unable to get nvim executable']
|
||||
endif
|
||||
|
||||
" Assuming that multiple versions of a package are installed, sort them
|
||||
" numerically in descending order.
|
||||
function! s:compare(metapath1, metapath2)
|
||||
let a = matchstr(fnamemodify(a:metapath1, ':p:h:t'), '[0-9.]\+')
|
||||
let b = matchstr(fnamemodify(a:metapath2, ':p:h:t'), '[0-9.]\+')
|
||||
return a == b ? 0 : a > b ? 1 : -1
|
||||
endfunction
|
||||
|
||||
let nvim_version = 'unable to find nvim version'
|
||||
let base = fnamemodify(nvim_path, ':h')
|
||||
let metas = glob(base.'-*/METADATA', 1, 1) + glob(base.'-*/PKG-INFO', 1, 1)
|
||||
let metas = sort(metas, 's:compare')
|
||||
|
||||
if !empty(metas)
|
||||
for meta_line in readfile(metas[0])
|
||||
if meta_line =~# '^Version:'
|
||||
let nvim_version = matchstr(meta_line, '^Version: \zs\S\+')
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
let version_status = 'unknown'
|
||||
if !s:is_bad_response(nvim_version) && !s:is_bad_response(pypi_version)
|
||||
if s:version_cmp(nvim_version, pypi_version) == -1
|
||||
let version_status = 'outdated'
|
||||
else
|
||||
let version_status = 'up to date'
|
||||
endif
|
||||
endif
|
||||
|
||||
return [python_version, nvim_version, pypi_version, version_status]
|
||||
endfunction
|
||||
|
||||
" Check the Python interpreter's usability.
|
||||
function! s:check_bin(bin) abort
|
||||
if !filereadable(a:bin)
|
||||
call health#report_error(printf('"%s" was not found.', a:bin))
|
||||
return 0
|
||||
elseif executable(a:bin) != 1
|
||||
call health#report_error(printf('"%s" is not executable.', a:bin))
|
||||
return 0
|
||||
endif
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! s:check_python(version) abort
|
||||
call health#report_start('Python ' . a:version . ' provider')
|
||||
|
||||
let python_bin_name = 'python'.(a:version == 2 ? '' : '3')
|
||||
let pyenv = resolve(exepath('pyenv'))
|
||||
let pyenv_root = exists('$PYENV_ROOT') ? resolve($PYENV_ROOT) : 'n'
|
||||
let venv = exists('$VIRTUAL_ENV') ? resolve($VIRTUAL_ENV) : ''
|
||||
let host_prog_var = python_bin_name.'_host_prog'
|
||||
let host_skip_var = python_bin_name.'_host_skip_check'
|
||||
let python_bin = ''
|
||||
let python_multiple = []
|
||||
|
||||
if exists('g:'.host_prog_var)
|
||||
call health#report_info(printf('Using: g:%s = "%s"', host_prog_var, get(g:, host_prog_var)))
|
||||
endif
|
||||
|
||||
let [python_bin_name, pythonx_errs] = provider#pythonx#Detect(a:version)
|
||||
if empty(python_bin_name)
|
||||
call health#report_warn('No Python interpreter was found with the neovim '
|
||||
\ . 'module. Using the first available for diagnostics.')
|
||||
if !empty(pythonx_errs)
|
||||
call health#report_warn(pythonx_errs)
|
||||
endif
|
||||
let old_skip = get(g:, host_skip_var, 0)
|
||||
let g:[host_skip_var] = 1
|
||||
let [python_bin_name, pythonx_errs] = provider#pythonx#Detect(a:version)
|
||||
let g:[host_skip_var] = old_skip
|
||||
endif
|
||||
|
||||
if !empty(python_bin_name)
|
||||
if exists('g:'.host_prog_var)
|
||||
let python_bin = exepath(python_bin_name)
|
||||
endif
|
||||
let python_bin_name = fnamemodify(python_bin_name, ':t')
|
||||
endif
|
||||
|
||||
if !empty(pythonx_errs)
|
||||
call health#report_error('Python provider error', pythonx_errs)
|
||||
endif
|
||||
|
||||
if !empty(python_bin_name) && empty(python_bin) && empty(pythonx_errs)
|
||||
if !exists('g:'.host_prog_var)
|
||||
call health#report_info(printf('`g:%s` is not set. Searching for '
|
||||
\ . '%s in the environment.', host_prog_var, python_bin_name))
|
||||
endif
|
||||
|
||||
if !empty(pyenv)
|
||||
if empty(pyenv_root)
|
||||
call health#report_warn(
|
||||
\ 'pyenv was found, but $PYENV_ROOT is not set.',
|
||||
\ ['Did you follow the final install instructions?']
|
||||
\ )
|
||||
else
|
||||
call health#report_ok(printf('pyenv found: "%s"', pyenv))
|
||||
endif
|
||||
|
||||
let python_bin = s:trim(s:system(
|
||||
\ printf('"%s" which %s 2>/dev/null', pyenv, python_bin_name)))
|
||||
|
||||
if empty(python_bin)
|
||||
call health#report_warn(printf('pyenv couldn''t find %s.', python_bin_name))
|
||||
endif
|
||||
endif
|
||||
|
||||
if empty(python_bin)
|
||||
let python_bin = exepath(python_bin_name)
|
||||
|
||||
if exists('$PATH')
|
||||
for path in split($PATH, ':')
|
||||
let path_bin = path.'/'.python_bin_name
|
||||
if path_bin != python_bin && index(python_multiple, path_bin) == -1
|
||||
\ && executable(path_bin)
|
||||
call add(python_multiple, path_bin)
|
||||
endif
|
||||
endfor
|
||||
|
||||
if len(python_multiple)
|
||||
" This is worth noting since the user may install something
|
||||
" that changes $PATH, like homebrew.
|
||||
call health#report_info(printf('There are multiple %s executables found. '
|
||||
\ . 'Set "g:%s" to avoid surprises.', python_bin_name, host_prog_var))
|
||||
endif
|
||||
|
||||
if python_bin =~# '\<shims\>'
|
||||
call health#report_warn(printf('"%s" appears to be a pyenv shim.', python_bin), [
|
||||
\ 'The "pyenv" executable is not in $PATH,',
|
||||
\ 'Your pyenv installation is broken. You should set '
|
||||
\ . '"g:'.host_prog_var.'" to avoid surprises.',
|
||||
\ ])
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
if !empty(python_bin)
|
||||
if empty(venv) && !empty(pyenv) && !exists('g:'.host_prog_var)
|
||||
\ && !empty(pyenv_root) && resolve(python_bin) !~# '^'.pyenv_root.'/'
|
||||
call health#report_warn('pyenv is not set up optimally.', [
|
||||
\ printf('Suggestion: Create a virtualenv specifically '
|
||||
\ . 'for Neovim using pyenv and use "g:%s". This will avoid '
|
||||
\ . 'the need to install Neovim''s Python client in each '
|
||||
\ . 'version/virtualenv.', host_prog_var)
|
||||
\ ])
|
||||
elseif !empty(venv) && exists('g:'.host_prog_var)
|
||||
if !empty(pyenv_root)
|
||||
let venv_root = pyenv_root
|
||||
else
|
||||
let venv_root = fnamemodify(venv, ':h')
|
||||
endif
|
||||
|
||||
if resolve(python_bin) !~# '^'.venv_root.'/'
|
||||
call health#report_warn('Your virtualenv is not set up optimally.', [
|
||||
\ printf('Suggestion: Create a virtualenv specifically '
|
||||
\ . 'for Neovim and use "g:%s". This will avoid '
|
||||
\ . 'the need to install Neovim''s Python client in each '
|
||||
\ . 'virtualenv.', host_prog_var)
|
||||
\ ])
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
if empty(python_bin) && !empty(python_bin_name)
|
||||
" An error message should have already printed.
|
||||
call health#report_error(printf('"%s" was not found.', python_bin_name))
|
||||
elseif !empty(python_bin) && !s:check_bin(python_bin)
|
||||
let python_bin = ''
|
||||
endif
|
||||
|
||||
" Check if $VIRTUAL_ENV is active
|
||||
let virtualenv_inactive = 0
|
||||
|
||||
if exists('$VIRTUAL_ENV')
|
||||
if !empty(pyenv)
|
||||
let pyenv_prefix = resolve(s:trim(s:system([pyenv, 'prefix'])))
|
||||
if $VIRTUAL_ENV != pyenv_prefix
|
||||
let virtualenv_inactive = 1
|
||||
endif
|
||||
elseif !empty(python_bin_name) && exepath(python_bin_name) !~# '^'.$VIRTUAL_ENV.'/'
|
||||
let virtualenv_inactive = 1
|
||||
endif
|
||||
endif
|
||||
|
||||
if virtualenv_inactive
|
||||
let suggestions = [
|
||||
\ 'If you are using Zsh, see: http://vi.stackexchange.com/a/7654/5229',
|
||||
\ ]
|
||||
call health#report_warn(
|
||||
\ '$VIRTUAL_ENV exists but appears to be inactive. '
|
||||
\ . 'This could lead to unexpected results.',
|
||||
\ suggestions)
|
||||
endif
|
||||
|
||||
" Diagnostic output
|
||||
call health#report_info('Executable: ' . (empty(python_bin) ? 'Not found' : python_bin))
|
||||
if len(python_multiple)
|
||||
for path_bin in python_multiple
|
||||
call health#report_info('Other python executable: ' . path_bin)
|
||||
endfor
|
||||
endif
|
||||
|
||||
if !empty(python_bin)
|
||||
let [pyversion, current, latest, status] = s:version_info(python_bin)
|
||||
if a:version != str2nr(pyversion)
|
||||
call health#report_warn('Got an unexpected version of Python.' .
|
||||
\ ' This could lead to confusing error messages.')
|
||||
endif
|
||||
if a:version == 3 && str2float(pyversion) < 3.3
|
||||
call health#report_warn('Python 3.3+ is recommended.')
|
||||
endif
|
||||
|
||||
call health#report_info('Python'.a:version.' version: ' . pyversion)
|
||||
call health#report_info(printf('%s-neovim version: %s', python_bin_name, current))
|
||||
|
||||
if s:is_bad_response(current)
|
||||
let suggestions = [
|
||||
\ 'Error found was: ' . current,
|
||||
\ 'Use the command `$ pip' . a:version . ' install neovim`',
|
||||
\ ]
|
||||
call health#report_error(
|
||||
\ 'Neovim Python client is not installed.',
|
||||
\ suggestions)
|
||||
endif
|
||||
|
||||
if s:is_bad_response(latest)
|
||||
call health#report_warn('Unable to contact PyPI.')
|
||||
call health#report_error('HTTP request failed: '.latest)
|
||||
endif
|
||||
|
||||
if s:is_bad_response(status)
|
||||
call health#report_warn(printf('Latest %s-neovim is NOT installed: %s',
|
||||
\ python_bin_name, latest))
|
||||
elseif !s:is_bad_response(latest)
|
||||
call health#report_ok(printf('Latest %s-neovim is installed: %s',
|
||||
\ python_bin_name, latest))
|
||||
endif
|
||||
endif
|
||||
|
||||
endfunction
|
||||
|
||||
function! s:check_ruby() abort
|
||||
call health#report_start('Ruby provider')
|
||||
let ruby_version = 'not found'
|
||||
if executable('ruby')
|
||||
let ruby_version = s:systemlist('ruby -v')[0]
|
||||
endif
|
||||
let ruby_prog = provider#ruby#Detect()
|
||||
let suggestions =
|
||||
\ ['Install or upgrade the neovim RubyGem using `gem install neovim`.']
|
||||
|
||||
if empty(ruby_prog)
|
||||
let ruby_prog = 'not found'
|
||||
let prog_vers = 'not found'
|
||||
call health#report_error('Missing Neovim RubyGem', suggestions)
|
||||
else
|
||||
silent let latest_gem = get(s:systemlist("gem list -ra '^neovim$' 2>/dev/null | " .
|
||||
\ "awk -F'[()]' '{print $2}' | " .
|
||||
\ 'cut -d, -f1'), 0, 'not found')
|
||||
let latest_desc = ' (latest: ' . latest_gem . ')'
|
||||
|
||||
silent let prog_vers = s:systemlist(ruby_prog . ' --version')[0]
|
||||
if s:shell_error
|
||||
let prog_vers = 'not found' . latest_desc
|
||||
call health#report_warn('Neovim RubyGem is not up-to-date.', suggestions)
|
||||
elseif s:version_cmp(prog_vers, latest_gem) == -1
|
||||
let prog_vers .= latest_desc
|
||||
call health#report_warn('Neovim RubyGem is not up-to-date.', suggestions)
|
||||
else
|
||||
call health#report_ok('Found up-to-date neovim RubyGem')
|
||||
endif
|
||||
endif
|
||||
|
||||
call health#report_info('Ruby Version: ' . ruby_version)
|
||||
call health#report_info('Host Executable: ' . ruby_prog)
|
||||
call health#report_info('Host Version: ' . prog_vers)
|
||||
endfunction
|
||||
|
||||
function! health#provider#check() abort
|
||||
call s:check_clipboard()
|
||||
call s:check_python(2)
|
||||
call s:check_python(3)
|
||||
call s:check_ruby()
|
||||
endfunction
|
@@ -1,19 +1,15 @@
|
||||
" Maintainer: Anmol Sethi <anmol@aubble.com>
|
||||
|
||||
" Ensure Vim is not recursively invoked (man-db does this)
|
||||
" by forcing man to use cat as the pager.
|
||||
" More info here http://comments.gmane.org/gmane.editors.vim.devel/29085
|
||||
if &shell =~# 'fish$'
|
||||
let s:man_cmd = 'man -P cat ^/dev/null'
|
||||
let s:man_cmd = 'man ^/dev/null'
|
||||
else
|
||||
let s:man_cmd = 'man -P cat 2>/dev/null'
|
||||
let s:man_cmd = 'man 2>/dev/null'
|
||||
endif
|
||||
|
||||
let s:man_find_arg = "-w"
|
||||
|
||||
" TODO(nhooyr) I do not think completion will work on SunOS because I'm not sure if `man -l`
|
||||
" displays the list of directories that are searched by man for manpages.
|
||||
" I also do not think Solaris supports the '-P' flag used above and uses only $PAGER.
|
||||
" TODO(nhooyr) Completion may work on SunOS; I'm not sure if `man -l` displays
|
||||
" the list of searched directories.
|
||||
try
|
||||
if !has('win32') && $OSTYPE !~? 'cygwin\|linux' && system('uname -s') =~? 'SunOS' && system('uname -r') =~# '^5'
|
||||
let s:man_find_arg = '-l'
|
||||
@@ -22,77 +18,71 @@ catch /E145:/
|
||||
" Ignore the error in restricted mode
|
||||
endtry
|
||||
|
||||
" We need count and count1 to ensure the section was explicitly set
|
||||
" by the user. count defaults to 0 which is a valid section and
|
||||
" count1 defaults to 1 which is also a valid section. Only when they
|
||||
" are equal was the count explicitly set.
|
||||
function! man#open_page(count, count1, ...) abort
|
||||
function! man#open_page(count, count1, mods, ...) abort
|
||||
if a:0 > 2
|
||||
call s:error('too many arguments')
|
||||
return
|
||||
elseif a:0 ==# 1
|
||||
if empty(a:1)
|
||||
elseif a:0 == 0
|
||||
let ref = &filetype ==# 'man' ? expand('<cWORD>') : expand('<cword>')
|
||||
if empty(ref)
|
||||
call s:error('no identifier under cursor')
|
||||
return
|
||||
endif
|
||||
elseif a:0 ==# 1
|
||||
let ref = a:1
|
||||
else
|
||||
" We combine the name and sect into a manpage reference so that all
|
||||
" Combine the name and sect into a manpage reference so that all
|
||||
" verification/extraction can be kept in a single function.
|
||||
" If a:2 is a reference as well, that is fine because it is the only
|
||||
" reference that will match.
|
||||
let ref = a:2.'('.a:1.')'
|
||||
endif
|
||||
try
|
||||
let [sect, name] = s:extract_sect_and_name_ref(ref)
|
||||
let [sect, name] = man#extract_sect_and_name_ref(ref)
|
||||
if a:count ==# a:count1
|
||||
" user explicitly set a count
|
||||
" v:count defaults to 0 which is a valid section, and v:count1 defaults to
|
||||
" 1, also a valid section. If they are equal, count explicitly set.
|
||||
let sect = string(a:count)
|
||||
endif
|
||||
let [sect, name] = s:verify_exists(sect, name)
|
||||
let [sect, name, path] = s:verify_exists(sect, name)
|
||||
catch
|
||||
call s:error(v:exception)
|
||||
return
|
||||
endtry
|
||||
call s:push_tag()
|
||||
let bufname = 'man://'.name.(empty(sect)?'':'('.sect.')')
|
||||
let found_man = s:find_man()
|
||||
if getbufvar(bufname, 'manwidth') ==# s:manwidth()
|
||||
if found_man
|
||||
silent execute 'buf' bufnr(bufname)
|
||||
else
|
||||
execute 'split' bufname
|
||||
endif
|
||||
keepjumps 1
|
||||
return
|
||||
endif
|
||||
if found_man
|
||||
noautocmd execute 'edit' bufname
|
||||
if a:mods !~# 'tab' && s:find_man()
|
||||
noautocmd execute 'silent edit' fnameescape(bufname)
|
||||
else
|
||||
noautocmd execute 'split' bufname
|
||||
noautocmd execute 'silent' a:mods 'split' fnameescape(bufname)
|
||||
endif
|
||||
call s:read_page(sect, name)
|
||||
let b:man_sect = sect
|
||||
call s:read_page(path)
|
||||
endfunction
|
||||
|
||||
function! man#read_page(ref) abort
|
||||
try
|
||||
let [sect, name] = s:extract_sect_and_name_ref(a:ref)
|
||||
let [sect, name] = s:verify_exists(sect, name)
|
||||
let [sect, name] = man#extract_sect_and_name_ref(a:ref)
|
||||
let [b:man_sect, name, path] = s:verify_exists(sect, name)
|
||||
catch
|
||||
call s:error(v:exception)
|
||||
" call to s:error() is unnecessary
|
||||
return
|
||||
endtry
|
||||
call s:read_page(sect, name)
|
||||
call s:read_page(path)
|
||||
endfunction
|
||||
|
||||
function! s:read_page(sect, name) abort
|
||||
function! s:read_page(path) abort
|
||||
setlocal modifiable
|
||||
setlocal noreadonly
|
||||
keepjumps %delete _
|
||||
let b:manwidth = s:manwidth()
|
||||
silent execute 'read!env MANWIDTH='.b:manwidth s:man_cmd s:man_args(a:sect, a:name)
|
||||
" remove all the backspaced text
|
||||
silent execute 'keeppatterns keepjumps %substitute,.\b,,e'.(&gdefault?'':'g')
|
||||
silent keepjumps %delete _
|
||||
" Force MANPAGER=cat to ensure Vim is not recursively invoked (by man-db).
|
||||
" http://comments.gmane.org/gmane.editors.vim.devel/29085
|
||||
" Respect $MANWIDTH, or default to window width.
|
||||
let cmd = 'env MANPAGER=cat'.(empty($MANWIDTH) ? ' MANWIDTH='.winwidth(0) : '')
|
||||
let cmd .= ' '.s:man_cmd.' '.shellescape(a:path)
|
||||
silent put =system(cmd)
|
||||
" Remove all backspaced characters.
|
||||
execute 'silent keeppatterns keepjumps %substitute,.\b,,e'.(&gdefault?'':'g')
|
||||
while getline(1) =~# '^\s*$'
|
||||
silent keepjumps 1delete _
|
||||
endwhile
|
||||
@@ -101,17 +91,17 @@ endfunction
|
||||
|
||||
" attempt to extract the name and sect out of 'name(sect)'
|
||||
" otherwise just return the largest string of valid characters in ref
|
||||
function! s:extract_sect_and_name_ref(ref) abort
|
||||
function! man#extract_sect_and_name_ref(ref) abort
|
||||
if a:ref[0] ==# '-' " try ':Man -pandoc' with this disabled.
|
||||
throw 'manpage name starts with ''-'''
|
||||
throw 'manpage name cannot start with ''-'''
|
||||
endif
|
||||
let ref = matchstr(a:ref, '[^()]\+([^()]\+)')
|
||||
if empty(ref)
|
||||
let name = matchstr(a:ref, '[^()]\+')
|
||||
if empty(name)
|
||||
throw 'manpage reference contains only parantheses'
|
||||
throw 'manpage reference cannot contain only parentheses'
|
||||
endif
|
||||
return ['', name]
|
||||
return [get(b:, 'man_default_sects', ''), name]
|
||||
endif
|
||||
let left = split(ref, '(')
|
||||
" see ':Man 3X curses' on why tolower.
|
||||
@@ -120,21 +110,29 @@ function! s:extract_sect_and_name_ref(ref) abort
|
||||
return [tolower(split(left[1], ')')[0]), left[0]]
|
||||
endfunction
|
||||
|
||||
function! s:verify_exists(sect, name) abort
|
||||
let path = system(s:man_cmd.' '.s:man_find_arg.' '.s:man_args(a:sect, a:name))
|
||||
if path !~# '^\/'
|
||||
if empty(a:sect)
|
||||
throw 'no manual entry for '.a:name
|
||||
endif
|
||||
function! s:get_path(sect, name) abort
|
||||
if empty(a:sect)
|
||||
let path = system(s:man_cmd.' '.s:man_find_arg.' '.shellescape(a:name))
|
||||
if path !~# '^\/'
|
||||
throw 'no manual entry for '.a:name.'('.a:sect.') or '.a:name
|
||||
throw 'no manual entry for '.a:name
|
||||
endif
|
||||
return path
|
||||
endif
|
||||
if a:name =~# '\/'
|
||||
" We do not need to extract the section/name from the path if the name is
|
||||
" just a path.
|
||||
return ['', a:name]
|
||||
" '-s' flag handles:
|
||||
" - tokens like 'printf(echo)'
|
||||
" - sections starting with '-'
|
||||
" - 3pcap section (found on macOS)
|
||||
" - commas between sections (for section priority)
|
||||
return system(s:man_cmd.' '.s:man_find_arg.' -s '.shellescape(a:sect).' '.shellescape(a:name))
|
||||
endfunction
|
||||
|
||||
function! s:verify_exists(sect, name) abort
|
||||
let path = s:get_path(a:sect, a:name)
|
||||
if path !~# '^\/'
|
||||
let path = s:get_path(get(b:, 'man_default_sects', ''), a:name)
|
||||
if path !~# '^\/'
|
||||
let path = s:get_path('', a:name)
|
||||
endif
|
||||
endif
|
||||
" We need to extract the section from the path because sometimes
|
||||
" the actual section of the manpage is more specific than the section
|
||||
@@ -142,7 +140,8 @@ function! s:verify_exists(sect, name) abort
|
||||
" Also on linux, it seems that the name is case insensitive. So if one does
|
||||
" ':Man PRIntf', we still want the name of the buffer to be 'printf' or
|
||||
" whatever the correct capitilization is.
|
||||
return s:extract_sect_and_name_path(path[:len(path)-2])
|
||||
let path = path[:len(path)-2]
|
||||
return s:extract_sect_and_name_path(path) + [path]
|
||||
endfunction
|
||||
|
||||
let s:tag_stack = []
|
||||
@@ -158,7 +157,7 @@ endfunction
|
||||
function! man#pop_tag() abort
|
||||
if !empty(s:tag_stack)
|
||||
let tag = remove(s:tag_stack, -1)
|
||||
execute tag['buf'].'b'
|
||||
execute 'silent' tag['buf'].'buffer'
|
||||
call cursor(tag['lnum'], tag['col'])
|
||||
endif
|
||||
endfunction
|
||||
@@ -170,13 +169,15 @@ function! s:extract_sect_and_name_path(path) abort
|
||||
let tail = fnamemodify(tail, ':r')
|
||||
endif
|
||||
let sect = matchstr(tail, '\.\zs[^.]\+$')
|
||||
let name = matchstr(tail, '^.\+\ze\.[^.]\+$')
|
||||
let name = matchstr(tail, '^.\+\ze\.')
|
||||
return [sect, name]
|
||||
endfunction
|
||||
|
||||
function! s:find_man() abort
|
||||
if &filetype ==# 'man'
|
||||
return 1
|
||||
elseif winnr('$') ==# 1
|
||||
return 0
|
||||
endif
|
||||
let thiswin = winnr()
|
||||
while 1
|
||||
@@ -189,32 +190,6 @@ function! s:find_man() abort
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
function! s:manwidth() abort
|
||||
" The reason for respecting $MANWIDTH even if it is wider/smaller than the
|
||||
" current window is that the current window might only be temporarily
|
||||
" narrow/wide. Since we don't reflow, we should just assume the
|
||||
" user knows what they're doing and respect $MANWIDTH.
|
||||
if empty($MANWIDTH)
|
||||
" If $MANWIDTH is not set, we do not assign directly to $MANWIDTH because
|
||||
" then $MANWIDTH will always stay the same value as we only use
|
||||
" winwidth(0) when $MANWIDTH is empty. Instead we set it locally for the command.
|
||||
return winwidth(0)
|
||||
endif
|
||||
return $MANWIDTH
|
||||
endfunction
|
||||
|
||||
function! s:man_args(sect, name) abort
|
||||
if empty(a:sect)
|
||||
return shellescape(a:name)
|
||||
endif
|
||||
" The '-s' flag is very useful.
|
||||
" We do not need to worry about stuff like 'printf(echo)'
|
||||
" (two manpages would be interpreted by man without -s)
|
||||
" We do not need to check if the sect starts with '-'
|
||||
" Lastly, the 3pcap section on macOS doesn't work without -s
|
||||
return '-s '.shellescape(a:sect).' '.shellescape(a:name)
|
||||
endfunction
|
||||
|
||||
function! s:error(msg) abort
|
||||
redraw
|
||||
echohl ErrorMsg
|
||||
@@ -224,7 +199,7 @@ endfunction
|
||||
|
||||
let s:mandirs = join(split(system(s:man_cmd.' '.s:man_find_arg), ':\|\n'), ',')
|
||||
|
||||
" see s:extract_sect_and_name_ref on why tolower(sect)
|
||||
" see man#extract_sect_and_name_ref on why tolower(sect)
|
||||
function! man#complete(arg_lead, cmd_line, cursor_pos) abort
|
||||
let args = split(a:cmd_line)
|
||||
let l = len(args)
|
||||
@@ -271,16 +246,35 @@ function! man#complete(arg_lead, cmd_line, cursor_pos) abort
|
||||
return uniq(sort(map(globpath(s:mandirs,'man?/'.name.'*.'.sect.'*', 0, 1), 's:format_candidate(v:val, sect)'), 'i'))
|
||||
endfunction
|
||||
|
||||
function! s:format_candidate(c, sect) abort
|
||||
if a:c =~# '\.\%(pdf\|in\)$' " invalid extensions
|
||||
function! s:format_candidate(path, sect) abort
|
||||
if a:path =~# '\.\%(pdf\|in\)$' " invalid extensions
|
||||
return
|
||||
endif
|
||||
let [sect, name] = s:extract_sect_and_name_path(a:c)
|
||||
let [sect, name] = s:extract_sect_and_name_path(a:path)
|
||||
if sect ==# a:sect
|
||||
return name
|
||||
elseif sect =~# a:sect.'[^.]\+$'
|
||||
elseif sect =~# a:sect.'.\+$'
|
||||
" We include the section if the user provided section is a prefix
|
||||
" of the actual section.
|
||||
return name.'('.sect.')'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! man#init_pager() abort
|
||||
" Remove all backspaced characters.
|
||||
execute 'silent keeppatterns keepjumps %substitute,.\b,,e'.(&gdefault?'':'g')
|
||||
if getline(1) =~# '^\s*$'
|
||||
silent keepjumps 1delete _
|
||||
else
|
||||
keepjumps 1
|
||||
endif
|
||||
" This is not perfect. See `man glDrawArraysInstanced`. Since the title is
|
||||
" all caps it is impossible to tell what the original capitilization was.
|
||||
let ref = tolower(matchstr(getline(1), '^\S\+'))
|
||||
try
|
||||
let b:man_sect = man#extract_sect_and_name_ref(ref)[0]
|
||||
catch
|
||||
let b:man_sect = ''
|
||||
endtry
|
||||
execute 'silent file man://'.fnameescape(ref)
|
||||
endfunction
|
||||
|
@@ -31,34 +31,51 @@ function! s:try_cmd(cmd, ...)
|
||||
endfunction
|
||||
|
||||
let s:cache_enabled = 1
|
||||
if executable('pbcopy')
|
||||
let s:copy['+'] = 'pbcopy'
|
||||
let s:paste['+'] = 'pbpaste'
|
||||
let s:copy['*'] = s:copy['+']
|
||||
let s:paste['*'] = s:paste['+']
|
||||
let s:cache_enabled = 0
|
||||
elseif exists('$DISPLAY') && executable('xsel')
|
||||
let s:copy['+'] = 'xsel --nodetach -i -b'
|
||||
let s:paste['+'] = 'xsel -o -b'
|
||||
let s:copy['*'] = 'xsel --nodetach -i -p'
|
||||
let s:paste['*'] = 'xsel -o -p'
|
||||
elseif exists('$DISPLAY') && executable('xclip')
|
||||
let s:copy['+'] = 'xclip -quiet -i -selection clipboard'
|
||||
let s:paste['+'] = 'xclip -o -selection clipboard'
|
||||
let s:copy['*'] = 'xclip -quiet -i -selection primary'
|
||||
let s:paste['*'] = 'xclip -o -selection primary'
|
||||
elseif executable('lemonade')
|
||||
let s:copy['+'] = 'lemonade copy'
|
||||
let s:paste['+'] = 'lemonade paste'
|
||||
let s:copy['*'] = 'lemonade copy'
|
||||
let s:paste['*'] = 'lemonade paste'
|
||||
elseif executable('doitclient')
|
||||
let s:copy['+'] = 'doitclient wclip'
|
||||
let s:paste['+'] = 'doitclient wclip -r'
|
||||
let s:copy['*'] = s:copy['+']
|
||||
let s:paste['*'] = s:paste['+']
|
||||
else
|
||||
echom 'clipboard: No clipboard tool available. See :help clipboard'
|
||||
let s:err = ''
|
||||
|
||||
function! provider#clipboard#Error() abort
|
||||
return s:err
|
||||
endfunction
|
||||
|
||||
function! provider#clipboard#Executable() abort
|
||||
if executable('pbcopy')
|
||||
let s:copy['+'] = 'pbcopy'
|
||||
let s:paste['+'] = 'pbpaste'
|
||||
let s:copy['*'] = s:copy['+']
|
||||
let s:paste['*'] = s:paste['+']
|
||||
let s:cache_enabled = 0
|
||||
return 'pbcopy'
|
||||
elseif exists('$DISPLAY') && executable('xsel')
|
||||
let s:copy['+'] = 'xsel --nodetach -i -b'
|
||||
let s:paste['+'] = 'xsel -o -b'
|
||||
let s:copy['*'] = 'xsel --nodetach -i -p'
|
||||
let s:paste['*'] = 'xsel -o -p'
|
||||
return 'xsel'
|
||||
elseif exists('$DISPLAY') && executable('xclip')
|
||||
let s:copy['+'] = 'xclip -quiet -i -selection clipboard'
|
||||
let s:paste['+'] = 'xclip -o -selection clipboard'
|
||||
let s:copy['*'] = 'xclip -quiet -i -selection primary'
|
||||
let s:paste['*'] = 'xclip -o -selection primary'
|
||||
return 'xclip'
|
||||
elseif executable('lemonade')
|
||||
let s:copy['+'] = 'lemonade copy'
|
||||
let s:paste['+'] = 'lemonade paste'
|
||||
let s:copy['*'] = 'lemonade copy'
|
||||
let s:paste['*'] = 'lemonade paste'
|
||||
return 'lemonade'
|
||||
elseif executable('doitclient')
|
||||
let s:copy['+'] = 'doitclient wclip'
|
||||
let s:paste['+'] = 'doitclient wclip -r'
|
||||
let s:copy['*'] = s:copy['+']
|
||||
let s:paste['*'] = s:paste['+']
|
||||
return 'doitclient'
|
||||
endif
|
||||
|
||||
let s:err = 'clipboard: No clipboard tool available. See :help clipboard'
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
if empty(provider#clipboard#Executable())
|
||||
finish
|
||||
endif
|
||||
|
||||
|
@@ -190,7 +190,8 @@ function! s:RegistrationCommands(host) abort
|
||||
call remote#host#RegisterClone(host_id, a:host)
|
||||
let pattern = s:plugin_patterns[a:host]
|
||||
let paths = globpath(&rtp, 'rplugin/'.a:host.'/'.pattern, 0, 1)
|
||||
let paths = map(paths, 'tr(v:val,"\\","/")') " Normalize slashes #4795
|
||||
let paths = map(paths, 'tr(resolve(v:val),"\\","/")') " Normalize slashes #4795
|
||||
let paths = uniq(sort(paths))
|
||||
if empty(paths)
|
||||
return []
|
||||
endif
|
||||
@@ -260,11 +261,9 @@ endfunction
|
||||
|
||||
function! remote#host#LoadErrorForHost(host, log) abort
|
||||
return 'Failed to load '. a:host . ' host. '.
|
||||
\ 'You can try to see what happened '.
|
||||
\ 'by starting Neovim with the environment variable '.
|
||||
\ a:log . ' set to a file and opening the generated '.
|
||||
\ 'log file. Also, the host stderr is available '.
|
||||
\ 'in messages.'
|
||||
\ 'You can try to see what happened by starting nvim with '.
|
||||
\ a:log . ' set and opening the generated log file.'.
|
||||
\ ' Also, the host stderr is available in messages.'
|
||||
endfunction
|
||||
|
||||
|
||||
|
@@ -2,6 +2,7 @@
|
||||
" Compiler: GNU C Compiler
|
||||
" Maintainer: Nikolai Weibull <now@bitwi.se>
|
||||
" Latest Revision: 2010-10-14
|
||||
" added line suggested by Anton Lindqvist 2016 Mar 31
|
||||
|
||||
if exists("current_compiler")
|
||||
finish
|
||||
@@ -24,6 +25,7 @@ CompilerSet errorformat=
|
||||
\%f:%l:\ %trror:\ %m,
|
||||
\%f:%l:\ %tarning:\ %m,
|
||||
\%f:%l:\ %m,
|
||||
\%f:\\(%*[^\\)]\\):\ %m,
|
||||
\\"%f\"\\,\ line\ %l%*\\D%c%*[^\ ]\ %m,
|
||||
\%D%*\\a[%*\\d]:\ Entering\ directory\ [`']%f',
|
||||
\%X%*\\a[%*\\d]:\ Leaving\ directory\ [`']%f',
|
||||
|
@@ -1,7 +1,7 @@
|
||||
" Vim compiler file
|
||||
" Compiler: HTML Tidy
|
||||
" Maintainer: Doug Kearns <dougkearns@gmail.com>
|
||||
" Last Change: 2013 Jul 7
|
||||
" Last Change: 2016 Apr 21
|
||||
|
||||
if exists("current_compiler")
|
||||
finish
|
||||
@@ -12,8 +12,8 @@ if exists(":CompilerSet") != 2 " older Vim always used :setlocal
|
||||
command -nargs=* CompilerSet setlocal <args>
|
||||
endif
|
||||
|
||||
CompilerSet makeprg=tidy\ -quiet\ -errors\ --gnu-emacs\ yes\ %
|
||||
CompilerSet makeprg=tidy\ -quiet\ -errors\ --gnu-emacs\ yes\ %:S
|
||||
|
||||
" sample warning: foo.html:8:1: Warning: inserting missing 'foobar' element
|
||||
" sample error: foo.html:9:2: Error: <foobar> is not recognized!
|
||||
CompilerSet errorformat=%f:%l:%c:\ Error:%m,%f:%l:%c:\ Warning:%m,%-G%.%#
|
||||
" foo.html:8:1: Warning: inserting missing 'foobar' element
|
||||
" foo.html:9:2: Error: <foobar> is not recognized!
|
||||
CompilerSet errorformat=%f:%l:%c:\ %trror:%m,%f:%l:%c:\ %tarning:%m,%-G%.%#
|
||||
|
@@ -14,13 +14,13 @@ C API for Nvim *API* *api*
|
||||
==============================================================================
|
||||
1. Introduction *api-intro*
|
||||
|
||||
Nvim exposes a public API for external code to interact with the Nvim core. In
|
||||
the present version of Nvim the API is primarily used by external processes to
|
||||
interact with Nvim using the msgpack-rpc protocol, see |msgpack-rpc|. The API
|
||||
will also be used from vimscript to access new Nvim core features, but this is
|
||||
not implemented yet. Later on, Nvim might be embeddable in C applications as
|
||||
libnvim, and the application will then control the embedded instance by
|
||||
calling the C API directly.
|
||||
Nvim exposes a public API for external code to interact with the Nvim core.
|
||||
The API is used by external processes to interact with Nvim using the
|
||||
msgpack-rpc protocol, see |msgpack-rpc|. The API is used from vimscript to
|
||||
access some new Nvim core features. See |eval-api| for how api functions are
|
||||
called from vimscript. Later on, Nvim might be embeddable in C applications as
|
||||
libnvim, and the application will then control the embedded instance by calling
|
||||
the C API directly.
|
||||
|
||||
==============================================================================
|
||||
2. API Types *api-types*
|
||||
@@ -51,9 +51,10 @@ Tabpage -> enum value kObjectTypeTabpage
|
||||
|
||||
Nvim exposes metadata about the API as a Dictionary with the following keys:
|
||||
|
||||
functions calling signature of the API functions
|
||||
types The custom handle types defined by Nvim
|
||||
error_types The possible kinds of errors an API function can exit with.
|
||||
version Nvim version, API level/compatibility
|
||||
functions API function signatures
|
||||
types Custom handle types defined by Nvim
|
||||
error_types Possible error types returned by API functions
|
||||
|
||||
This metadata is mostly useful for external programs accessing the API via
|
||||
RPC, see |rpc-api|.
|
||||
@@ -73,10 +74,10 @@ Another use case are plugins that show output in an append-only buffer, and
|
||||
want to add highlights to the outputs. Highlight data cannot be preserved
|
||||
on writing and loading a buffer to file, nor in undo/redo cycles.
|
||||
|
||||
Highlights are registered using the |buffer_add_highlight| function, see the
|
||||
Highlights are registered using the |nvim_buf_add_highlight| function, see the
|
||||
generated API documentation for details. If an external highlighter plugin is
|
||||
adding a large number of highlights in a batch, performance can be improved by
|
||||
calling |buffer_add_highlight| as an asynchronous notification, after first
|
||||
calling |nvim_buf_add_highlight| as an asynchronous notification, after first
|
||||
(synchronously) reqesting a source id. Here is an example using wrapper
|
||||
functions in the python client:
|
||||
>
|
||||
@@ -91,10 +92,19 @@ functions in the python client:
|
||||
buf.clear_highlight(src)
|
||||
<
|
||||
If the highlights don't need to be deleted or updated, just pass -1 as
|
||||
src_id (this is the default in python). |buffer_clear_highlight| can be used
|
||||
to clear highligts from a specific source, in a specific line range or the
|
||||
entire buffer by passing in the line range 0, -1 (the later is the default
|
||||
src_id (this is the default in python). |nvim_buf_clear_highlight| can be used
|
||||
to clear highlights from a specific source, in a specific line range or the
|
||||
entire buffer by passing in the line range 0, -1 (the latter is the default
|
||||
in python as used above).
|
||||
|
||||
An example of calling the api from vimscript: >
|
||||
|
||||
call nvim_buf_set_lines(0, 0, 0, v:true, ["test text"])
|
||||
let src = nvim_buf_add_highlight(0, 0, "String", 1, 0, 4)
|
||||
call nvim_buf_add_highlight(0, src, "Identifier", 0, 5, -1)
|
||||
|
||||
" later
|
||||
call nvim_buf_clear_highlight(0, src, 0, -1)
|
||||
>
|
||||
==============================================================================
|
||||
vim:tw=78:ts=8:noet:ft=help:norl:
|
||||
|
@@ -256,7 +256,6 @@ Name triggered by ~
|
||||
Options
|
||||
|FileType| when the 'filetype' option has been set
|
||||
|Syntax| when the 'syntax' option has been set
|
||||
|EncodingChanged| after the 'encoding' option has been changed
|
||||
|TermChanged| after the value of 'term' has changed
|
||||
|OptionSet| after setting any option
|
||||
|
||||
@@ -557,9 +556,6 @@ CursorMoved After the cursor was moved in Normal or Visual
|
||||
CursorMovedI After the cursor was moved in Insert mode.
|
||||
Not triggered when the popup menu is visible.
|
||||
Otherwise the same as CursorMoved.
|
||||
*EncodingChanged*
|
||||
EncodingChanged Fires off after the 'encoding' option has been
|
||||
changed. Useful to set up fonts, for example.
|
||||
*FileAppendCmd*
|
||||
FileAppendCmd Before appending to a file. Should do the
|
||||
appending to the file. Use the '[ and ']
|
||||
@@ -618,9 +614,6 @@ FileChangedShell When Vim notices that the modification time of
|
||||
*FileChangedShellPost*
|
||||
FileChangedShellPost After handling a file that was changed outside
|
||||
of Vim. Can be used to update the statusline.
|
||||
*FileEncoding*
|
||||
FileEncoding Obsolete. It still works and is equivalent
|
||||
to |EncodingChanged|.
|
||||
*FileReadCmd*
|
||||
FileReadCmd Before reading a file with a ":read" command.
|
||||
Should do the reading of the file. |Cmd-event|
|
||||
@@ -947,7 +940,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
|
||||
.shada file. Executed only once, like
|
||||
VimLeavePre.
|
||||
|
48
runtime/doc/deprecated.txt
Normal file
48
runtime/doc/deprecated.txt
Normal file
@@ -0,0 +1,48 @@
|
||||
*deprecated.txt* {Nvim}
|
||||
|
||||
|
||||
NVIM REFERENCE MANUAL
|
||||
|
||||
|
||||
Nvim *deprecated*
|
||||
|
||||
The items listed below are "deprecated". This means they will be removed in
|
||||
the future. They should not be used in new scripts, and old scripts should be
|
||||
updated.
|
||||
|
||||
==============================================================================
|
||||
|
||||
Normal commands ~
|
||||
*]f*
|
||||
*[f* Same as "gf".
|
||||
|
||||
|
||||
Commands ~
|
||||
*:rv*
|
||||
*:rviminfo* Deprecated alias to |:rshada| command.
|
||||
*:wv*
|
||||
*:wviminfo* Deprecated alias to |:wshada| command.
|
||||
|
||||
|
||||
Events ~
|
||||
*EncodingChanged* Never fired; 'encoding' is always "utf-8".
|
||||
*FileEncoding* Never fired; equivalent to |EncodingChanged|.
|
||||
|
||||
Highlight groups ~
|
||||
*hl-VisualNOS* Obsolete. |vim-differences| {Nvim}
|
||||
|
||||
Functions ~
|
||||
*buffer_exists()* Obsolete name for |bufexists()|.
|
||||
*buffer_name()* Obsolete name for |bufname()|.
|
||||
*buffer_number()* Obsolete name for |bufnr()|.
|
||||
*file_readable()* Obsolete name for |filereadable()|.
|
||||
*highlight_exists()* Obsolete name for |hlexists()|.
|
||||
*highlightID()* Obsolete name for |hlID()|.
|
||||
*last_buffer_nr()* Obsolete name for bufnr("$").
|
||||
|
||||
Options ~
|
||||
*'fe'* 'fenc'+'enc' before Vim 6.0; no longer used.
|
||||
*'vi'*
|
||||
*'viminfo'* Deprecated alias to 'shada' option.
|
||||
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
@@ -124,13 +124,26 @@ include the kitchen sink... but you can use it for plumbing."
|
||||
==============================================================================
|
||||
2. Design decisions *design-decisions*
|
||||
|
||||
Jargon *dev-jargon*
|
||||
JARGON *dev-jargon*
|
||||
|
||||
API client ~
|
||||
All external UIs and remote plugins (as opposed to regular Vim plugins) are
|
||||
"clients" in general; but we call something an "API client" if its purpose is
|
||||
to abstract or wrap the RPC API for the convenience of other applications
|
||||
(just like a REST client or SDK such as boto3 for AWS: you can speak AWS REST
|
||||
using an HTTP client like curl, but boto3 wraps that in a convenient python
|
||||
interface). For example, the Nvim lua-client is an API client:
|
||||
https://github.com/neovim/lua-client
|
||||
|
||||
Host ~
|
||||
A plugin "host" is both a client (of the Nvim API) and a server (of an
|
||||
external platform, e.g. python). It is a remote plugin that hosts other
|
||||
plugins.
|
||||
|
||||
Remote plugin ~
|
||||
Arbitrary code registered via |:UpdateRemotePlugins|, that runs in a separate
|
||||
process and communicates with Nvim via the |api|.
|
||||
|
||||
Window ~
|
||||
The word "window" is commonly used for several things: A window on the screen,
|
||||
the xterm window, a window inside Vim to view a buffer.
|
||||
@@ -145,7 +158,7 @@ window View on a buffer. There can be several windows in Vim,
|
||||
together with the command line, menubar, toolbar, etc. they
|
||||
fit in the shell.
|
||||
|
||||
Providers *dev-provider*
|
||||
PROVIDERS *dev-provider*
|
||||
|
||||
A goal of Nvim is to allow extension of the editor without special knowledge
|
||||
in the core. But some Vim components are too tightly coupled; in those cases
|
||||
@@ -189,8 +202,35 @@ Python host isn't installed then the plugin will "think" it is running in
|
||||
a Vim compiled without the |+python| feature.
|
||||
|
||||
|
||||
RPC API
|
||||
API client
|
||||
remote plugin
|
||||
API *dev-api*
|
||||
|
||||
Use this pattern to name new API functions:
|
||||
nvim_{thing}_{action}_{arbitrary-qualifiers}
|
||||
|
||||
If the function acts on an object then {thing} is the name of that object
|
||||
(e.g. "buf" or "win"). If the function operates in a "global" context then
|
||||
{thing} is usually omitted (but consider "namespacing" your global operations
|
||||
with a {thing} that groups functions under a common concept).
|
||||
|
||||
Use existing common {action} names if possible:
|
||||
add Append to, or insert into, a collection
|
||||
get Get a thing (or subset of things by some query)
|
||||
set Set a thing
|
||||
del Delete a thing (or group of things)
|
||||
list Get all things
|
||||
|
||||
Use consistent names for {thing} in all API functions. E.g. a buffer is called
|
||||
"buf" everywhere, not "buffer" in some places and "buf" in others.
|
||||
|
||||
Example: `nvim_get_current_line` acts on the global editor state; the common
|
||||
{action} "get" is used but {thing} is omitted.
|
||||
|
||||
Example: `nvim_buf_add_highlight` acts on a `Buffer` object (the first
|
||||
parameter) and uses the common {action} "add".
|
||||
|
||||
Example: `nvim_list_bufs` operates in a global context (first parameter is
|
||||
_not_ a Buffer). The common {action} "list" indicates that it lists all
|
||||
bufs (plural) in the global context.
|
||||
|
||||
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
||||
|
@@ -1,12 +1,12 @@
|
||||
*diff.txt* For Vim version 7.4. Last change: 2015 Nov 01
|
||||
*diff.txt* For Vim version 7.4. Last change: 2016 Aug 24
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
|
||||
|
||||
*diff* *diff-mode*
|
||||
This file describes |diff-mode|, which shows the differences between two,
|
||||
three, or four versions of the same file.
|
||||
This file describes the |+diff| feature: Showing differences between two to
|
||||
eight versions of the same file.
|
||||
|
||||
The basics are explained in section |08.7| of the user manual.
|
||||
|
||||
@@ -109,7 +109,7 @@ To make these commands use a vertical split, prepend |:vertical|. Examples: >
|
||||
If you always prefer a vertical split include "vertical" in 'diffopt'.
|
||||
|
||||
*E96*
|
||||
There can be up to four buffers with 'diff' set.
|
||||
There can be up to eight buffers with 'diff' set.
|
||||
|
||||
Since the option values are remembered with the buffer, you can edit another
|
||||
file for a moment and come back to the same file and be in diff mode again.
|
||||
|
@@ -267,9 +267,6 @@ CTRL-^ Edit the alternate file. Mostly the alternate file is
|
||||
files.
|
||||
See |CTRL-^| above for further details.
|
||||
|
||||
[count]]f *]f* *[f*
|
||||
[count][f Same as "gf". Deprecated.
|
||||
|
||||
*gf* *E446* *E447*
|
||||
[count]gf Edit the file whose name is under or after the cursor.
|
||||
Mnemonic: "goto file".
|
||||
|
@@ -1,4 +1,4 @@
|
||||
*eval.txt* For Vim version 7.4. Last change: 2016 Mar 27
|
||||
*eval.txt* For Vim version 7.4. Last change: 2016 Jun 04
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -43,6 +43,7 @@ Number A 32 or 64 bit signed number. |expr-number| *Number*
|
||||
Float A floating point number. |floating-point-format| *Float*
|
||||
Examples: 123.456 1.15e-6 -1.1e3
|
||||
|
||||
*E928*
|
||||
String A NUL terminated string of 8-bit unsigned characters (bytes).
|
||||
|expr-string| Examples: "ab\txx\"--" 'x-z''a,c'
|
||||
|
||||
@@ -1028,8 +1029,8 @@ A string constant accepts these special characters:
|
||||
\x. byte specified with one hex number (must be followed by non-hex char)
|
||||
\X.. same as \x..
|
||||
\X. same as \x.
|
||||
\u.... character specified with up to 4 hex numbers, stored according to the
|
||||
current value of 'encoding' (e.g., "\u02a4")
|
||||
\u.... character specified with up to 4 hex numbers, stored as UTF-8
|
||||
(e.g., "\u02a4")
|
||||
\U.... same as \u but allows up to 8 hex numbers.
|
||||
\b backspace <BS>
|
||||
\e escape <Esc>
|
||||
@@ -1044,8 +1045,7 @@ A string constant accepts these special characters:
|
||||
utf-8 character, use \uxxxx as mentioned above.
|
||||
|
||||
Note that "\xff" is stored as the byte 255, which may be invalid in some
|
||||
encodings. Use "\u00ff" to store character 255 according to the current value
|
||||
of 'encoding'.
|
||||
encodings. Use "\u00ff" to store character 255 correctly as UTF-8.
|
||||
|
||||
Note that "\000" and "\x00" force the end of the string.
|
||||
|
||||
@@ -1305,6 +1305,10 @@ v:beval_winnr The number of the window, over which the mouse pointer is. Only
|
||||
window has number zero (unlike most other places where a
|
||||
window gets a number).
|
||||
|
||||
*v:beval_winid* *beval_winid-variable*
|
||||
v:beval_winid The window ID of the window, over which the mouse pointer is.
|
||||
Otherwise like v:beval_winnr.
|
||||
|
||||
*v:char* *char-variable*
|
||||
v:char Argument for evaluating 'formatexpr' and used for the typed
|
||||
character when using <expr> in an abbreviation |:map-<expr>|.
|
||||
@@ -1554,6 +1558,10 @@ v:mouse_win Window number for a mouse click obtained with |getchar()|.
|
||||
First window has number 1, like with |winnr()|. The value is
|
||||
zero when there was no mouse button click.
|
||||
|
||||
*v:mouse_winid* *mouse_winid-variable*
|
||||
v:mouse_winid Window ID for a mouse click obtained with |getchar()|.
|
||||
The value is zero when there was no mouse button click.
|
||||
|
||||
*v:mouse_lnum* *mouse_lnum-variable*
|
||||
v:mouse_lnum Line number for a mouse click obtained with |getchar()|.
|
||||
This is the text line number, not the screen line number. The
|
||||
@@ -1765,13 +1773,17 @@ 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.
|
||||
|
||||
*v:windowid* *windowid-variable* {Nvim}
|
||||
v:windowid Application-specific window ID ("window handle" in MS-Windows)
|
||||
which may be set by any attached UI. Defaults to zero.
|
||||
Note: for windows inside Vim use |winnr()|.
|
||||
Note: for windows inside Vim use |winnr()| or |win_getid()|.
|
||||
|
||||
==============================================================================
|
||||
4. Builtin Functions *functions*
|
||||
@@ -1813,6 +1825,7 @@ buflisted({expr}) Number TRUE if buffer {expr} is listed
|
||||
bufloaded({expr}) Number TRUE if buffer {expr} is loaded
|
||||
bufname({expr}) String Name of the buffer {expr}
|
||||
bufnr({expr} [, {create}]) Number Number of the buffer {expr}
|
||||
bufwinid({expr}) Number window ID of buffer {expr}
|
||||
bufwinnr({expr}) Number window number of buffer {expr}
|
||||
byte2line({byte}) Number line number at byte count {byte}
|
||||
byteidx({expr}, {nr}) Number byte index of {nr}'th char in {expr}
|
||||
@@ -1897,7 +1910,8 @@ getcmdline() String return the current command-line
|
||||
getcmdpos() Number return cursor position in command-line
|
||||
getcmdtype() String return current command-line type
|
||||
getcmdwintype() String return current command-line window type
|
||||
getcompletion({pat}, {type}) List list of cmdline completion matches
|
||||
getcompletion({pat}, {type} [, {filtered}])
|
||||
List list of cmdline completion matches
|
||||
getcurpos() List position of the cursor
|
||||
getcwd([{winnr} [, {tabnr}]]) String the current working directory
|
||||
getfontname([{name}]) String name of font being used
|
||||
@@ -2009,6 +2023,7 @@ msgpackdump({list}) List dump a list of objects to msgpack
|
||||
msgpackparse({list}) List parse msgpack to a list of objects
|
||||
nextnonblank({lnum}) Number line nr of non-blank line >= {lnum}
|
||||
nr2char({expr}[, {utf8}]) String single char with ASCII/UTF8 value {expr}
|
||||
nvim_...({args}...) any call nvim |api| functions
|
||||
or({expr}, {expr}) Number bitwise OR
|
||||
pathshorten({expr}) String shorten directory names in a path
|
||||
pow({x}, {y}) Float {x} to the power of {y}
|
||||
@@ -2147,6 +2162,7 @@ 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 window nr from window ID
|
||||
@@ -2208,11 +2224,9 @@ and({expr}, {expr}) *and()*
|
||||
Example: >
|
||||
:let flag = and(bits, 0x80)
|
||||
|
||||
|
||||
api_info() *api_info()*
|
||||
Returns Dictionary of |api-metadata|.
|
||||
|
||||
|
||||
append({lnum}, {expr}) *append()*
|
||||
When {expr} is a |List|: Append each item of the |List| as a
|
||||
text line below line {lnum} in the current buffer.
|
||||
@@ -2243,6 +2257,7 @@ arglistid([{winnr} [, {tabnr}]])
|
||||
With {winnr} only use this window in the current tab page.
|
||||
With {winnr} and {tabnr} use the window in the specified tab
|
||||
page.
|
||||
{winnr} can be the window number or the window ID.
|
||||
|
||||
*argv()*
|
||||
argv([{nr}]) The result is the {nr}th file in the argument list of the
|
||||
@@ -2414,8 +2429,6 @@ bufexists({expr}) *bufexists()*
|
||||
for MS-Windows 8.3 names in the form "c:\DOCUME~1"
|
||||
Use "bufexists(0)" to test for the existence of an alternate
|
||||
file name.
|
||||
*buffer_exists()*
|
||||
Obsolete name: buffer_exists().
|
||||
|
||||
buflisted({expr}) *buflisted()*
|
||||
The result is a Number, which is non-zero if a buffer called
|
||||
@@ -2454,8 +2467,6 @@ bufname({expr}) *bufname()*
|
||||
bufname(3) name of buffer 3
|
||||
bufname("%") name of current buffer
|
||||
bufname("file2") name of buffer where "file2" matches.
|
||||
< *buffer_name()*
|
||||
Obsolete name: buffer_name().
|
||||
|
||||
*bufnr()*
|
||||
bufnr({expr} [, {create}])
|
||||
@@ -2471,10 +2482,16 @@ bufnr({expr} [, {create}])
|
||||
of existing buffers. Note that not all buffers with a smaller
|
||||
number necessarily exist, because ":bwipeout" may have removed
|
||||
them. Use bufexists() to test for the existence of a buffer.
|
||||
*buffer_number()*
|
||||
Obsolete name: buffer_number().
|
||||
*last_buffer_nr()*
|
||||
Obsolete name for bufnr("$"): last_buffer_nr().
|
||||
|
||||
bufwinid({expr}) *bufwinid()*
|
||||
The result is a Number, which is the window ID of the first
|
||||
window associated with buffer {expr}. For the use of {expr},
|
||||
see |bufname()| above. If buffer {expr} doesn't exist or
|
||||
there is no such window, -1 is returned. Example: >
|
||||
|
||||
echo "A window containing buffer 1 is " . (bufwinid(1))
|
||||
<
|
||||
Only deals with the current tab page.
|
||||
|
||||
bufwinnr({expr}) *bufwinnr()*
|
||||
The result is a Number, which is the number of the first
|
||||
@@ -2526,8 +2543,6 @@ byteidxcomp({expr}, {nr}) *byteidxcomp()*
|
||||
< The first and third echo result in 3 ('e' plus composing
|
||||
character is 3 bytes), the second echo results in 1 ('e' is
|
||||
one byte).
|
||||
Only works different from byteidx() when 'encoding' is set to
|
||||
a Unicode encoding.
|
||||
|
||||
call({func}, {arglist} [, {dict}]) *call()* *E699*
|
||||
Call function {func} with the items in |List| {arglist} as
|
||||
@@ -2562,11 +2577,11 @@ char2nr({expr}[, {utf8}]) *char2nr()*
|
||||
Return number value of the first char in {expr}. Examples: >
|
||||
char2nr(" ") returns 32
|
||||
char2nr("ABC") returns 65
|
||||
< When {utf8} is omitted or zero, the current 'encoding' is used.
|
||||
Example for "utf-8": >
|
||||
char2nr("á") returns 225
|
||||
char2nr("á"[0]) returns 195
|
||||
< With {utf8} set to 1, always treat as utf-8 characters.
|
||||
< Non-ASCII characters are always treated as UTF-8 characters.
|
||||
{utf8} has no effect, and exists only for
|
||||
backwards-compatibility.
|
||||
A combining character is a separate character.
|
||||
|nr2char()| does the opposite.
|
||||
|
||||
@@ -3262,8 +3277,6 @@ filereadable({file}) *filereadable()*
|
||||
expression, which is used as a String.
|
||||
If you don't care about the file being readable you can use
|
||||
|glob()|.
|
||||
*file_readable()*
|
||||
Obsolete name: file_readable().
|
||||
|
||||
|
||||
filewritable({file}) *filewritable()*
|
||||
@@ -3549,8 +3562,8 @@ getchar([expr]) *getchar()*
|
||||
|
||||
When the user clicks a mouse button, the mouse event will be
|
||||
returned. The position can then be found in |v:mouse_col|,
|
||||
|v:mouse_lnum| and |v:mouse_win|. This example positions the
|
||||
mouse as it would normally happen: >
|
||||
|v:mouse_lnum|, |v:mouse_winid| and |v:mouse_win|. This
|
||||
example positions the mouse as it would normally happen: >
|
||||
let c = getchar()
|
||||
if c == "\<LeftMouse>" && v:mouse_win > 0
|
||||
exe v:mouse_win . "wincmd w"
|
||||
@@ -3661,7 +3674,7 @@ getcmdwintype() *getcmdwintype()*
|
||||
values are the same as |getcmdtype()|. Returns an empty string
|
||||
when not in the command-line window.
|
||||
|
||||
getcompletion({pat}, {type}) *getcompletion()*
|
||||
getcompletion({pat}, {type} [, {filtered}]) *getcompletion()*
|
||||
Return a list of command-line completion matches. {type}
|
||||
specifies what for. The following completion types are
|
||||
supported:
|
||||
@@ -3701,6 +3714,10 @@ getcompletion({pat}, {type}) *getcompletion()*
|
||||
Otherwise only items matching {pat} are returned. See
|
||||
|wildcards| for the use of special characters in {pat}.
|
||||
|
||||
If the optional {filtered} flag is set to 1, then 'wildignore'
|
||||
is applied to filter the results. Otherwise all the matches
|
||||
are returned. The 'wildignorecase' option always applies.
|
||||
|
||||
If there are no matches, an empty list is returned. An
|
||||
invalid value for {type} produces an error.
|
||||
|
||||
@@ -3726,6 +3743,7 @@ getcwd([{winnr}[, {tabnr}]]) *getcwd()*
|
||||
getcwd(0)
|
||||
getcwd(0, 0)
|
||||
< If {winnr} is -1 it is ignored, only the tab is resolved.
|
||||
{winnr} can be the window number or the window ID.
|
||||
|
||||
|
||||
getfsize({fname}) *getfsize()*
|
||||
@@ -3820,7 +3838,9 @@ getline({lnum} [, {end}])
|
||||
|
||||
getloclist({nr}) *getloclist()*
|
||||
Returns a list with all the entries in the location list for
|
||||
window {nr}. When {nr} is zero the current window is used.
|
||||
window {nr}. {nr} can be the window number or the window ID.
|
||||
When {nr} is zero the current window is used.
|
||||
|
||||
For a location list window, the displayed location list is
|
||||
returned. For an invalid window number {nr}, an empty list is
|
||||
returned. Otherwise, same as |getqflist()|.
|
||||
@@ -3948,6 +3968,7 @@ gettabwinvar({tabnr}, {winnr}, {varname} [, {def}]) *gettabwinvar()*
|
||||
Note that {varname} must be the name without "w:".
|
||||
Tabs are numbered starting with one. For the current tabpage
|
||||
use |getwinvar()|.
|
||||
{winnr} can be the window number or the window ID.
|
||||
When {winnr} is zero the current window is used.
|
||||
This also works for a global option, buffer-local option and
|
||||
window-local option, but it doesn't work for a global variable
|
||||
@@ -4075,7 +4096,8 @@ haslocaldir([{winnr}[, {tabnr}]]) *haslocaldir()*
|
||||
haslocaldir()
|
||||
haslocaldir(0)
|
||||
haslocaldir(0, 0)
|
||||
< If {winnr} is -1 it is ignored, only the tab is resolved.
|
||||
< {winnr} can be the window number or the window ID.
|
||||
If {winnr} is -1 it is ignored, only the tab is resolved.
|
||||
|
||||
hasmapto({what} [, {mode} [, {abbr}]]) *hasmapto()*
|
||||
The result is a Number, which is 1 if there is a mapping that
|
||||
@@ -4186,8 +4208,6 @@ hlexists({name}) *hlexists()*
|
||||
defined in some way. Not necessarily when highlighting has
|
||||
been defined for it, it may also have been used for a syntax
|
||||
item.
|
||||
*highlight_exists()*
|
||||
Obsolete name: highlight_exists().
|
||||
|
||||
*hlID()*
|
||||
hlID({name}) The result is a Number, which is the ID of the highlight group
|
||||
@@ -4197,8 +4217,6 @@ hlID({name}) The result is a Number, which is the ID of the highlight group
|
||||
group. For example, to get the background color of the
|
||||
"Comment" group: >
|
||||
:echo synIDattr(synIDtrans(hlID("Comment")), "bg")
|
||||
< *highlightID()*
|
||||
Obsolete name: highlightID().
|
||||
|
||||
hostname() *hostname()*
|
||||
The result is a String, which is the name of the machine on
|
||||
@@ -4216,11 +4234,7 @@ iconv({expr}, {from}, {to}) *iconv()*
|
||||
Most conversions require Vim to be compiled with the |+iconv|
|
||||
feature. Otherwise only UTF-8 to latin1 conversion and back
|
||||
can be done.
|
||||
This can be used to display messages with special characters,
|
||||
no matter what 'encoding' is set to. Write the message in
|
||||
UTF-8 and use: >
|
||||
echo iconv(utf8_str, "utf-8", &enc)
|
||||
< Note that Vim uses UTF-8 for all Unicode encodings, conversion
|
||||
Note that Vim uses UTF-8 for all Unicode encodings, conversion
|
||||
from/to UCS-2 is automatically changed to use UTF-8. You
|
||||
cannot use UCS-2 in a string anyway, because of the NUL bytes.
|
||||
{only available when compiled with the |+multi_byte| feature}
|
||||
@@ -4397,7 +4411,8 @@ jobclose({job}[, {stream}]) {Nvim} *jobclose()*
|
||||
Close {job}'s {stream}, which can be one of "stdin", "stdout",
|
||||
"stderr" or "rpc" (closes the rpc channel for a job started
|
||||
with the "rpc" option.) If {stream} is omitted, all streams
|
||||
are closed.
|
||||
are closed. If the job is a pty job, this will then close the
|
||||
pty master, sending SIGHUP to the job process.
|
||||
|
||||
jobpid({job}) {Nvim} *jobpid()*
|
||||
Return the pid (process id) of {job}.
|
||||
@@ -4504,9 +4519,7 @@ join({list} [, {sep}]) *join()*
|
||||
json_decode({expr}) *json_decode()*
|
||||
Convert {expr} from JSON object. Accepts |readfile()|-style
|
||||
list as the input, as well as regular string. May output any
|
||||
Vim value. When 'encoding' is not UTF-8 string is converted
|
||||
from UTF-8 to 'encoding', failing conversion fails
|
||||
json_decode(). In the following cases it will output
|
||||
Vim value. In the following cases it will output
|
||||
|msgpack-special-dict|:
|
||||
1. Dictionary contains duplicate key.
|
||||
2. Dictionary contains empty key.
|
||||
@@ -4514,33 +4527,22 @@ json_decode({expr}) *json_decode()*
|
||||
dictionary and for string will be emitted in case string
|
||||
with NUL byte was a dictionary key.
|
||||
|
||||
Note: function treats its input as UTF-8 always regardless of
|
||||
'encoding' value. This is needed because JSON source is
|
||||
supposed to be external (e.g. |readfile()|) and JSON standard
|
||||
allows only a few encodings, of which UTF-8 is recommended and
|
||||
the only one required to be supported. Non-UTF-8 characters
|
||||
are an error.
|
||||
Note: function treats its input as UTF-8 always. The JSON
|
||||
standard allows only a few encodings, of which UTF-8 is
|
||||
recommended and the only one required to be supported.
|
||||
Non-UTF-8 characters are an error.
|
||||
|
||||
json_encode({expr}) *json_encode()*
|
||||
Convert {expr} into a JSON string. Accepts
|
||||
|msgpack-special-dict| as the input. Converts from 'encoding'
|
||||
to UTF-8 when encoding strings. Will not convert |Funcref|s,
|
||||
|msgpack-special-dict| as the input. Will not convert |Funcref|s,
|
||||
mappings with non-string keys (can be created as
|
||||
|msgpack-special-dict|), values with self-referencing
|
||||
containers, strings which contain non-UTF-8 characters,
|
||||
pseudo-UTF-8 strings which contain codepoints reserved for
|
||||
surrogate pairs (such strings are not valid UTF-8 strings).
|
||||
When converting 'encoding' is taken into account, if it is not
|
||||
"utf-8", then conversion is performed before encoding strings.
|
||||
Non-printable characters are converted into "\u1234" escapes
|
||||
or special escapes like "\t", other are dumped as-is.
|
||||
|
||||
Note: all characters above U+0079 are considered non-printable
|
||||
when 'encoding' is not UTF-8. This function always outputs
|
||||
UTF-8 strings as required by the standard thus when 'encoding'
|
||||
is not unicode resulting string will look incorrect if
|
||||
"\u1234" notation is not used.
|
||||
|
||||
keys({dict}) *keys()*
|
||||
Return a |List| with all the keys of {dict}. The |List| is in
|
||||
arbitrary order.
|
||||
@@ -4642,9 +4644,9 @@ line2byte({lnum}) *line2byte()*
|
||||
Return the byte count from the start of the buffer for line
|
||||
{lnum}. This includes the end-of-line character, depending on
|
||||
the 'fileformat' option for the current buffer. The first
|
||||
line returns 1. 'encoding' matters, 'fileencoding' is ignored.
|
||||
This can also be used to get the byte count for the line just
|
||||
below the last line: >
|
||||
line returns 1. UTF-8 encoding is used, 'fileencoding' is
|
||||
ignored. This can also be used to get the byte count for the
|
||||
line just below the last line: >
|
||||
line2byte(line("$") + 1)
|
||||
< This is the buffer size plus one. If 'fileencoding' is empty
|
||||
it is the file size plus one.
|
||||
@@ -5068,7 +5070,7 @@ msgpackdump({list}) {Nvim} *msgpackdump()*
|
||||
(dictionary with zero items is represented by 0x80 byte in
|
||||
messagepack).
|
||||
|
||||
Limitations: *E951* *E952* *E953*
|
||||
Limitations: *E5004* *E5005*
|
||||
1. |Funcref|s cannot be dumped.
|
||||
2. Containers that reference themselves cannot be dumped.
|
||||
3. Dictionary keys are always dumped as STR strings.
|
||||
@@ -5163,15 +5165,26 @@ nr2char({expr}[, {utf8}]) *nr2char()*
|
||||
value {expr}. Examples: >
|
||||
nr2char(64) returns "@"
|
||||
nr2char(32) returns " "
|
||||
< When {utf8} is omitted or zero, the current 'encoding' is used.
|
||||
Example for "utf-8": >
|
||||
< Example for "utf-8": >
|
||||
nr2char(300) returns I with bow character
|
||||
< With {utf8} set to 1, always return utf-8 characters.
|
||||
< UTF-8 encoding is always used, {utf8} option has no effect,
|
||||
and exists only for backwards-compatibility.
|
||||
Note that a NUL character in the file is specified with
|
||||
nr2char(10), because NULs are represented with newline
|
||||
characters. nr2char(0) is a real NUL and terminates the
|
||||
string, thus results in an empty string.
|
||||
|
||||
nvim_...({...}) *nvim_...()* *eval-api*
|
||||
Call nvim |api| functions. The type checking of arguments will
|
||||
be stricter than for most other builtins. For instance,
|
||||
if Integer is expected, a |Number| must be passed in, a
|
||||
|String| will not be autoconverted.
|
||||
Buffer numbers, as returned by |bufnr()| could be used as
|
||||
first argument to nvim_buf_... functions. All functions
|
||||
expecting an object (buffer, window or tabpage) can
|
||||
also take the numerical value 0 to indicate the current
|
||||
(focused) object.
|
||||
|
||||
or({expr}, {expr}) *or()*
|
||||
Bitwise OR on the two arguments. The arguments are converted
|
||||
to a number. A List, Dict or Float argument causes an error.
|
||||
@@ -5397,7 +5410,7 @@ py3eval({expr}) *py3eval()*
|
||||
converted to Vim data structures.
|
||||
Numbers and strings are returned as they are (strings are
|
||||
copied though, Unicode strings are additionally converted to
|
||||
'encoding').
|
||||
UTF-8).
|
||||
Lists are represented as Vim |List| type.
|
||||
Dictionaries are represented as Vim |Dictionary| type with
|
||||
keys converted to strings.
|
||||
@@ -5447,8 +5460,7 @@ readfile({fname} [, {binary} [, {max}]])
|
||||
Otherwise:
|
||||
- CR characters that appear before a NL are removed.
|
||||
- Whether the last line ends in a NL or not does not matter.
|
||||
- When 'encoding' is Unicode any UTF-8 byte order mark is
|
||||
removed from the text.
|
||||
- Any UTF-8 byte order mark is removed from the text.
|
||||
When {max} is given this specifies the maximum number of lines
|
||||
to be read. Useful if you only want to check the first ten
|
||||
lines of a file: >
|
||||
@@ -5470,14 +5482,20 @@ reltime([{start} [, {end}]]) *reltime()*
|
||||
the item depends on the system. It can be passed to
|
||||
|reltimestr()| to convert it to a string or |reltimefloat()|
|
||||
to convert to a float.
|
||||
Without an argument it returns the current time.
|
||||
With one argument is returns the time passed since the time
|
||||
|
||||
Without an argument it returns the current "relative time", an
|
||||
implementation-defined value meaningful only when used as an
|
||||
argument to |reltime()|, |reltimestr()| and |reltimefloat()|.
|
||||
|
||||
With one argument it returns the time passed since the time
|
||||
specified in the argument.
|
||||
With two arguments it returns the time passed between {start}
|
||||
and {end}.
|
||||
The {start} and {end} arguments must be values returned by
|
||||
reltime().
|
||||
|
||||
Note: |localtime()| returns the current (non-relative) time.
|
||||
|
||||
reltimefloat({time}) *reltimefloat()*
|
||||
Return a Float that represents the time value of {time}.
|
||||
Unit of time is seconds.
|
||||
@@ -5664,8 +5682,7 @@ rpcstart({prog}[, {argv}]) {Nvim} *rpcstart()*
|
||||
Deprecated. Replace >
|
||||
:let id = rpcstart('prog', ['arg1', 'arg2'])
|
||||
< with >
|
||||
:let id = jobstart(['prog', 'arg1', 'arg2'],
|
||||
{'rpc': v:true})
|
||||
:let id = jobstart(['prog', 'arg1', 'arg2'], {'rpc': v:true})
|
||||
|
||||
rpcstop({channel}) {Nvim} *rpcstop()*
|
||||
Closes an |RPC| {channel}. If the channel is a job
|
||||
@@ -6052,11 +6069,13 @@ setline({lnum}, {text}) *setline()*
|
||||
|
||||
setloclist({nr}, {list} [, {action}[, {title}]]) *setloclist()*
|
||||
Create or replace or add to the location list for window {nr}.
|
||||
When {nr} is zero the current window is used. For a location
|
||||
list window, the displayed location list is modified. For an
|
||||
invalid window number {nr}, -1 is returned. If {title} is
|
||||
given, it will be used to set |w:quickfix_title| after opening
|
||||
the location window.
|
||||
{nr} can be the window number or the window ID.
|
||||
When {nr} is zero the current window is used.
|
||||
|
||||
For a location list window, the displayed location list is
|
||||
modified. For an invalid window number {nr}, -1 is returned. If
|
||||
{title} is given, it will be used to set |w:quickfix_title|
|
||||
after opening the location window.
|
||||
Otherwise, same as |setqflist()|.
|
||||
Also see |location-list|.
|
||||
|
||||
@@ -6145,12 +6164,18 @@ setqflist({list} [, {action}[, {title}]]) *setqflist()*
|
||||
Note that the list is not exactly the same as what
|
||||
|getqflist()| returns.
|
||||
|
||||
*E927*
|
||||
If {action} is set to 'a', then the items from {list} are
|
||||
added to the existing quickfix list. If there is no existing
|
||||
list, then a new list is created. If {action} is set to 'r',
|
||||
then the items from the current quickfix list are replaced
|
||||
with the items from {list}. If {action} is not present or is
|
||||
set to ' ', then a new list is created.
|
||||
list, then a new list is created.
|
||||
|
||||
If {action} is set to 'r', then the items from the current
|
||||
quickfix list are replaced with the items from {list}. This
|
||||
can also be used to clear the list: >
|
||||
:call setqflist([], 'r')
|
||||
<
|
||||
If {action} is not present or is set to ' ', then a new list
|
||||
is created.
|
||||
|
||||
If {title} is given, it will be used to set |w:quickfix_title|
|
||||
after opening the quickfix window.
|
||||
@@ -6220,6 +6245,7 @@ settabwinvar({tabnr}, {winnr}, {varname}, {val}) *settabwinvar()*
|
||||
{val}.
|
||||
Tabs are numbered starting with one. For the current tabpage
|
||||
use |setwinvar()|.
|
||||
{winnr} can be the window number or the window ID.
|
||||
When {winnr} is zero the current window is used.
|
||||
This also works for a global or local buffer option, but it
|
||||
doesn't work for a global or local buffer variable.
|
||||
@@ -6592,8 +6618,7 @@ string({expr}) Return {expr} converted to a String. If {expr} is a Number,
|
||||
for infinite and NaN floating-point values representations
|
||||
which use |str2float()|. Strings are also dumped literally,
|
||||
only single quote is escaped, which does not allow using YAML
|
||||
for parsing back binary strings (including text when
|
||||
'encoding' is not UTF-8). |eval()| should always work for
|
||||
for parsing back binary strings. |eval()| should always work for
|
||||
strings and floats though and this is the only official
|
||||
method, use |msgpackdump()| or |json_encode()| if you need to
|
||||
share data with other application.
|
||||
@@ -6811,23 +6836,30 @@ system({cmd} [, {input}]) *system()* *E677*
|
||||
Get the output of the shell command {cmd} as a |string|. {cmd}
|
||||
will be run the same as in |jobstart()|. See |systemlist()|
|
||||
to get the output as a |List|.
|
||||
Not to be used for interactive commands.
|
||||
|
||||
When {input} is given and is a string this string is written
|
||||
to a file and passed as stdin to the command. The string is
|
||||
written as-is, you need to take care of using the correct line
|
||||
separators yourself.
|
||||
If {input} is given and is a |List| it is written to the file
|
||||
in a way |writefile()| does with {binary} set to "b" (i.e.
|
||||
with a newline between each list item with newlines inside
|
||||
list items converted to NULs).
|
||||
Pipes are not used.
|
||||
If {input} is a string it is written to a pipe and passed as
|
||||
stdin to the command. The string is written as-is, line
|
||||
separators are not changed.
|
||||
If {input} is a |List| it is written to the pipe as
|
||||
|writefile()| does with {binary} set to "b" (i.e. with
|
||||
a newline between each list item, and newlines inside list
|
||||
items converted to NULs).
|
||||
*E5677*
|
||||
Note: system() cannot write to or read from backgrounded ("&")
|
||||
shell commands, e.g.: >
|
||||
:echo system("cat - &", "foo"))
|
||||
< which is equivalent to: >
|
||||
$ echo foo | bash -c 'cat - &'
|
||||
< The pipes are disconnected (unless overridden by shell
|
||||
redirection syntax) before input can reach it. Use
|
||||
|jobstart()| instead.
|
||||
|
||||
Note: Use |shellescape()| or |::S| with |expand()| or
|
||||
|fnamemodify()| to escape special characters in a command
|
||||
argument. Newlines in {cmd} may cause the command to fail.
|
||||
The characters in 'shellquote' and 'shellxquote' may also
|
||||
cause trouble.
|
||||
This is not to be used for interactive commands.
|
||||
|
||||
The result is a String. Example: >
|
||||
:let files = system("ls " . shellescape(expand('%:h')))
|
||||
@@ -6842,9 +6874,6 @@ system({cmd} [, {input}]) *system()* *E677*
|
||||
The command executed is constructed using several options when
|
||||
{cmd} is a string: 'shell' 'shellcmdflag' {cmd}
|
||||
|
||||
The command will be executed in "cooked" mode, so that a
|
||||
CTRL-C will interrupt the command (on Unix at least).
|
||||
|
||||
The resulting error code can be found in |v:shell_error|.
|
||||
This function will fail in |restricted-mode|.
|
||||
|
||||
@@ -7017,8 +7046,9 @@ timer_start({time}, {callback} [, {options}])
|
||||
{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.
|
||||
Stop a timer. The timer callback will no longer be invoked.
|
||||
{timer} is an ID returned by timer_start(), thus it must be a
|
||||
Number.
|
||||
|
||||
tolower({expr}) *tolower()*
|
||||
The result is a copy of the String given, with all uppercase
|
||||
@@ -7219,6 +7249,10 @@ 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.
|
||||
@@ -7244,9 +7278,11 @@ win_id2win({expr}) *win_id2win()*
|
||||
|
||||
*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
|
||||
the buffer in the current window is returned. When window
|
||||
{nr} doesn't exist, -1 is returned.
|
||||
associated with window {nr}. {nr} can be the window number or
|
||||
the window ID.
|
||||
When {nr} is zero, the number of the buffer in the current
|
||||
window is returned.
|
||||
When window {nr} doesn't exist, -1 is returned.
|
||||
Example: >
|
||||
:echo "The file in the current window is " . bufname(winbufnr(0))
|
||||
<
|
||||
@@ -7257,6 +7293,7 @@ wincol() The result is a Number, which is the virtual column of the
|
||||
|
||||
winheight({nr}) *winheight()*
|
||||
The result is a Number, which is the height of window {nr}.
|
||||
{nr} can be the window number or the window ID.
|
||||
When {nr} is zero, the height of the current window is
|
||||
returned. When window {nr} doesn't exist, -1 is returned.
|
||||
An existing window always has a height of zero or more.
|
||||
@@ -7336,6 +7373,7 @@ winsaveview() Returns a |Dictionary| that contains information to restore
|
||||
|
||||
winwidth({nr}) *winwidth()*
|
||||
The result is a Number, which is the width of window {nr}.
|
||||
{nr} can be the window number or the window ID.
|
||||
When {nr} is zero, the width of the current window is
|
||||
returned. When window {nr} doesn't exist, -1 is returned.
|
||||
An existing window always has a width of zero or more.
|
||||
@@ -7411,7 +7449,11 @@ There are four types of features:
|
||||
Example: >
|
||||
:if has("gui_running")
|
||||
< *has-patch*
|
||||
3. Included patches. The "patch123" feature means that patch 123 has been
|
||||
3. {Nvim} version. The "nvim-1.2.3" feature means that the Nvim version is
|
||||
1.2.3 or later. Example: >
|
||||
:if has("nvim-1.2.3")
|
||||
<
|
||||
4. Included patches. The "patch123" feature means that patch 123 has been
|
||||
included. Note that this form does not check the version of Vim, you need
|
||||
to inspect |v:version| for that.
|
||||
Example (checking version 6.2.148 or later): >
|
||||
@@ -7419,7 +7461,7 @@ There are four types of features:
|
||||
< Note that it's possible for patch 147 to be omitted even though 148 is
|
||||
included.
|
||||
|
||||
4. Beyond a certain version or at a certain version and including a specific
|
||||
5. Beyond a certain version or at a certain version and including a specific
|
||||
patch. The "patch-7.4.237" feature means that the Vim version is 7.5 or
|
||||
later, or it is version 7.4 and patch 237 was included.
|
||||
Note that this only works for patch 7.4.237 and later, before that you
|
||||
@@ -7491,6 +7533,7 @@ multi_byte Compiled with support for 'encoding'
|
||||
multi_byte_encoding 'encoding' is set to a multi-byte encoding.
|
||||
multi_byte_ime Compiled with support for IME input method.
|
||||
multi_lang Compiled with support for multiple languages.
|
||||
nvim This is Nvim. |has-patch|
|
||||
ole Compiled with OLE automation support for Win32.
|
||||
path_extra Compiled with up/downwards search in 'path' and 'tags'
|
||||
persistent_undo Compiled with support for persistent undo history.
|
||||
|
@@ -529,14 +529,12 @@ Man {sect} {name}({sect}) Used during completion to show the real section of
|
||||
when the provided section is a prefix, e.g. 1m vs 1.
|
||||
Man {path} Open the manpage specified by path. Prepend "./" if
|
||||
page is in the current directory.
|
||||
Man Open the manpage for the <cWORD> (man buffers)
|
||||
or <cword> (non-man buffers) under the cursor.
|
||||
|
||||
|:Man| accepts command modifiers. For example, to use a vertical split: >
|
||||
:vertical Man printf
|
||||
|
||||
Global Mappings:
|
||||
<Plug>(Man) Jump to the manpage for the <cWORD> under the
|
||||
cursor. Takes a count for the section.
|
||||
|
||||
Local mappings:
|
||||
K or CTRL-] Jump to the manpage for the <cWORD> under the
|
||||
cursor. Takes a count for the section.
|
||||
@@ -547,6 +545,9 @@ q :quit if invoked as $MANPAGER, otherwise :close.
|
||||
Variables:
|
||||
*g:no_man_maps* Do not create mappings in manpage buffers.
|
||||
*g:ft_man_folding_enable* Fold manpages with foldmethod=indent foldnestmax=1.
|
||||
*b:man_default_sects* Comma-separated, ordered list of preferred sections.
|
||||
For example in C one usually wants section 3 or 2: >
|
||||
:let b:man_default_sections = '3,2'
|
||||
|
||||
PDF *ft-pdf-plugin*
|
||||
|
||||
|
@@ -128,6 +128,7 @@ The available subcommands are:
|
||||
6 or e: Find this egrep pattern
|
||||
7 or f: Find this file
|
||||
8 or i: Find files #including this file
|
||||
9 or a: Find places where this symbol is assigned a value
|
||||
|
||||
For all types, except 4 and 6, leading white space for {name} is
|
||||
removed. For 4 and 6 there is exactly one space between {querytype}
|
||||
@@ -254,13 +255,13 @@ started will have no effect!
|
||||
{not available when compiled without the |+quickfix| feature}
|
||||
'cscopequickfix' specifies whether to use quickfix window to show cscope
|
||||
results. This is a list of comma-separated values. Each item consists of
|
||||
|cscope-find| command (s, g, d, c, t, e, f or i) and flag (+, - or 0).
|
||||
|cscope-find| command (s, g, d, c, t, e, f, i or a) and flag (+, - or 0).
|
||||
'+' indicates that results must be appended to quickfix window,
|
||||
'-' implies previous results clearance, '0' or command absence - don't use
|
||||
quickfix. Search is performed from start until first command occurrence.
|
||||
The default value is "" (don't use quickfix anyway). The following value
|
||||
seems to be useful: >
|
||||
:set cscopequickfix=s-,c-,d-,i-,t-,e-
|
||||
:set cscopequickfix=s-,c-,d-,i-,t-,e-,a-
|
||||
<
|
||||
*cscopetag* *cst*
|
||||
If 'cscopetag' is set, the commands ":tag" and CTRL-] as well as "vim -t"
|
||||
@@ -418,6 +419,7 @@ Cscope Home Page (http://cscope.sourceforge.net/): >
|
||||
nmap <C-_>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
|
||||
nmap <C-_>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
|
||||
nmap <C-_>d :cs find d <C-R>=expand("<cword>")<CR><CR>
|
||||
nmap <C-_>a :cs find a <C-R>=expand("<cword>")<CR><CR>
|
||||
|
||||
" Using 'CTRL-spacebar' then a search type makes the vim window
|
||||
" split horizontally, with search result displayed in
|
||||
@@ -431,6 +433,7 @@ Cscope Home Page (http://cscope.sourceforge.net/): >
|
||||
nmap <C-Space>f :scs find f <C-R>=expand("<cfile>")<CR><CR>
|
||||
nmap <C-Space>i :scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
|
||||
nmap <C-Space>d :scs find d <C-R>=expand("<cword>")<CR><CR>
|
||||
nmap <C-Space>a :scs find a <C-R>=expand("<cword>")<CR><CR>
|
||||
|
||||
" Hitting CTRL-space *twice* before the search type does a vertical
|
||||
" split instead of a horizontal one
|
||||
@@ -449,6 +452,8 @@ Cscope Home Page (http://cscope.sourceforge.net/): >
|
||||
\:vert scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
|
||||
nmap <C-Space><C-Space>d
|
||||
\:vert scs find d <C-R>=expand("<cword>")<CR><CR>
|
||||
nmap <C-Space><C-Space>a
|
||||
\:vert scs find a <C-R>=expand("<cword>")<CR><CR>
|
||||
|
||||
==============================================================================
|
||||
7. Cscope availability and information *cscope-info*
|
||||
|
@@ -1436,7 +1436,7 @@ original HTML files completion of tags (and only tags) isn't context aware.
|
||||
|
||||
RUBY *ft-ruby-omni* {Nvim}
|
||||
|
||||
NOTE: Completion for ruby code is not currently provided by Nvim.
|
||||
NOTE: |compl-omni| for Ruby code requires |provider-ruby| to be installed.
|
||||
|
||||
Ruby completion will parse your buffer on demand in order to provide a list of
|
||||
completions. These completions will be drawn from modules loaded by 'require'
|
||||
|
@@ -450,7 +450,7 @@ notation meaning equivalent decimal value(s) ~
|
||||
<k0> - <k9> keypad 0 to 9 *keypad-0* *keypad-9*
|
||||
<S-...> shift-key *shift* *<S-*
|
||||
<C-...> control-key *control* *ctrl* *<C-*
|
||||
<M-...> alt-key or meta-key *meta* *alt* *<M-*
|
||||
<M-...> alt-key or meta-key *META* *meta* *alt* *<M-*
|
||||
<A-...> same as <M-...> *<A-*
|
||||
<D-...> command-key or "super" key *<D-*
|
||||
<t_xx> key with "xx" entry in termcap
|
||||
|
@@ -1406,6 +1406,27 @@ The valid escape sequences are
|
||||
<bang> (See the '-bang' attribute) Expands to a ! if the
|
||||
command was executed with a ! modifier, otherwise
|
||||
expands to nothing.
|
||||
*<mods>*
|
||||
<mods> The command modifiers, if specified. Otherwise, expands to
|
||||
nothing. Supported modifiers are |aboveleft|, |belowright|,
|
||||
|botright|, |browse|, |confirm|, |hide|, |keepalt|,
|
||||
|keepjumps|, |keepmarks|, |keeppatterns|, |lockmarks|,
|
||||
|noswapfile|, |silent|, |tab|, |topleft|, |verbose|, and
|
||||
|vertical|.
|
||||
Examples: >
|
||||
command! -nargs=+ -complete=file MyEdit
|
||||
\ for f in expand(<q-args>, 0, 1) |
|
||||
\ exe '<mods> split ' . f |
|
||||
\ endfor
|
||||
|
||||
function! SpecialEdit(files, mods)
|
||||
for f in expand(a:files, 0, 1)
|
||||
exe a:mods . ' split ' . f
|
||||
endfor
|
||||
endfunction
|
||||
command! -nargs=+ -complete=file Sedit
|
||||
\ call SpecialEdit(<q-args>, <q-mods>)
|
||||
<
|
||||
*<reg>* *<register>*
|
||||
<reg> (See the '-register' attribute) The optional register,
|
||||
if specified. Otherwise, expands to nothing. <register>
|
||||
|
@@ -70,29 +70,24 @@ See |mbyte-locale| for details.
|
||||
|
||||
ENCODING
|
||||
|
||||
If your locale works properly, Vim will try to set the 'encoding' option
|
||||
accordingly. If this doesn't work you can overrule its value: >
|
||||
Nvim always uses UTF-8 internally. Thus 'encoding' option is always set
|
||||
to "utf-8" and cannot be changed.
|
||||
|
||||
:set encoding=utf-8
|
||||
All the text that is used inside Vim will be in UTF-8. Not only the text in
|
||||
the buffers, but also in registers, variables, etc.
|
||||
|
||||
See |encoding-values| for a list of acceptable values.
|
||||
|
||||
The result is that all the text that is used inside Vim will be in this
|
||||
encoding. Not only the text in the buffers, but also in registers, variables,
|
||||
etc. 'encoding' is read-only after startup because changing it would make the
|
||||
existing text invalid.
|
||||
|
||||
You can edit files in another encoding than what 'encoding' is set to. Vim
|
||||
You can edit files in different encodings than UTF-8. Nvim
|
||||
will convert the file when you read it and convert it back when you write it.
|
||||
See 'fileencoding', 'fileencodings' and |++enc|.
|
||||
|
||||
|
||||
DISPLAY AND FONTS
|
||||
|
||||
If you are working in a terminal (emulator) you must make sure it accepts the
|
||||
same encoding as which Vim is working with.
|
||||
If you are working in a terminal (emulator) you must make sure it accepts
|
||||
UTF-8, the encoding which Vim is working with. Otherwise only ASCII can
|
||||
be displayed and edited correctly.
|
||||
|
||||
For the GUI you must select fonts that work with the current 'encoding'. This
|
||||
For the GUI you must select fonts that work with UTF-8. This
|
||||
is the difficult part. It depends on the system you are using, the locale and
|
||||
a few other things. See the chapters on fonts: |mbyte-fonts-X11| for
|
||||
X-Windows and |mbyte-fonts-MSwin| for MS-Windows.
|
||||
@@ -216,10 +211,9 @@ You could make a small shell script for this.
|
||||
==============================================================================
|
||||
3. Encoding *mbyte-encoding*
|
||||
|
||||
Vim uses the 'encoding' option to specify how characters are identified and
|
||||
encoded when they are used inside Vim. This applies to all the places where
|
||||
text is used, including buffers (files loaded into memory), registers and
|
||||
variables.
|
||||
In Nvim UTF-8 is always used internally to encode characters.
|
||||
This applies to all the places where text is used, including buffers (files
|
||||
loaded into memory), registers and variables.
|
||||
|
||||
*charset* *codeset*
|
||||
Charset is another name for encoding. There are subtle differences, but these
|
||||
@@ -240,7 +234,7 @@ matter what language is used. Thus you might see the right text even when the
|
||||
encoding was set wrong.
|
||||
|
||||
*encoding-names*
|
||||
Vim can use many different character encodings. There are three major groups:
|
||||
Vim can edit files in different character encodings. There are three major groups:
|
||||
|
||||
1 8bit Single-byte encodings, 256 different characters. Mostly used
|
||||
in USA and Europe. Example: ISO-8859-1 (Latin1). All
|
||||
@@ -255,11 +249,10 @@ u Unicode Universal encoding, can replace all others. ISO 10646.
|
||||
Millions of different characters. Example: UTF-8. The
|
||||
relation between bytes and screen cells is complex.
|
||||
|
||||
Other encodings cannot be used by Vim internally. But files in other
|
||||
Only UTF-8 is used by Vim internally. But files in other
|
||||
encodings can be edited by using conversion, see 'fileencoding'.
|
||||
Note that all encodings must use ASCII for the characters up to 128.
|
||||
|
||||
Supported 'encoding' values are: *encoding-values*
|
||||
Recognized 'fileencoding' values include: *encoding-values*
|
||||
1 latin1 8-bit characters (ISO 8859-1, also used for cp1252)
|
||||
1 iso-8859-n ISO_8859 variant (n = 2 to 15)
|
||||
1 koi8-r Russian
|
||||
@@ -311,11 +304,11 @@ u ucs-4 32 bit UCS-4 encoded Unicode (ISO/IEC 10646-1)
|
||||
u ucs-4le like ucs-4, little endian
|
||||
|
||||
The {name} can be any encoding name that your system supports. It is passed
|
||||
to iconv() to convert between the encoding of the file and the current locale.
|
||||
to iconv() to convert between UTF-8 and the encoding of the file.
|
||||
For MS-Windows "cp{number}" means using codepage {number}.
|
||||
Examples: >
|
||||
:set encoding=8bit-cp1252
|
||||
:set encoding=2byte-cp932
|
||||
:set fileencoding=8bit-cp1252
|
||||
:set fileencoding=2byte-cp932
|
||||
|
||||
The MS-Windows codepage 1252 is very similar to latin1. For practical reasons
|
||||
the same encoding is used and it's called latin1. 'isprint' can be used to
|
||||
@@ -337,8 +330,7 @@ u ucs-2be same as ucs-2 (big endian)
|
||||
u ucs-4be same as ucs-4 (big endian)
|
||||
u utf-32 same as ucs-4
|
||||
u utf-32le same as ucs-4le
|
||||
default stands for the default value of 'encoding', depends on the
|
||||
environment
|
||||
default the encoding of the current locale.
|
||||
|
||||
For the UCS codes the byte order matters. This is tricky, use UTF-8 whenever
|
||||
you can. The default is to use big-endian (most significant byte comes
|
||||
@@ -363,13 +355,12 @@ or when conversion is not possible:
|
||||
CONVERSION *charset-conversion*
|
||||
|
||||
Vim will automatically convert from one to another encoding in several places:
|
||||
- When reading a file and 'fileencoding' is different from 'encoding'
|
||||
- When writing a file and 'fileencoding' is different from 'encoding'
|
||||
- When reading a file and 'fileencoding' is different from "utf-8"
|
||||
- When writing a file and 'fileencoding' is different from "utf-8"
|
||||
- When displaying messages and the encoding used for LC_MESSAGES differs from
|
||||
'encoding' (requires a gettext version that supports this).
|
||||
"utf-8" (requires a gettext version that supports this).
|
||||
- When reading a Vim script where |:scriptencoding| is different from
|
||||
'encoding'.
|
||||
- When reading or writing a |shada| file.
|
||||
"utf-8".
|
||||
Most of these require the |+iconv| feature. Conversion for reading and
|
||||
writing files may also be specified with the 'charconvert' option.
|
||||
|
||||
@@ -408,11 +399,11 @@ Useful utilities for converting the charset:
|
||||
|
||||
|
||||
*mbyte-conversion*
|
||||
When reading and writing files in an encoding different from 'encoding',
|
||||
When reading and writing files in an encoding different from "utf-8",
|
||||
conversion needs to be done. These conversions are supported:
|
||||
- All conversions between Latin-1 (ISO-8859-1), UTF-8, UCS-2 and UCS-4 are
|
||||
handled internally.
|
||||
- For MS-Windows, when 'encoding' is a Unicode encoding, conversion from and
|
||||
- For MS-Windows, conversion from and
|
||||
to any codepage should work.
|
||||
- Conversion specified with 'charconvert'
|
||||
- Conversion with the iconv library, if it is available.
|
||||
@@ -468,8 +459,6 @@ and you will have a working UTF-8 terminal emulator. Try both >
|
||||
with the demo text that comes with ucs-fonts.tar.gz in order to see
|
||||
whether there are any problems with UTF-8 in your xterm.
|
||||
|
||||
For Vim you may need to set 'encoding' to "utf-8".
|
||||
|
||||
==============================================================================
|
||||
5. Fonts on X11 *mbyte-fonts-X11*
|
||||
|
||||
@@ -864,11 +853,11 @@ between two keyboard settings.
|
||||
The value of the 'keymap' option specifies a keymap file to use. The name of
|
||||
this file is one of these two:
|
||||
|
||||
keymap/{keymap}_{encoding}.vim
|
||||
keymap/{keymap}_utf-8.vim
|
||||
keymap/{keymap}.vim
|
||||
|
||||
Here {keymap} is the value of the 'keymap' option and {encoding} of the
|
||||
'encoding' option. The file name with the {encoding} included is tried first.
|
||||
Here {keymap} is the value of the 'keymap' option.
|
||||
The file name with "utf-8" included is tried first.
|
||||
|
||||
'runtimepath' is used to find these files. To see an overview of all
|
||||
available keymap files, use this: >
|
||||
@@ -950,7 +939,7 @@ this is unusual. But you can use various ways to specify the character: >
|
||||
A <char-0141> octal value
|
||||
x <Space> special key name
|
||||
|
||||
The characters are assumed to be encoded for the current value of 'encoding'.
|
||||
The characters are assumed to be encoded in UTF-8.
|
||||
It's possible to use ":scriptencoding" when all characters are given
|
||||
literally. That doesn't work when using the <char-> construct, because the
|
||||
conversion is done on the keymap file, not on the resulting character.
|
||||
@@ -1170,21 +1159,13 @@ Useful commands:
|
||||
message is truncated, use ":messages").
|
||||
- "g8" shows the bytes used in a UTF-8 character, also the composing
|
||||
characters, as hex numbers.
|
||||
- ":set encoding=utf-8 fileencodings=" forces using UTF-8 for all files. The
|
||||
default is to use the current locale for 'encoding' and set 'fileencodings'
|
||||
to automatically detect the encoding of a file.
|
||||
- ":set fileencodings=" forces using UTF-8 for all files. The
|
||||
default is to automatically detect the encoding of a file.
|
||||
|
||||
|
||||
STARTING VIM
|
||||
|
||||
If your current locale is in an utf-8 encoding, Vim will automatically start
|
||||
in utf-8 mode.
|
||||
|
||||
If you are using another locale: >
|
||||
|
||||
set encoding=utf-8
|
||||
|
||||
You might also want to select the font used for the menus. Unfortunately this
|
||||
You might want to select the font used for the menus. Unfortunately this
|
||||
doesn't always work. See the system specific remarks below, and 'langmenu'.
|
||||
|
||||
|
||||
@@ -1245,10 +1226,9 @@ not everybody is able to type a composing character.
|
||||
These options are relevant for editing multi-byte files. Check the help in
|
||||
options.txt for detailed information.
|
||||
|
||||
'encoding' Encoding used for the keyboard and display. It is also the
|
||||
default encoding for files.
|
||||
'encoding' Internal text encoding, always "utf-8".
|
||||
|
||||
'fileencoding' Encoding of a file. When it's different from 'encoding'
|
||||
'fileencoding' Encoding of a file. When it's different from "utf-8"
|
||||
conversion is done when reading or writing the file.
|
||||
|
||||
'fileencodings' List of possible encodings of a file. When opening a file
|
||||
|
@@ -1,4 +1,4 @@
|
||||
*message.txt* For Vim version 7.4. Last change: 2016 Feb 27
|
||||
*message.txt* For Vim version 7.4. Last change: 2016 Jul 14
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -656,6 +656,12 @@ You must be using an awful lot of buffers. It's now possible that two buffers
|
||||
have the same number, which causes various problems. You might want to exit
|
||||
Vim and restart it.
|
||||
|
||||
*E931* >
|
||||
Buffer cannot be registered
|
||||
|
||||
Out of memory or a duplicate buffer number. May habben after W14. Looking up
|
||||
a buffer will not always work, better restart Vim.
|
||||
|
||||
*E296* *E297* >
|
||||
Seek error in swap file write
|
||||
Write error in swap file
|
||||
|
@@ -1,4 +1,4 @@
|
||||
*motion.txt* For Vim version 7.4. Last change: 2015 Jun 06
|
||||
*motion.txt* For Vim version 7.4. Last change: 2016 Jul 12
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -569,7 +569,7 @@ i[ "inner [] block", select [count] '[' ']' blocks. This
|
||||
When used in Visual mode it is made characterwise.
|
||||
|
||||
a) *v_a)* *a)* *a(*
|
||||
a( *v_ab* *v_a(* *ab*
|
||||
a( *vab* *v_ab* *v_a(* *ab*
|
||||
ab "a block", select [count] blocks, from "[count] [(" to
|
||||
the matching ')', including the '(' and ')' (see
|
||||
|[(|). Does not include white space outside of the
|
||||
@@ -577,7 +577,7 @@ ab "a block", select [count] blocks, from "[count] [(" to
|
||||
When used in Visual mode it is made characterwise.
|
||||
|
||||
i) *v_i)* *i)* *i(*
|
||||
i( *v_ib* *v_i(* *ib*
|
||||
i( *vib* *v_ib* *v_i(* *ib*
|
||||
ib "inner block", select [count] blocks, from "[count] [("
|
||||
to the matching ')', excluding the '(' and ')' (see
|
||||
|[(|).
|
||||
|
@@ -11,6 +11,7 @@ RPC API for Nvim *RPC* *rpc* *msgpack-rpc*
|
||||
3. Connecting |rpc-connecting|
|
||||
4. Clients |rpc-api-client|
|
||||
5. Types |rpc-types|
|
||||
6. Remote UIs |rpc-remote-ui|
|
||||
|
||||
==============================================================================
|
||||
1. Introduction *rpc-intro*
|
||||
@@ -46,7 +47,7 @@ instance.
|
||||
|
||||
There are three ways to obtain API metadata:
|
||||
|
||||
1. Connect to a running Nvim instance and call `vim_get_api_info` via
|
||||
1. Connect to a running Nvim instance and call `nvim_get_api_info` via
|
||||
msgpack-rpc. This is best for clients written in dynamic languages which
|
||||
can define functions at runtime.
|
||||
|
||||
@@ -104,7 +105,7 @@ Nvim instance:
|
||||
require 'msgpack/rpc/transport/unix'
|
||||
|
||||
nvim = MessagePack::RPC::Client.new(MessagePack::RPC::UNIXTransport.new, ENV['NVIM_LISTEN_ADDRESS'])
|
||||
result = nvim.call(:vim_command, 'echo "hello world!"')
|
||||
result = nvim.call(:nvim_command, 'echo "hello world!"')
|
||||
<
|
||||
A better way is to use the Python REPL with the `neovim` package, where API
|
||||
functions can be called interactively:
|
||||
@@ -116,24 +117,23 @@ functions can be called interactively:
|
||||
You can also embed an Nvim instance via |jobstart()|, and communicate using
|
||||
|rpcrequest()| and |rpcnotify()|:
|
||||
>
|
||||
let vim = jobstart(['nvim', '--embed'], {'rpc': v:true})
|
||||
echo rpcrequest(vim, 'vim_eval', '"Hello " . "world!"')
|
||||
call jobstop(vim)
|
||||
let nvim = jobstart(['nvim', '--embed'], {'rpc': v:true})
|
||||
echo rpcrequest(nvim, 'nvim_eval', '"Hello " . "world!"')
|
||||
call jobstop(nvim)
|
||||
<
|
||||
==============================================================================
|
||||
4. Implementing API clients *rpc-api-client* *api-client*
|
||||
|
||||
All external UIs and remote plugins (as opposed to regular Vim plugins) are
|
||||
"clients" in general; but we call something an "API client" if its purpose is
|
||||
to abstract or wrap the RPC API for the convenience of other applications
|
||||
(just like a REST client or SDK such as boto3 for AWS: you can speak AWS REST
|
||||
using an HTTP client like curl, but boto3 wraps that in a convenient python
|
||||
interface). For example, the lua-client is an API client:
|
||||
https://github.com/neovim/lua-client
|
||||
"API clients" wrap the Nvim API to provide idiomatic "SDKs" for their
|
||||
respective platforms (see |dev-jargon|). You can build a new API client for
|
||||
your favorite platform or programming language.
|
||||
|
||||
The Python client (pip package "neovim") is the reference implementation of an
|
||||
API client. It is always up-to-date with the Nvim API, so its source code and
|
||||
test suite are an authoritative reference.
|
||||
Existing API clients are listed here:
|
||||
https://github.com/neovim/neovim/wiki/Related-projects#api-clients
|
||||
|
||||
The Python client is the reference implementation for API clients. It is
|
||||
always up-to-date with the Nvim API, so its source code and test suite are
|
||||
authoritative references.
|
||||
https://github.com/neovim/python-client
|
||||
|
||||
API client implementation guidelines ~
|
||||
@@ -168,6 +168,8 @@ API metadata object ~
|
||||
API clients exist to hide msgpack-rpc details. The API metadata object
|
||||
contains information that makes this task easier (see also |rpc-types|):
|
||||
|
||||
- The "version" key contains the Nvim version, API level, and API
|
||||
backwards-compatibility level.
|
||||
- The "functions" key contains a list of metadata objects for individual
|
||||
functions.
|
||||
- Each function metadata object has |rpc-types| information about the return
|
||||
@@ -176,15 +178,20 @@ contains information that makes this task easier (see also |rpc-types|):
|
||||
- Container types may be decorated with type/size constraints, e.g.
|
||||
ArrayOf(Buffer) or ArrayOf(Integer, 2). This can be useful to generate
|
||||
even more strongly-typed APIs.
|
||||
- Methods that operate on instances of Nvim special types (msgpack EXT) are
|
||||
prefixed with the type name in lower case, e.g. `buffer_get_line`
|
||||
represents the `get_line` method of a Buffer instance.
|
||||
- Global methods are prefixed with `vim`, e.g. `vim_get_buffers`.
|
||||
- Functions that are considered to be methods that operate on instances of
|
||||
Nvim special types (msgpack EXT) will have the `"method"` attribute set to
|
||||
`true`. The reciever type is the type of the first argument. The method
|
||||
names are prefixed with `nvim_` plus a shortened type name, e.g.
|
||||
`nvim_buf_get_lines` represents the `get_lines` method of a Buffer instance.
|
||||
- Global functions have `"method"` set to `false` and are prefixed with just
|
||||
`nvim_`, e.g. `nvim_get_buffers`.
|
||||
|
||||
So for an object-oriented language, an API client contains the classes
|
||||
representing Nvim special types, and the methods of each class could be
|
||||
defined by inspecting the method name prefix. There could also be a singleton
|
||||
Vim class with methods mapped to functions prefixed with `vim_`.
|
||||
defined by stripping the prefix for the type as defined in the `types` metadata
|
||||
(this will always be the first two "_"-separated parts of the function name).
|
||||
There could also be a singleton Vim class with methods where the `nvim_`
|
||||
prefix is stripped off.
|
||||
|
||||
==============================================================================
|
||||
5. Types *rpc-types*
|
||||
@@ -218,18 +225,21 @@ an integer, but not a Window or Tabpage.
|
||||
|
||||
The most reliable way of determining the type codes for the special Nvim types
|
||||
is to inspect the `types` key of metadata dictionary returned by the
|
||||
`vim_get_api_info` method at runtime. Here's a sample JSON representation of
|
||||
`nvim_get_api_info` method at runtime. Here's a sample JSON representation of
|
||||
the `types` object:
|
||||
>
|
||||
"types": {
|
||||
"Buffer": {
|
||||
"id": 0
|
||||
"id": 0,
|
||||
"prefix": "nvim_buf_"
|
||||
},
|
||||
"Window": {
|
||||
"id": 1
|
||||
"id": 1,
|
||||
"prefix": "nvim_win_"
|
||||
},
|
||||
"Tabpage": {
|
||||
"id": 2
|
||||
"id": 2,
|
||||
"prefix": "nvim_tabpage_"
|
||||
}
|
||||
}
|
||||
<
|
||||
@@ -237,5 +247,170 @@ Even for statically compiled clients it is good practice to avoid hardcoding
|
||||
the type codes, because a client may be built against one Nvim version but
|
||||
connect to another with different type codes.
|
||||
|
||||
==============================================================================
|
||||
6. Remote UIs *rpc-remote-ui*
|
||||
|
||||
Nvim allows Graphical user interfaces to be implemented by separate processes
|
||||
communicating with Nvim over the RPC API. Currently the ui model conists of a
|
||||
terminal-like grid with one single, monospace font size, with a few elements
|
||||
that could be drawn separately from the grid (for the momemnt only the popup
|
||||
menu)
|
||||
|
||||
After connecting to a nvim instance (typically a spawned, embedded instance)
|
||||
use the |nvim_ui_attach|(width, height, options) API method to tell nvim that your
|
||||
program wants to draw the nvim screen on a grid with "width" times
|
||||
"height" cells. "options" should be a dictionary with the following (all
|
||||
optional) keys:
|
||||
`rgb`: Controls what color format to use.
|
||||
Set to true (default) to use 24-bit rgb
|
||||
colors.
|
||||
Set to false to use terminal color codes (at
|
||||
most 256 different colors).
|
||||
`popupmenu_external`: Instead of drawing the completion popupmenu on
|
||||
the grid, Nvim will send higher-level events to
|
||||
the ui and let it draw the popupmenu.
|
||||
Defaults to false.
|
||||
|
||||
Nvim will then send msgpack-rpc notifications, with the method name "redraw"
|
||||
and a single argument, an array of screen updates (described below).
|
||||
These should be processed in order. Preferably the user should only be able to
|
||||
see the screen state after all updates are processed (not any intermediate
|
||||
state after processing only a part of the array).
|
||||
|
||||
Screen updates are arrays. The first element a string describing the kind
|
||||
of update.
|
||||
|
||||
["resize", width, height]
|
||||
The grid is resized to `width` and `height` cells.
|
||||
|
||||
["clear"]
|
||||
Clear the screen.
|
||||
|
||||
["eol_clear"]
|
||||
Clear from the cursor position to the end of the current line.
|
||||
|
||||
["cursor_goto", row, col]
|
||||
Move the cursor to position (row, col). Currently, the same cursor is
|
||||
used to define the position for text insertion and the visible cursor.
|
||||
However, only the last cursor position, after processing the entire
|
||||
array in the "redraw" event, is intended to be a visible cursor
|
||||
position.
|
||||
|
||||
["update_fg", color]
|
||||
["update_bg", color]
|
||||
["update_sp", color]
|
||||
Set the default foreground, background and special colors
|
||||
respectively.
|
||||
|
||||
["highlight_set", attrs]
|
||||
Set the attributes that the next text put on the screen will have.
|
||||
`attrs` is a dict with the keys below. Any absent key is reset
|
||||
to its default value. Color defaults are set by the `update_fg` etc
|
||||
updates. All boolean keys default to false.
|
||||
|
||||
`foreground`: foreground color.
|
||||
`background`: backround color.
|
||||
`special`: color to use for underline and undercurl, when present.
|
||||
`reverse`: reverse video. Foreground and background colors are
|
||||
switched.
|
||||
`italic`: italic text.
|
||||
`bold`: bold text.
|
||||
`underline`: underlined text. The line has `special` color.
|
||||
`undercurl`: undercurled text. The curl has `special` color.
|
||||
|
||||
["put", text]
|
||||
The (utf-8 encoded) string `text` is put at the cursor position
|
||||
(and the cursor is advanced), with the highlights as set by the
|
||||
last `highlight_set` update.
|
||||
|
||||
["set_scroll_region", top, bot, left, right]
|
||||
Define the scroll region used by `scroll` below.
|
||||
|
||||
["scroll", count]
|
||||
Scroll the text in the scroll region. The diagrams below illustrate
|
||||
what will happen, depending on the scroll direction. "=" is used to
|
||||
represent the SR(scroll region) boundaries and "-" the moved rectangles.
|
||||
Note that dst and src share a common region.
|
||||
|
||||
If count is bigger than 0, move a rectangle in the SR up, this can
|
||||
happen while scrolling down.
|
||||
>
|
||||
+-------------------------+
|
||||
| (clipped above SR) | ^
|
||||
|=========================| dst_top |
|
||||
| dst (still in SR) | |
|
||||
+-------------------------+ src_top |
|
||||
| src (moved up) and dst | |
|
||||
|-------------------------| dst_bot |
|
||||
| src (cleared) | |
|
||||
+=========================+ src_bot
|
||||
<
|
||||
If count is less than zero, move a rectangle in the SR down, this can
|
||||
happen while scrolling up.
|
||||
>
|
||||
+=========================+ src_top
|
||||
| src (cleared) | |
|
||||
|------------------------ | dst_top |
|
||||
| src (moved down) and dst| |
|
||||
+-------------------------+ src_bot |
|
||||
| dst (still in SR) | |
|
||||
|=========================| dst_bot |
|
||||
| (clipped below SR) | v
|
||||
+-------------------------+
|
||||
<
|
||||
["set_title", title]
|
||||
["set_icon", icon]
|
||||
Set the window title, and icon (minimized) window title, respectively.
|
||||
In windowing systems not distinguishing between the two, "set_icon"
|
||||
can be ignored.
|
||||
|
||||
["mouse_on"]
|
||||
["mouse_off"]
|
||||
Tells the client whether mouse support, as determined by |'mouse'|
|
||||
option, is considered to be active in the current mode. This is mostly
|
||||
useful for a terminal frontend, or other situations where nvim mouse
|
||||
would conflict with other usages of the mouse. It is safe for a client
|
||||
to ignore this and always send mouse events.
|
||||
|
||||
["busy_on"]
|
||||
["busy_off"]
|
||||
Nvim started or stopped being busy, and possibly not responsible to user
|
||||
input. This could be indicated to the user by hiding the cursor.
|
||||
|
||||
["suspend"]
|
||||
|:suspend| command or |Ctrl-Z| mapping is used. A terminal client (or other
|
||||
client where it makes sense) could suspend itself. Other clients can
|
||||
safely ignore it.
|
||||
|
||||
["bell"]
|
||||
["visual_bell"]
|
||||
Notify the user with an audible or visual bell, respectively.
|
||||
|
||||
["update_menu"]
|
||||
The menu mappings changed.
|
||||
|
||||
["mode_change", mode]
|
||||
The mode changed. Currently sent when "insert", "replace" and "normal"
|
||||
modes are entered. A client could for instance change the cursor shape.
|
||||
|
||||
["popupmenu_show", items, selected, row, col]
|
||||
When `popupmenu_external` is set to true, nvim will not draw the
|
||||
popupmenu on the grid, instead when the popupmenu is to be displayed
|
||||
this update is sent. `items` is an array of the items to show, the
|
||||
items are themselves arrays of the form [word, kind, menu, info]
|
||||
as defined at |complete-items|, except that `word` is replaced by
|
||||
`abbr` if present. `selected` is the initially selected item, either a
|
||||
zero-based index into the array of items, or -1 if no item is
|
||||
selected. `row` and `col` is the anchor position, where the first
|
||||
character of the completed word will be.
|
||||
|
||||
["popupmenu_select", selected]
|
||||
An item in the currently displayed popupmenu is selected. `selected`
|
||||
is either a zero-based index into the array of items from the last
|
||||
`popupmenu_show` event, or -1 if no item is selected.
|
||||
|
||||
["popupmenu_hide"]
|
||||
The popupmenu is hidden.
|
||||
|
||||
==============================================================================
|
||||
vim:tw=78:ts=8:noet:ft=help:norl:
|
||||
|
@@ -1,4 +1,4 @@
|
||||
*options.txt* For Vim version 7.4. Last change: 2016 Apr 12
|
||||
*options.txt* For Vim version 7.4. Last change: 2016 Jul 12
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -52,7 +52,6 @@ achieve special effects. These options come in three forms:
|
||||
:se[t] all& Set all options to their default value. The values of
|
||||
these options are not changed:
|
||||
'columns'
|
||||
'encoding'
|
||||
'lines'
|
||||
Warning: This may have a lot of side effects.
|
||||
|
||||
@@ -497,6 +496,7 @@ For example, to use a modeline only for Vim 7.0:
|
||||
To use a modeline for Vim after version 7.2:
|
||||
/* vim>702: set cole=2: */ ~
|
||||
There can be no blanks between "vim" and the ":".
|
||||
The modeline is ignored if {vers} does not fit in an integer. {Nvim}
|
||||
|
||||
|
||||
The number of lines that are checked can be set with the 'modelines' option.
|
||||
@@ -614,7 +614,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
global
|
||||
{only available when compiled with the |+multi_byte|
|
||||
feature}
|
||||
Only effective when 'encoding' is "utf-8" or another Unicode encoding.
|
||||
Tells Vim what to do with characters with East Asian Width Class
|
||||
Ambiguous (such as Euro, Registered Sign, Copyright Sign, Greek
|
||||
letters, Cyrillic letters).
|
||||
@@ -667,7 +666,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
- Set the 'keymap' option to "arabic"; in Insert mode CTRL-^ toggles
|
||||
between typing English and Arabic key mapping.
|
||||
- Set the 'delcombine' option
|
||||
Note that 'encoding' must be "utf-8" for working with Arabic text.
|
||||
|
||||
Resetting this option will:
|
||||
- Reset the 'rightleft' option.
|
||||
@@ -899,7 +897,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.
|
||||
@@ -1077,8 +1075,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
{not available when compiled without the |+linebreak|
|
||||
feature}
|
||||
This option lets you choose which characters might cause a line
|
||||
break if 'linebreak' is on. Only works for ASCII and also for 8-bit
|
||||
characters when 'encoding' is an 8-bit encoding.
|
||||
break if 'linebreak' is on. Only works for ASCII characters.
|
||||
|
||||
*'breakindent'* *'bri'*
|
||||
'breakindent' 'bri' boolean (default off)
|
||||
@@ -1158,21 +1155,14 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
*'buftype'* *'bt'* *E382*
|
||||
'buftype' 'bt' string (default: "")
|
||||
local to buffer
|
||||
{not available when compiled without the |+quickfix|
|
||||
feature}
|
||||
The value of this option specifies the type of a buffer:
|
||||
<empty> normal buffer
|
||||
nofile buffer which is not related to a file and will not be
|
||||
written
|
||||
nowrite buffer which will not be written
|
||||
acwrite buffer which will always be written with BufWriteCmd
|
||||
autocommands.
|
||||
quickfix quickfix buffer, contains list of errors |:cwindow|
|
||||
or list of locations |:lwindow|
|
||||
help help buffer (you are not supposed to set this
|
||||
manually)
|
||||
terminal terminal buffer, this is set automatically when a
|
||||
terminal is created. |terminal-emulator|
|
||||
acwrite buffer will always be written with |BufWriteCmd|s
|
||||
help help buffer (do not set this manually)
|
||||
nofile buffer is not related to a file, will not be written
|
||||
nowrite buffer will not be written
|
||||
quickfix list of errors |:cwindow| or locations |:lwindow|
|
||||
terminal |terminal-emulator| buffer
|
||||
|
||||
This option is used together with 'bufhidden' and 'swapfile' to
|
||||
specify special kinds of buffers. See |special-buffers|.
|
||||
@@ -1213,11 +1203,9 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
Specifies details about changing the case of letters. It may contain
|
||||
these words, separated by a comma:
|
||||
internal Use internal case mapping functions, the current
|
||||
locale does not change the case mapping. This only
|
||||
matters when 'encoding' is a Unicode encoding,
|
||||
"latin1" or "iso-8859-15". When "internal" is
|
||||
omitted, the towupper() and towlower() system library
|
||||
functions are used when available.
|
||||
locale does not change the case mapping. When
|
||||
"internal" is omitted, the towupper() and towlower()
|
||||
system library functions are used when available.
|
||||
keepascii For the ASCII characters (0x00 to 0x7f) use the US
|
||||
case mapping, the current locale is not effective.
|
||||
This probably only matters for Turkish.
|
||||
@@ -1270,13 +1258,12 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
file to convert from. You will have to save the text in a file first.
|
||||
The expression must return zero or an empty string for success,
|
||||
non-zero for failure.
|
||||
The possible encoding names encountered are in 'encoding'.
|
||||
See |encoding-names| for possible encoding names.
|
||||
Additionally, names given in 'fileencodings' and 'fileencoding' are
|
||||
used.
|
||||
Conversion between "latin1", "unicode", "ucs-2", "ucs-4" and "utf-8"
|
||||
is done internally by Vim, 'charconvert' is not used for this.
|
||||
'charconvert' is also used to convert the shada file, if 'encoding' is
|
||||
not "utf-8". Also used for Unicode conversion.
|
||||
Also used for Unicode conversion.
|
||||
Example: >
|
||||
set charconvert=CharConvert()
|
||||
fun CharConvert()
|
||||
@@ -1291,8 +1278,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
v:fname_in name of the input file
|
||||
v:fname_out name of the output file
|
||||
Note that v:fname_in and v:fname_out will never be the same.
|
||||
Note that v:charconvert_from and v:charconvert_to may be different
|
||||
from 'encoding'. Vim internally uses UTF-8 instead of UCS-2 or UCS-4.
|
||||
This option cannot be set from a |modeline| or in the |sandbox|, for
|
||||
security reasons.
|
||||
|
||||
@@ -1449,9 +1434,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
comment text. Currently only used to add markers for folding, see
|
||||
|fold-marker|.
|
||||
|
||||
*'compatible'* *'cp'* *'nocompatible'* *'nocp'*
|
||||
'compatible' 'cp' Removed. |vim-differences| {Nvim}
|
||||
|
||||
*'complete'* *'cpt'* *E535*
|
||||
'complete' 'cpt' string (default: ".,w,b,u,t")
|
||||
local to buffer
|
||||
@@ -1459,7 +1441,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
|
||||
@@ -1848,9 +1830,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
the cursor would skip over it and jump to the
|
||||
following occurrence.
|
||||
|
||||
*'cryptmethod'* *'cm'*
|
||||
'cryptmethod' Removed. |vim-differences| {Nvim}
|
||||
|
||||
*'cscopepathcomp'* *'cspc'*
|
||||
'cscopepathcomp' 'cspc' number (default 0)
|
||||
global
|
||||
@@ -2116,11 +2095,17 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
Change the way text is displayed. This is comma separated list of
|
||||
flags:
|
||||
lastline When included, as much as possible of the last line
|
||||
in a window will be displayed. When not included, a
|
||||
last line that doesn't fit is replaced with "@" lines.
|
||||
in a window will be displayed. "@@@" is put in the
|
||||
last columns of the last screen line to indicate the
|
||||
rest of the line is not displayed.
|
||||
truncate Like "lastline", but "@@@" is displayed in the first
|
||||
column of the last screen line. Overrules "lastline".
|
||||
uhex Show unprintable characters hexadecimal as <xx>
|
||||
instead of using ^C and ~C.
|
||||
|
||||
When neither "lastline" or "truncate" is included, a last line that
|
||||
doesn't fit is replaced with "@" lines.
|
||||
|
||||
*'eadirection'* *'ead'*
|
||||
'eadirection' 'ead' string (default "both")
|
||||
global
|
||||
@@ -2129,48 +2114,24 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
hor horizontally, height of windows is not affected
|
||||
both width and height of windows is affected
|
||||
|
||||
*'ed'* *'edcompatible'* *'noed'* *'noedcompatible'*
|
||||
'edcompatible' 'ed' Removed. |vim-differences| {Nvim}
|
||||
|
||||
*'encoding'* *'enc'* *E543*
|
||||
'encoding' 'enc' string (default: "utf-8")
|
||||
*'emoji'* *'emo'*
|
||||
'emoji' 'emo' boolean (default: on)
|
||||
global
|
||||
{not in Vi}
|
||||
{only available when compiled with the |+multi_byte|
|
||||
feature}
|
||||
Sets the character encoding used inside Vim. It applies to text in
|
||||
the buffers, registers, Strings in expressions, text stored in the
|
||||
shada file, etc. It sets the kind of characters which Vim can work
|
||||
with. See |encoding-names| for the possible values.
|
||||
When on all Unicode emoji characters are considered to be full width.
|
||||
|
||||
'encoding' cannot be changed after startup, because (1) it causes
|
||||
non-ASCII text inside Vim to become invalid, and (2) it complicates
|
||||
runtime logic. The recommended 'encoding' is "utf-8". Remote plugins
|
||||
and GUIs only support utf-8. See |multibyte|.
|
||||
|
||||
The character encoding of files can be different from 'encoding'.
|
||||
*'encoding'* *'enc'* *E543*
|
||||
'encoding' 'enc' Removed. |vim-differences| {Nvim}
|
||||
Nvim always uses UTF-8 internally. RPC communication
|
||||
(remote plugins/GUIs) must use UTF-8 strings.
|
||||
|
||||
The character encoding of files can be different than UTF-8.
|
||||
This is specified with 'fileencoding'. The conversion is done with
|
||||
iconv() or as specified with 'charconvert'.
|
||||
|
||||
If you need to know whether 'encoding' is a multi-byte encoding, you
|
||||
can use: >
|
||||
if has("multi_byte_encoding")
|
||||
<
|
||||
When you set this option, it fires the |EncodingChanged| autocommand
|
||||
event so that you can set up fonts if necessary.
|
||||
|
||||
When the option is set, the value is converted to lowercase. Thus
|
||||
you can set it with uppercase values too. Underscores are translated
|
||||
to '-' signs.
|
||||
When the encoding is recognized, it is changed to the standard name.
|
||||
For example "Latin-1" becomes "latin1", "ISO_88592" becomes
|
||||
"iso-8859-2" and "utf8" becomes "utf-8".
|
||||
|
||||
When "unicode", "ucs-2" or "ucs-4" is used, Vim internally uses utf-8.
|
||||
You don't notice this while editing, but it does matter for the
|
||||
|shada-file|. And Vim expects the terminal to use utf-8 too. Thus
|
||||
setting 'encoding' to one of these values instead of utf-8 only has
|
||||
effect for encoding used for files when 'fileencoding' is empty.
|
||||
|
||||
*'endofline'* *'eol'* *'noendofline'* *'noeol'*
|
||||
'endofline' 'eol' boolean (default on)
|
||||
local to buffer
|
||||
@@ -2297,20 +2258,14 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
feature}
|
||||
Sets the character encoding for the file of this buffer.
|
||||
|
||||
When 'fileencoding' is different from 'encoding', conversion will be
|
||||
When 'fileencoding' is different from "utf-8", conversion will be
|
||||
done when writing the file. For reading see below.
|
||||
When 'fileencoding' is empty, the same value as 'encoding' will be
|
||||
used (no conversion when reading or writing a file).
|
||||
Conversion will also be done when 'encoding' and 'fileencoding' are
|
||||
both a Unicode encoding and 'fileencoding' is not utf-8. That's
|
||||
because internally Unicode is always stored as utf-8.
|
||||
WARNING: Conversion can cause loss of information! When
|
||||
'encoding' is "utf-8" or another Unicode encoding, conversion
|
||||
is most likely done in a way that the reverse conversion
|
||||
results in the same text. When 'encoding' is not "utf-8" some
|
||||
characters may be lost!
|
||||
When 'fileencoding' is empty, the file will be saved with utf-8
|
||||
encoding. (no conversion when reading or writing a file).
|
||||
WARNING: Conversion to a non-Unicode encoding can cause loss of
|
||||
information!
|
||||
|
||||
See 'encoding' for the possible values. Additionally, values may be
|
||||
See |encoding-names| for the possible values. Additionally, values may be
|
||||
specified that can be handled by the converter, see
|
||||
|mbyte-conversion|.
|
||||
|
||||
@@ -2323,8 +2278,8 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
Prepending "8bit-" and "2byte-" has no meaning here, they are ignored.
|
||||
When the option is set, the value is converted to lowercase. Thus
|
||||
you can set it with uppercase values too. '_' characters are
|
||||
replaced with '-'. If a name is recognized from the list for
|
||||
'encoding', it is replaced by the standard name. For example
|
||||
replaced with '-'. If a name is recognized from the list at
|
||||
|encoding-names|, it is replaced by the standard name. For example
|
||||
"ISO8859-2" becomes "iso-8859-2".
|
||||
|
||||
When this option is set, after starting to edit a file, the 'modified'
|
||||
@@ -2337,11 +2292,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
|
||||
This option can not be changed when 'modifiable' is off.
|
||||
|
||||
*'fe'*
|
||||
NOTE: Before version 6.0 this option specified the encoding for the
|
||||
whole of Vim, this was a mistake. Now use 'encoding' instead. The
|
||||
old short name was 'fe', which is no longer used.
|
||||
|
||||
*'fileencodings'* *'fencs'*
|
||||
'fileencodings' 'fencs' string (default: "ucs-bom,utf-8,default,latin1")
|
||||
global
|
||||
@@ -2352,12 +2302,8 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
mentioned character encoding. If an error is detected, the next one
|
||||
in the list is tried. When an encoding is found that works,
|
||||
'fileencoding' is set to it. If all fail, 'fileencoding' is set to
|
||||
an empty string, which means the value of 'encoding' is used.
|
||||
WARNING: Conversion can cause loss of information! When
|
||||
'encoding' is "utf-8" (or one of the other Unicode variants)
|
||||
conversion is most likely done in a way that the reverse
|
||||
conversion results in the same text. When 'encoding' is not
|
||||
"utf-8" some non-ASCII characters may be lost! You can use
|
||||
an empty string, which means that UTF-8 is used.
|
||||
WARNING: Conversion can cause loss of information! You can use
|
||||
the |++bad| argument to specify what is done with characters
|
||||
that can't be converted.
|
||||
For an empty file or a file with only ASCII characters most encodings
|
||||
@@ -2383,11 +2329,11 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
because Vim cannot detect an error, thus the encoding is always
|
||||
accepted.
|
||||
The special value "default" can be used for the encoding from the
|
||||
environment. It is useful when 'encoding' is set to "utf-8" and
|
||||
your environment uses a non-latin1 encoding, such as Russian.
|
||||
When 'encoding' is "utf-8" and a file contains an illegal byte
|
||||
sequence it won't be recognized as UTF-8. You can use the |8g8|
|
||||
command to find the illegal byte sequence.
|
||||
environment. It is useful when your environment uses a non-latin1
|
||||
encoding, such as Russian.
|
||||
When a file contains an illegal UTF-8 byte sequence it won't be
|
||||
recognized as "utf-8". You can use the |8g8| command to find the
|
||||
illegal byte sequence.
|
||||
WRONG VALUES: WHAT'S WRONG:
|
||||
latin1,utf-8 "latin1" will always be used
|
||||
utf-8,ucs-bom,latin1 BOM won't be recognized in an utf-8
|
||||
@@ -3046,8 +2992,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
Note: The size of these fonts must be exactly twice as wide as the one
|
||||
specified with 'guifont' and the same height.
|
||||
|
||||
'guifontwide' is only used when 'encoding' is set to "utf-8" and
|
||||
'guifontset' is empty or invalid.
|
||||
'guifontwide' is only used when 'guifontset' is empty or invalid.
|
||||
When 'guifont' is set and a valid font is found in it and
|
||||
'guifontwide' is empty Vim will attempt to find a matching
|
||||
double-width font and set 'guifontwide' to it.
|
||||
@@ -3096,7 +3041,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.
|
||||
@@ -3164,9 +3109,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
removing it after the GUI has started has no effect.
|
||||
|
||||
|
||||
*'guipty'* *'noguipty'*
|
||||
'guipty' Removed. |vim-differences| {Nvim}
|
||||
|
||||
*'guitablabel'* *'gtl'*
|
||||
'guitablabel' 'gtl' string (default empty)
|
||||
global
|
||||
@@ -3411,12 +3353,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
Can be overruled by using "\c" or "\C" in the pattern, see
|
||||
|/ignorecase|.
|
||||
|
||||
*'imactivatefunc'* *'imaf'*
|
||||
'imactivatefunc' 'imaf' Removed. |vim-differences| {Nvim}
|
||||
|
||||
*'imactivatekey'* *'imak'*
|
||||
'imactivatekey' 'imak' Removed. |vim-differences| {Nvim}
|
||||
|
||||
*'imcmdline'* *'imc'* *'noimcmdline'* *'noimc'*
|
||||
'imcmdline' 'imc' boolean (default off)
|
||||
global
|
||||
@@ -3473,8 +3409,17 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
The value is set to 1 when it is not -1 and setting the 'keymap'
|
||||
option to a valid keymap name.
|
||||
|
||||
*'imstatusfunc'* *'imsf'*
|
||||
'imstatusfunc' 'imsf' Removed. |vim-differences| {Nvim}
|
||||
*'inccommand'* *'icm'*
|
||||
'inccommand' 'icm' string (default "")
|
||||
global
|
||||
|
||||
"nosplit": Shows the effects of a command incrementally, as you type.
|
||||
"split" : Also shows partial off-screen results in a preview window.
|
||||
|
||||
Works for |:substitute|, |:smagic|, |:snomagic|. |hl-Substitute|
|
||||
|
||||
If the preview is too slow (exceeds 'redrawtime') then 'inccommand' is
|
||||
automatically disabled until |Command-line-mode| is done.
|
||||
|
||||
*'include'* *'inc'*
|
||||
'include' 'inc' string (default "^\s*#\s*include")
|
||||
@@ -3712,7 +3657,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
128 - 159 "~@" - "~_"
|
||||
160 - 254 "| " - "|~"
|
||||
255 "~?"
|
||||
When 'encoding' is a Unicode one, illegal bytes from 128 to 255 are
|
||||
Illegal bytes from 128 to 255 (invalid UTF-8) are
|
||||
displayed as <xx>, with the hexadecimal value of the byte.
|
||||
When 'display' contains "uhex" all unprintable characters are
|
||||
displayed as <xx>.
|
||||
@@ -3732,9 +3677,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
Insert two spaces after a '.', '?' and '!' with a join command.
|
||||
Otherwise only one space is inserted.
|
||||
|
||||
*'key'*
|
||||
'key' Removed. |vim-differences| {Nvim}
|
||||
|
||||
*'keymap'* *'kmp'* *E544*
|
||||
'keymap' 'kmp' string (default "")
|
||||
local to buffer
|
||||
@@ -3959,6 +3901,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
global
|
||||
Strings to use in 'list' mode and for the |:list| command. It is a
|
||||
comma separated list of string settings.
|
||||
|
||||
*lcs-eol*
|
||||
eol:c Character to show at the end of each line. When
|
||||
omitted, there is no extra character at the end of the
|
||||
@@ -3993,8 +3936,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
omitted.
|
||||
|
||||
The characters ':' and ',' should not be used. UTF-8 characters can
|
||||
be used when 'encoding' is "utf-8", otherwise only printable
|
||||
characters are allowed. All characters must be single width.
|
||||
be used. All characters must be single width.
|
||||
|
||||
Examples: >
|
||||
:set lcs=tab:>-,trail:-
|
||||
@@ -4013,9 +3955,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
Note that using the "-u NONE" and "--noplugin" command line arguments
|
||||
reset this option. |-u| |--noplugin|
|
||||
|
||||
*'macatsui'* *'nomacatsui'*
|
||||
'macatsui' Removed. |vim-differences| {Nvim}
|
||||
|
||||
*'magic'* *'nomagic'*
|
||||
'magic' boolean (default on)
|
||||
global
|
||||
@@ -4094,7 +4033,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
{only available when compiled with the |+multi_byte|
|
||||
feature}
|
||||
The maximum number of combining characters supported for displaying.
|
||||
Only used when 'encoding' is "utf-8".
|
||||
The default is OK for most languages. Hebrew may require 4.
|
||||
Maximum value is 6.
|
||||
Even when this option is set to 2 you can still edit text with more
|
||||
@@ -4410,7 +4348,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
|
||||
@@ -4440,7 +4378,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
|
||||
@@ -4798,8 +4736,8 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
global
|
||||
{only available when compiled with the |+reltime|
|
||||
feature}
|
||||
The time in milliseconds for redrawing the display. This applies to
|
||||
searching for patterns for 'hlsearch' and |:match| highlighting.
|
||||
Time in milliseconds for redrawing the display. Applies to
|
||||
'hlsearch', 'inccommand' and |:match| highlighting.
|
||||
When redrawing takes more than this many milliseconds no further
|
||||
matches will be highlighted. This is used to avoid that Vim hangs
|
||||
when using a very complicated pattern.
|
||||
@@ -4859,9 +4797,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
For the ":substitute" command the number of substitutions is used
|
||||
instead of the number of lines.
|
||||
|
||||
*'restorescreen'* *'rs'* *'norestorescreen'* *'nors'*
|
||||
'restorescreen' 'rs' Removed. |vim-differences| {Nvim}
|
||||
|
||||
*'revins'* *'ri'* *'norevins'* *'nori'*
|
||||
'revins' 'ri' boolean (default off)
|
||||
global
|
||||
@@ -4969,6 +4904,7 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
keymap/ key mapping files |mbyte-keymap|
|
||||
lang/ menu translations |:menutrans|
|
||||
menu.vim GUI menus |menu.vim|
|
||||
pack/ packages |:packadd|
|
||||
plugin/ plugin scripts |write-plugin|
|
||||
print/ files for printing |postscript-print-encoding|
|
||||
spell/ spell checking files |spell|
|
||||
@@ -4995,6 +4931,8 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
ordering. This is for preferences to overrule or add to the
|
||||
distributed defaults or system-wide settings (rarely needed).
|
||||
|
||||
More entries are added when using |packages|.
|
||||
|
||||
Note that, unlike 'path', no wildcards like "**" are allowed. Normal
|
||||
wildcards are allowed, but can significantly slow down searching for
|
||||
runtime files. For speed, use as few items as possible and avoid
|
||||
@@ -5471,6 +5409,8 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
The |FilterReadPre|, |FilterReadPost| and |FilterWritePre|,
|
||||
|FilterWritePost| autocommands event are not triggered when
|
||||
'shelltemp' is off.
|
||||
The `system()` function does not respect this option and always uses
|
||||
temp files.
|
||||
|
||||
*'shellxescape'* *'sxe'*
|
||||
'shellxescape' 'sxe' string (default: "";
|
||||
@@ -5569,9 +5509,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
shm=a Abbreviation, but no loss of information.
|
||||
shm=at Abbreviation, and truncate message when necessary.
|
||||
|
||||
*'shortname'* *'sn'* *'noshortname'* *'nosn'*
|
||||
'shortname' 'sn' Removed. |vim-differences| {Nvim}
|
||||
|
||||
*'showbreak'* *'sbr'* *E595*
|
||||
'showbreak' 'sbr' string (default "")
|
||||
global
|
||||
@@ -5842,9 +5779,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
(_xx is an underscore, two letters and followed by a non-letter).
|
||||
This is mainly for testing purposes. You must make sure the correct
|
||||
encoding is used, Vim doesn't check it.
|
||||
When 'encoding' is set the word lists are reloaded. Thus it's a good
|
||||
idea to set 'spelllang' after setting 'encoding' to avoid loading the
|
||||
files twice.
|
||||
How the related spell files are found is explained here: |spell-load|.
|
||||
|
||||
If the |spellfile.vim| plugin is active and you use a language name
|
||||
@@ -6185,9 +6119,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
This option is used together with 'bufhidden' and 'buftype' to
|
||||
specify special kinds of buffers. See |special-buffers|.
|
||||
|
||||
*'swapsync'* *'sws'*
|
||||
'swapsync' 'sws' Removed. |vim-differences| {Nvim}
|
||||
|
||||
*'switchbuf'* *'swb'*
|
||||
'switchbuf' 'swb' string (default "")
|
||||
global
|
||||
@@ -6411,9 +6342,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
Resetting this option is useful when using a ":tag" command in a
|
||||
mapping which should not change the tagstack.
|
||||
|
||||
*'term'* *E529* *E530* *E531*
|
||||
'term' Removed. |vim-differences| {Nvim}
|
||||
|
||||
*'termbidi'* *'tbidi'*
|
||||
*'notermbidi'* *'notbidi'*
|
||||
'termbidi' 'tbidi' boolean (default off)
|
||||
@@ -6427,9 +6355,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
'arabicshape' is ignored, but 'rightleft' isn't changed automatically.
|
||||
For further details see |arabic.txt|.
|
||||
|
||||
*'termencoding'* *'tenc'*
|
||||
'termencoding' 'tenc' Removed. |vim-differences| {Nvim}
|
||||
|
||||
*'termguicolors'* *'tgc'*
|
||||
'termguicolors' 'tgc' boolean (default off)
|
||||
global
|
||||
@@ -6584,28 +6509,10 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
to be garbled (e.g., when it contains a CR or NL character).
|
||||
{not available when compiled without the |+statusline| feature}
|
||||
|
||||
*'toolbar'* *'tb'*
|
||||
'toolbar' 'tb' Removed. |vim-differences| {Nvim}
|
||||
|
||||
*'toolbariconsize'* *'tbis'*
|
||||
'toolbariconsize' 'tbis' Removed. |vim-differences| {Nvim}
|
||||
|
||||
*'ttybuiltin'* *'tbi'* *'nottybuiltin'* *'notbi'*
|
||||
'ttybuiltin' 'tbi' Removed. |vim-differences| {Nvim}
|
||||
|
||||
*'ttyfast'* *'tf'* *'nottyfast'* *'notf'*
|
||||
'ttyfast' 'tf' Removed. |vim-differences| {Nvim}
|
||||
|
||||
*'ttymouse'* *'ttym'*
|
||||
'ttymouse' 'ttym' Removed. |vim-differences| {Nvim}
|
||||
|
||||
*'ttyscroll'* *'tsl'*
|
||||
'ttyscroll' 'tsl' Removed. |vim-differences| {Nvim}
|
||||
|
||||
*'ttytype'* *'tty'*
|
||||
'ttytype' 'tty' Alias for 'term'. Removed. |vim-differences| {Nvim}
|
||||
|
||||
*'undodir'* *'udir'* *E926*
|
||||
*'undodir'* *'udir'* *E5003*
|
||||
'undodir' 'udir' string (default "$XDG_DATA_HOME/nvim/undo")
|
||||
global
|
||||
{only when compiled with the |+persistent_undo| feature}
|
||||
@@ -6759,12 +6666,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
with Unix. The Unix version of Vim cannot source dos format scripts,
|
||||
but the Windows version of Vim can source unix format scripts.
|
||||
|
||||
*'viminfo'* *'vi'*
|
||||
'viminfo' 'vi' string
|
||||
global
|
||||
Deprecated alias for 'shada' option. Is kept for compatibility
|
||||
reasons.
|
||||
|
||||
*'virtualedit'* *'ve'*
|
||||
'virtualedit' 've' string (default "")
|
||||
global
|
||||
@@ -6810,9 +6711,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
||||
Give a warning message when a shell command is used while the buffer
|
||||
has been changed.
|
||||
|
||||
*'weirdinvert'* *'wiv'* *'noweirdinvert'* *'nowiv'*
|
||||
'weirdinvert' 'wiv' Removed. |vim-differences| {Nvim}
|
||||
|
||||
*'whichwrap'* *'ww'*
|
||||
'whichwrap' 'ww' string (Vim default: "b,s", Vi default: "")
|
||||
global
|
||||
|
@@ -1,4 +1,4 @@
|
||||
*pattern.txt* For Vim version 7.4. Last change: 2016 Apr 03
|
||||
*pattern.txt* For Vim version 7.4. Last change: 2016 Apr 26
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -1071,8 +1071,8 @@ x A single character, with no special meaning, matches itself
|
||||
belonging to that character class. The following character classes
|
||||
are supported:
|
||||
Name Contents ~
|
||||
*[:alnum:]* [:alnum:] letters and digits
|
||||
*[:alpha:]* [:alpha:] letters
|
||||
*[:alnum:]* [:alnum:] ASCII letters and digits
|
||||
*[:alpha:]* [:alpha:] ASCII letters
|
||||
*[:blank:]* [:blank:] space and tab characters
|
||||
*[:cntrl:]* [:cntrl:] control characters
|
||||
*[:digit:]* [:digit:] decimal digits
|
||||
@@ -1080,7 +1080,7 @@ x A single character, with no special meaning, matches itself
|
||||
*[:lower:]* [:lower:] lowercase letters (all letters when
|
||||
'ignorecase' is used)
|
||||
*[:print:]* [:print:] printable characters including space
|
||||
*[:punct:]* [:punct:] punctuation characters
|
||||
*[:punct:]* [:punct:] ASCII punctuation characters
|
||||
*[:space:]* [:space:] whitespace characters
|
||||
*[:upper:]* [:upper:] uppercase letters (all letters when
|
||||
'ignorecase' is used)
|
||||
@@ -1097,7 +1097,8 @@ x A single character, with no special meaning, matches itself
|
||||
These items only work for 8-bit characters, except [:lower:] and
|
||||
[:upper:] also work for multi-byte characters when using the new
|
||||
regexp engine. See |two-engines|. In the future these items may
|
||||
work for multi-byte characters.
|
||||
work for multi-byte characters. For now, to get all "alpha"
|
||||
characters you can use: [[:lower:][:upper:]].
|
||||
*/[[=* *[==]*
|
||||
- An equivalence class. This means that characters are matched that
|
||||
have almost the same meaning, e.g., when ignoring accents. This
|
||||
|
@@ -12,16 +12,16 @@ Nvim delegates some features to dynamic "providers".
|
||||
Python integration *provider-python*
|
||||
|
||||
Nvim supports the Vim legacy |python-vim| and |python3| interfaces via
|
||||
external Python interpreters connected via |RPC|,
|
||||
|
||||
external Python interpreters connected via |RPC|.
|
||||
Note: Only the Vim 7.3 API is supported; bindeval (Vim 7.4) is not.
|
||||
|
||||
|
||||
PYTHON QUICKSTART ~
|
||||
|
||||
If you used a package manager to install Nvim there's a good chance that
|
||||
it also provides the `neovim` Python package. If it doesn't, follow these
|
||||
steps to install the package with Python's package manager, `pip`.
|
||||
If you used a package manager to install Nvim, you might already have the
|
||||
required `neovim` Python package. Run |:CheckHealth| to see if your system is
|
||||
up-to-date.
|
||||
|
||||
Following are steps to install the package with Python's `pip` tool.
|
||||
|
||||
Note: Depending on your system, `pip` might refer to Python 2 or Python 3,
|
||||
which is why the following instructions mention `pip2` or `pip3`
|
||||
@@ -74,24 +74,19 @@ Note: This requires you to install the python3-neovim module properly. >
|
||||
let g:python3_host_skip_check = 1
|
||||
|
||||
|
||||
TROUBLESHOOTING *python-trouble*
|
||||
|
||||
If you have trouble with a plugin that uses the `neovim` Python client, use
|
||||
the |:CheckHealth| command to diagnose your setup.
|
||||
|
||||
==============================================================================
|
||||
Ruby integration *provider-ruby*
|
||||
|
||||
Nvim supports the Vim legacy |ruby-vim| interface via external Ruby
|
||||
interpreters connected via |RPC|.
|
||||
|
||||
Run |:CheckHealth| to see if your system is up-to-date.
|
||||
|
||||
RUBY QUICKSTART ~
|
||||
|
||||
To use Vim Ruby plugins with Nvim, just install the latest `neovim` RubyGem: >
|
||||
$ gem install neovim
|
||||
|
||||
|
||||
RUBY PROVIDER CONFIGURATION ~
|
||||
*g:loaded_ruby_provider*
|
||||
To disable Ruby support: >
|
||||
|
@@ -1,4 +1,4 @@
|
||||
*quickfix.txt* For Vim version 7.4. Last change: 2016 Mar 19
|
||||
*quickfix.txt* For Vim version 7.4. Last change: 2016 Jul 01
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@@ -53,6 +53,10 @@ command with 'l'.
|
||||
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
|
||||
@@ -259,9 +263,23 @@ location list command, it will be aborted.
|
||||
The 'switchbuf' settings are respected when jumping
|
||||
to a buffer.
|
||||
|
||||
:cl[ist] +{count} List the current and next {count} valid errors. This
|
||||
is similar to ":clist from from+count", where "from"
|
||||
is the current error position.
|
||||
|
||||
:cl[ist]! [from] [, [to]]
|
||||
List all errors.
|
||||
|
||||
:cl[ist]! +{count} List the current and next {count} error lines. This
|
||||
is useful to see unrecognized lines after the current
|
||||
one. For example, if ":clist" shows:
|
||||
8384 testje.java:252: error: cannot find symbol ~
|
||||
Then using ":cl! +3" shows the reason:
|
||||
8384 testje.java:252: error: cannot find symbol ~
|
||||
8385: ZexitCode = Fmainx(); ~
|
||||
8386: ^ ~
|
||||
8387: symbol: method Fmainx() ~
|
||||
|
||||
*:lli* *:llist*
|
||||
:lli[st] [from] [, [to]]
|
||||
Same as ":clist", except the location list for the
|
||||
@@ -306,7 +324,7 @@ EXECUTE A COMMAND IN ALL THE BUFFERS IN QUICKFIX OR LOCATION LIST:
|
||||
etc.
|
||||
< When the current file can't be |abandon|ed and the [!]
|
||||
is not present, the command fails.
|
||||
When an error is detected excecution stops.
|
||||
When an error is detected execution stops.
|
||||
The last buffer (or where an error occurred) becomes
|
||||
the current buffer.
|
||||
{cmd} can contain '|' to concatenate several commands.
|
||||
@@ -1493,12 +1511,6 @@ However, to properly parse such a complex file, an external filter should
|
||||
be used. See the description further above how to make such a filter known
|
||||
by Vim.
|
||||
|
||||
*errorformat-Perl*
|
||||
In $VIMRUNTIME/tools you can find the efm_perl.pl script, which filters Perl
|
||||
error messages into a format that quickfix mode will understand. See the
|
||||
start of the file about how to use it. (This script is deprecated, see
|
||||
|compiler-perl|.)
|
||||
|
||||
|
||||
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
||||
|
@@ -1,275 +0,0 @@
|
||||
*quotes.txt* For Vim version 7.4. Last change: 2010 Nov 03
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
|
||||
|
||||
*quotes*
|
||||
Here are some nice quotes about Vim that I collected from news and mail.
|
||||
|
||||
|
||||
vim (vim) noun - Ebullient vitality and energy. [Latin, accusative of vis,
|
||||
strength] (Dictionary)
|
||||
|
||||
Vim is so much better than vi that a great many of my old vi :map's became
|
||||
immediately obsolete! (Tony Nugent, Australia)
|
||||
|
||||
Coming with a very GUI mindset from Windows, I always thought of people using
|
||||
Vi as some kind of outer space alien in human clothes. Once I tried I really
|
||||
got addicted by its power and now I found myself typing Vim keypresses in the
|
||||
oddest places! That's why I would like to see Vim embedded in every
|
||||
application which deals with text editing. (Jos<6F> Fonseca)
|
||||
|
||||
I was a 12-year emacs user who switched to Vim about a year ago after finally
|
||||
giving up on the multiple incompatible versions, flaky contributed packages,
|
||||
disorganized keystrokes, etc. And it was one of the best moves I ever made.
|
||||
(Joel Burton)
|
||||
|
||||
Although all of the programs were used during the preparation of the new and
|
||||
revised material, most of the editing was done with Vim versions 4.5 and 5.0
|
||||
under GNU-Linux (Redhat 4.2). (Arnold Robbins, Israel, author of "Learning
|
||||
the Vi editor")
|
||||
|
||||
Out of all the open software i've ever seen and used, and i've seen a lot, Vim
|
||||
is the best, most useful and highest quality to work with, second only to the
|
||||
linux kernel itself. (Peter Jay Salzman)
|
||||
|
||||
It's well worth noting that the _entirety_ of SourceForge was written using
|
||||
Vim and its nifty PHP syntax highlighting. I think the entire SF.net tech
|
||||
staff uses Vim and we're all excited to have you aboard! (Tim Perdue)
|
||||
|
||||
Vim is one of a select bunch of tools for which I have no substitute. It is
|
||||
a brilliant piece of work! (Biju Chacko)
|
||||
|
||||
A previous girlfriend of mine switched to emacs. Needless to say, the
|
||||
relationship went nowhere. (Geoffrey Mann)
|
||||
|
||||
I rarely think about Vim, in the same way that I guess a fish rarely thinks
|
||||
about water. It's the environment in which everything else happens. I'm a
|
||||
fairly busy system administrator working on a lot of different platforms. Vim
|
||||
is the only thing that's consistent across all my systems, and it's just about
|
||||
the only thing that doesn't break from time to time. When a new system comes
|
||||
in the door without Vim, I install it right away. Great to have a tool that's
|
||||
the same everywhere, that's completely reliable, so I can ignore it and think
|
||||
about other things. (Pete Schaeffer)
|
||||
|
||||
Having recently succeeded in running Vim via telnet through a Nokia
|
||||
Communicator, I can now report that it works nicely on a Palm Pilot too.
|
||||
(Allan Kelly, Scotland)
|
||||
|
||||
You've done a tremendous job with 'VIM', Bram! The more I use it, the more
|
||||
impressed I get (I am an old 'vi' die hard who once started out with early
|
||||
versions of 'emacs' in the late 1970's and was relieved by finding 'vi' in the
|
||||
first UNIX I came across in 1983). In my opinion, it's about time 'VIM'
|
||||
replace 'emacs' as the standard for top editors. (Bo Thide', Sweden)
|
||||
|
||||
I love and use VIM heavily too. (Larry Wall)
|
||||
|
||||
Vi is like a Ferrari, if you're a beginner, it handles like a bitch, but once
|
||||
you get the hang of it, it's small, powerful and FAST! (Unknown)
|
||||
VIM is like a new model Ferrari, and sounds like one too - "VIIIIIIMMM!"
|
||||
(Stephen Riehm, Germany)
|
||||
|
||||
Schon bei Nutzung eines Bruchteils der VIM-Funktionen wird der Benutzer recht
|
||||
schnell die Vorzuege dieses Editors kennen- und schaetzenlernen.
|
||||
Translated: Even when only using a fraction of VIM-functions, the user will
|
||||
quickly get used to and appreciate the advantages of this editor. (Garry
|
||||
Glendown, conclusion of an article on VIM in iX magazine 9/1998)
|
||||
|
||||
I've recently acquired the O'Reilly book on VI (it also discusses VIM
|
||||
in-depth), and I'm amazed at just how powerful this application is. (Jeffrey
|
||||
Rankin)
|
||||
|
||||
This guide was written using the Windows 9.x distribution of GVIM, which is
|
||||
quite possibly the greatest thing to come along since God created the naked
|
||||
girl. (Michael DiBernardo)
|
||||
|
||||
Boy, I thought I knew almost everything about VIM, but every time I browse the
|
||||
online documentation, I hit upon a minor but cool aspect of a VIM feature that
|
||||
I didn't know before! I must say the documentation is one the finest I've
|
||||
ever seen in a product -- even better than most commercial products.
|
||||
(Gautam Mudunuri)
|
||||
|
||||
VIM 4.5 is really a fantastic editor. It has sooooo many features and more
|
||||
importantly, the defaults are so well thought out that you really don't have
|
||||
to change anything!! Words cannot express my amazement and gratitude to the
|
||||
creators of VIM. Keep it up. (Vikas, USA)
|
||||
|
||||
I wonder how long it will be before people will refer to other Vi editors as
|
||||
VIM clones? (Darren Hiebert)
|
||||
|
||||
I read about [auto-positioning-in-file-based-on-the-errors-from-make] in one
|
||||
of those "Perfect Programmer's Editor" threads and was delighted to discover
|
||||
that VIM already supports it. (Brendan Macmillan, Australia)
|
||||
|
||||
I just discovered VIM (5.0) and I'm telling everyone I know about it!
|
||||
I tell them VIM stands for VI for the new (M)illenium. Thanks so much!
|
||||
(Matt F. Valentine)
|
||||
|
||||
I think from now on "vi" should be called "Vim Imitation", not the other way
|
||||
around. (Rungun Ramanathan)
|
||||
|
||||
The Law of VIM:
|
||||
For each member b of the possible behaviour space B of program P, there exists
|
||||
a finite time t before which at least one user u in the total user space U of
|
||||
program P will request b becomes a member of the allowed behaviour space B'
|
||||
(B' <= B).
|
||||
In other words: Sooner or later everyone wants everything as an option.
|
||||
(Negri)
|
||||
|
||||
Whenever I move to a new computing platform, the first thing I do is to port
|
||||
VIM. Lately, I am simply stunned by its ease of compilation using the
|
||||
configure facility. (A.M. Sabuncu, Turkey)
|
||||
|
||||
The options are really excellent and very powerful. (Anish Maharaj)
|
||||
|
||||
The Spring user-interface designs are in, and word from the boutiques is that
|
||||
80x24 text-only mode is back with a *vengeance! Vi editor clone VIM burst onto
|
||||
March desk-tops with a dazzling show of pastel syntax highlights for its 5.0
|
||||
look. Strident and customizable, VIM raises eyebrows with its interpretation
|
||||
of the classic Vi single-key macro collection.
|
||||
http://www.ntk.net/index.cgi?back=archive98/now0327.txt&line=179#l
|
||||
|
||||
I just wanted to take this opportunity to let you know that VIM 5 ROCKS!
|
||||
Syntax highlighting: how did I survive without it?! Thank you for creating
|
||||
mankind's best editor! (Mun Johl, USA)
|
||||
|
||||
Thanks again for VIM. I use it every day on Linux. (Eric Foster-Johnson,
|
||||
author of the book "UNIX Programming Tools")
|
||||
|
||||
The BEST EDITOR EVER (Stuart Woolford)
|
||||
|
||||
I have used most of VIM's fancy features at least once, many frequently, and I
|
||||
can honestly say that I couldn't live with anything less anymore. My
|
||||
productivity has easily doubled compared to what it was when I used vi.
|
||||
(Sitaram Chamarty)
|
||||
|
||||
I luv VIM. It is incredible. I'm naming my first-born Vimberly. (Jose
|
||||
Unpingco, USA)
|
||||
|
||||
Hint: "VIM" is "vi improved" - much better! (Sven Guckes, Germany)
|
||||
|
||||
I use VIM every day. I spend more time in VIM than in any other program...
|
||||
It's the best vi clone there is. I think it's great. (Craig Sanders,
|
||||
Australia)
|
||||
|
||||
I strongly advise using VIM--its infinite undo/redo saved me much grief.
|
||||
(Terry Brown)
|
||||
|
||||
Thanks very much for writing what in my opinion is the finest text editor on
|
||||
the planet. If I were to get another cat, I would name it "Vim".
|
||||
(Bob Sheehan, USA)
|
||||
|
||||
I typed :set all and the screen FILLED up with options. A whole screen of
|
||||
things to be set and unset. I saw some of my old friends like wrapmargin,
|
||||
modelines and showmode, but the screen was FILLED with new friends! I love
|
||||
them all! I love VIM! I'm so happy that I've found this editor! I feel
|
||||
like how I once felt when I started using vi after a couple of years of using
|
||||
ed. I never thought I'd forsake my beloved ed, but vi ... oh god, vi was
|
||||
great. And now, VIM. (Peter Jay Salzman, USA)
|
||||
|
||||
I am really happy with such a wonderful software package. Much better than
|
||||
almost any expensive, off the shelf program. (Jeff Walker)
|
||||
|
||||
Whenever I reread the VIM documentation I'm overcome with excitement at the
|
||||
power of the editor. (William Edward Webber, Australia)
|
||||
|
||||
Hurrah for VIM!! It is "at your fingertips" like vi, and has the extensions
|
||||
that vi sorely needs: highlighting for executing commands on blocks, an easily
|
||||
navigable and digestible help screen, and more. (Paul Pax)
|
||||
|
||||
The reason WHY I don't have this amazingly useful macro anymore, is that I
|
||||
now use VIM - and this is built in!! (Stephen Riehm, Germany)
|
||||
|
||||
I am a user of VIM and I love it. I use it to do all my programming, C,
|
||||
C++, HTML what ever. (Tim Allwine)
|
||||
|
||||
I discovered VIM after years of struggling with the original vi, and I just
|
||||
can't live without it anymore. (Emmanuel Mogenet, USA)
|
||||
|
||||
Emacs has not a bit of chance to survive so long as VIM is around. Besides,
|
||||
it also has the most detailed software documentation I have ever seen---much
|
||||
better than most commercial software! (Leiming Qian)
|
||||
|
||||
This version of VIM will just blow people apart when they discover just how
|
||||
fantastic it is! (Tony Nugent, Australia)
|
||||
|
||||
I took your advice & finally got VIM & I'm really impressed. Instant convert.
|
||||
(Patrick Killelea, USA)
|
||||
|
||||
VIM is by far my favorite piece of shareware and I have been particularly
|
||||
pleased with version 3.0. This is really a solid piece of work. (Robert
|
||||
Colon, USA)
|
||||
|
||||
VIM is a joy to use, it is so well thought and practical that I wonder why
|
||||
anybody would use visual development tools. VIM is powerful and elegant, it
|
||||
looks deceptively simple but is almost as complex as a 747 (especially when I
|
||||
look at my growing vimrc), keep up that wonderful job, VIM is a centerpiece
|
||||
of the free software world. (Louis-David Mitterand, USA)
|
||||
|
||||
I cannot believe how great it is to use VIM. I think the guys at work are
|
||||
getting tired of hearing me bragging about it. Others eyes are lighting up.
|
||||
(Rick Croote)
|
||||
|
||||
Emacs takes way too much time to start up and run, it is too big and bulky for
|
||||
effective use and the interface is more confusing than it is of any help. VIM
|
||||
however is short, it is fast, it is powerful, it has a good interface and it
|
||||
is all purpose. (Paal Ditlefsen Ekran)
|
||||
|
||||
From the first time I got VIM3.0, I was very enthusiastic. It has almost no
|
||||
problems. The swapfile handling and the backup possibilities are robust, also
|
||||
the protection against editing one file twice. It is very compatible to the
|
||||
real VI (and that is a MUST, because my brain is trained over years in using
|
||||
it). (Gert van Antwerpen, Holland)
|
||||
|
||||
Visual mode in VIM is a very powerful thing! (Tony Nugent, Australia)
|
||||
|
||||
I have to say that VIM is =THE= single greatest piece of source code to ever
|
||||
come across the net (Jim Battle, USA).
|
||||
|
||||
In fact, if you do want to get a new vi I'd suggest VIM-3.0. This is, by
|
||||
far, the best version of vi I've ever seen (Albert W. Schueller).
|
||||
|
||||
I should mention that VIM is a very good editor and can compete with anything
|
||||
(Ilya Beloozerov).
|
||||
|
||||
To tell the truth sometimes I used elvis, vile, xvi, calvin, etc. And this is
|
||||
the reason that I can state that VIM is the best! (Ferenc Deak, Hungary)
|
||||
|
||||
VIM is by far the best editor that I have used in a long time, and I have
|
||||
looked at just about every thing that is available for every platform that I
|
||||
use. VIM is the best on all of them. (Guy L. Oliver)
|
||||
|
||||
VIM is the greatest editor since the stone chisel. (Jose Unpingco, USA)
|
||||
|
||||
I would like to say that with VIM I am finally making the 'emacs to vi'
|
||||
transition - as an Editor it is so much better in many ways: keyboard layout,
|
||||
memory usage, text alteration to name 3. (Mark Adam)
|
||||
|
||||
In fact, now if I want to know what a particular setting does in vi, I fire up
|
||||
VIM and check out its help! (Nikhil Patel, USA)
|
||||
|
||||
As a vi user, VIM has made working with text a far more pleasant task than
|
||||
before I encountered this program. (Steinar Knutsen, Norway)
|
||||
|
||||
I use VIM since version 3.0. Since that time, it is the ONLY editor I use,
|
||||
with Solaris, Linux and OS/2 Warp. I suggest all my friends to use VIM, they
|
||||
try, and they continue using it. VIM is really the best software I have ever
|
||||
downloaded from the Internet, and the best editor I know of. (Marco
|
||||
Eccettuato, Italy)
|
||||
|
||||
|
||||
In summary:
|
||||
__ ___ _ _ _ ___ _____ `
|
||||
\ \ / (_)_ __ ___ (_)___ | | | |/ _ \_ _| `
|
||||
\ \ / /| | '_ ` _ \ | / __| | |_| | | | || | `
|
||||
\ V / | | | | | | | | \__ \ | _ | |_| || | `
|
||||
\_/ |_|_| |_| |_| |_|___/ |_| |_|\___/ |_| `
|
||||
____ _____ _ _ _____ _____ _ _ `
|
||||
/ ___|_ _| | | | ___| ___| | | `
|
||||
\___ \ | | | | | | |_ | |_ | | | `
|
||||
___) || | | |_| | _| | _| |_|_| `
|
||||
|____/ |_| \___/|_| |_| (_|_) (Tony Nugent, Australia) `
|
||||
|
||||
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
@@ -223,6 +223,8 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|.
|
||||
pack/*/opt/{name} ~
|
||||
The directory is added to 'runtimepath' if it wasn't
|
||||
there yet.
|
||||
If the directory pack/*/opt/{name}/after exists it is
|
||||
added at the end of 'runtimepath'.
|
||||
|
||||
Note that {name} is the directory name, not the name
|
||||
of the .vim file. All the files matching the pattern
|
||||
@@ -492,6 +494,9 @@ To load packages earlier, so that 'runtimepath' gets updated: >
|
||||
This also works when loading plugins is disabled. The automatic loading will
|
||||
only happen once.
|
||||
|
||||
If the package has an "after" directory, that directory is added to the end of
|
||||
'runtimepath', so that anything there will be loaded later.
|
||||
|
||||
|
||||
Using a single plugin and loading it automatically ~
|
||||
|
||||
|
@@ -198,7 +198,8 @@ argument.
|
||||
-Z Restricted mode. All commands that make use of an external
|
||||
shell are disabled. This includes suspending with CTRL-Z,
|
||||
":sh", filtering, the system() function, backtick expansion,
|
||||
delete(), rename(), mkdir(), writefile(), libcall(), etc.
|
||||
delete(), rename(), mkdir(), writefile(), libcall(),
|
||||
jobstart(), etc.
|
||||
|
||||
*-e*
|
||||
-e Start Vim in Ex mode |Q|.
|
||||
@@ -1178,9 +1179,6 @@ running) you have additional options:
|
||||
already set (registers, marks, |v:oldfiles|, etc.)
|
||||
will be overwritten.
|
||||
|
||||
*:rv* *:rviminfo*
|
||||
:rv[iminfo][!] [file] Deprecated alias to |:rshada| command.
|
||||
|
||||
*:wsh* *:wshada* *E137*
|
||||
:wsh[ada][!] [file] Write to ShaDa file [file] (default: see above).
|
||||
The information in the file is first read in to make
|
||||
@@ -1196,9 +1194,6 @@ running) you have additional options:
|
||||
|
||||
Note: Executing :wshada will reset all |'quote| marks.
|
||||
|
||||
*:wv* *:wviminfo*
|
||||
:wv[iminfo][!] [file] Deprecated alias to |:wshada| command.
|
||||
|
||||
*:o* *:ol* *:oldfiles*
|
||||
:o[ldfiles] List the files that have marks stored in the ShaDa
|
||||
file. This list is read on startup and only changes
|
||||
|
@@ -4852,6 +4852,9 @@ SignColumn column where |signs| are displayed
|
||||
*hl-IncSearch*
|
||||
IncSearch 'incsearch' highlighting; also used for the text replaced with
|
||||
":s///c"
|
||||
*hl-Substitute*
|
||||
Substitute |:substitute| replacement text highlighting
|
||||
|
||||
*hl-LineNr*
|
||||
LineNr Line number for ":number" and ":#" commands, and when 'number'
|
||||
or 'relativenumber' option is set.
|
||||
@@ -4883,6 +4886,10 @@ PmenuSbar Popup menu: scrollbar.
|
||||
PmenuThumb Popup menu: Thumb of the scrollbar.
|
||||
*hl-Question*
|
||||
Question |hit-enter| prompt and yes/no questions
|
||||
*hl-QuickFixLine*
|
||||
QuickFixLine The selected |quickfix| item in the quickfix window.
|
||||
|hl-CursorLine| is combined with this when the cursor is on
|
||||
the currently selected quickfix item.
|
||||
*hl-Search*
|
||||
Search Last search pattern highlighting (see 'hlsearch').
|
||||
Also used for highlighting the current line in the quickfix
|
||||
@@ -4922,8 +4929,6 @@ TabLineSel tab pages line, active tab page label
|
||||
Title titles for output from ":set all", ":autocmd" etc.
|
||||
*hl-Visual*
|
||||
Visual Visual mode selection
|
||||
*hl-VisualNOS*
|
||||
VisualNOS Removed. |vim-differences| {Nvim}
|
||||
*hl-WarningMsg*
|
||||
WarningMsg warning messages
|
||||
*hl-WildMenu*
|
||||
|
@@ -83,14 +83,21 @@ In the GUI tab pages line you can use the right mouse button to open menu.
|
||||
Execute {cmd} and when it opens a new window open a new tab
|
||||
page instead. Doesn't work for |:diffsplit|, |:diffpatch|,
|
||||
|:execute| and |:normal|.
|
||||
When [count] is omitted the tab page appears after the current
|
||||
one.
|
||||
When [count] is specified the new tab page comes after tab
|
||||
page [count]. Use ":0tab cmd" to get the new tab page as the
|
||||
first one.
|
||||
If [count] is given the new tab page appears after the tab
|
||||
page [count] otherwise the new tab page will appear after the
|
||||
current one.
|
||||
Examples: >
|
||||
:tab split " opens current buffer in new tab page
|
||||
:tab help gt " opens tab page with help for "gt"
|
||||
:tab split " opens current buffer in new tab page
|
||||
:tab help gt " opens tab page with help for "gt"
|
||||
:.tab help gt " as above
|
||||
:+tab help " opens tab page with help after the next
|
||||
" tab page
|
||||
:-tab help " opens tab page with help before the
|
||||
" current one
|
||||
:0tab help " opens tab page with help before the
|
||||
" first one
|
||||
:$tab help " opens tab page with help after the last
|
||||
" one
|
||||
|
||||
CTRL-W gf Open a new tab page and edit the file name under the cursor.
|
||||
See |CTRL-W_gf|.
|
||||
@@ -140,7 +147,7 @@ something else.
|
||||
|
||||
:{count}tabo[nly][!]
|
||||
Close all tab pages except the {count}th one. >
|
||||
:.tabonly " one
|
||||
:.tabonly " as above
|
||||
:-tabonly " close all tab pages except the previous one
|
||||
:+tabonly " close all tab pages except the next one
|
||||
:1tabonly " close all tab pages except the first one
|
||||
|
@@ -36,9 +36,10 @@ these differences.
|
||||
- 'autoindent' is set by default
|
||||
- 'autoread' is set by default
|
||||
- 'backspace' defaults to "indent,eol,start"
|
||||
- 'backupdir' defaults to .,~/.local/share/nvim/backup (|xdg|)
|
||||
- 'complete' doesn't include "i"
|
||||
- 'directory' defaults to ~/.local/share/nvim/swap// (|xdg|), auto-created
|
||||
- 'display' defaults to "lastline"
|
||||
- 'encoding' defaults to "utf-8"
|
||||
- 'formatoptions' defaults to "tcqj"
|
||||
- 'history' defaults to 10000 (the maximum)
|
||||
- 'hlsearch' is set by default
|
||||
@@ -54,6 +55,7 @@ these differences.
|
||||
- 'tabpagemax' defaults to 50
|
||||
- 'tags' defaults to "./tags;,tags"
|
||||
- 'ttyfast' is always set
|
||||
- 'undodir' defaults to ~/.local/share/nvim/undo (|xdg|), auto-created
|
||||
- 'viminfo' includes "!"
|
||||
- 'wildmenu' is set by default
|
||||
|
||||
@@ -61,7 +63,7 @@ these differences.
|
||||
3. New Features *nvim-features*
|
||||
|
||||
|
||||
MAJOR FEATURES ~
|
||||
MAJOR COMPONENTS ~
|
||||
|
||||
Embedded terminal emulator |terminal-emulator|
|
||||
RPC API |RPC|
|
||||
@@ -73,44 +75,65 @@ Python plugins |provider-python|
|
||||
Clipboard integration |provider-clipboard|
|
||||
|
||||
|
||||
OTHER FEATURES ~
|
||||
USER EXPERIENCE ~
|
||||
|
||||
A major goal of Nvim is to work intuitively and consistently. For example,
|
||||
Nvim does not have `-X`, a platform-specific option available in some Vim
|
||||
builds (with potential surprises: http://stackoverflow.com/q/14635295). Nvim
|
||||
avoids features that cannot be provided on all platforms--instead that is
|
||||
delegated to external plugins/extensions.
|
||||
|
||||
|
||||
ARCHITECTURE ~
|
||||
|
||||
External plugins run in separate processes. |remote-plugin| This improves
|
||||
stability and allows those plugins to perform tasks without blocking the
|
||||
editor. Even "legacy" Python and Ruby plugins which use the old Vim interfaces
|
||||
(|if_py| and |if_ruby|) run out-of-process.
|
||||
|
||||
|
||||
FEATURES ~
|
||||
|
||||
|bracketed-paste-mode| is built-in and enabled by default.
|
||||
|
||||
Meta (alt) chords are recognized (even in the terminal).
|
||||
<M-1>, <M-2>, ...
|
||||
<M-BS>, <M-Del>, <M-Ins>, ...
|
||||
<M-/>, <M-\>, ...
|
||||
<M-Space>, <M-Enter>, <M-=>, <M-->, <M-?>, <M-$>, ...
|
||||
|
||||
Note: Meta chords are case-sensitive (<M-a> is distinguished from <M-A>).
|
||||
|META| (ALT) chords are recognized, even in the terminal. Any |<M-| mapping
|
||||
will work. Some examples: <M-1>, <M-2>, <M-BS>, <M-Del>, <M-Ins>, <M-/>,
|
||||
<M-\>, <M-Space>, <M-Enter>, <M-=>, <M-->, <M-?>, <M-$>, ...
|
||||
META chords are case-sensitive: <M-a> and <M-A> are two different keycodes.
|
||||
|
||||
Some `CTRL-SHIFT-...` key chords are distinguished from `CTRL-...` variants
|
||||
(even in the terminal). Specifically, the following are known to work:
|
||||
<C-Tab>, <C-S-Tab>
|
||||
<C-BS>, <C-S-BS>
|
||||
<C-Enter>, <C-S-Enter>
|
||||
<C-Tab>, <C-S-Tab>, <C-BS>, <C-S-BS>, <C-Enter>, <C-S-Enter>
|
||||
|
||||
Options:
|
||||
'inccommand' shows results while typing a |:substitute| command
|
||||
'statusline' supports unlimited alignment sections
|
||||
'tabline' %@Func@foo%X can call any function on mouse-click
|
||||
|
||||
Variables:
|
||||
|v:event|
|
||||
|v:windowid| is always available (for use by external UIs)
|
||||
|
||||
Commands:
|
||||
|:CheckHealth|
|
||||
|:drop| is available on all platforms
|
||||
|:Man| is available by default, with many improvements such as completion
|
||||
|
||||
Functions:
|
||||
|dictwatcheradd()| notifies a callback whenever a |Dict| is modified
|
||||
|dictwatcherdel()|
|
||||
|execute()| works with |:redir|
|
||||
|msgpackdump()|, |msgpackparse()| provide msgpack de/serialization
|
||||
|
||||
Events:
|
||||
|TabNew|
|
||||
|TabNewEntered|
|
||||
|TabClosed|
|
||||
|TermOpen|
|
||||
|TermClose|
|
||||
|TermOpen|
|
||||
|TextYankPost|
|
||||
|
||||
Highlight groups:
|
||||
|hl-EndOfBuffer|
|
||||
|hl-QuickFixLine|
|
||||
|hl-Substitute|
|
||||
|hl-TermCursor|
|
||||
|hl-TermCursorNC|
|
||||
|
||||
@@ -127,10 +150,10 @@ are always available and may be used simultaneously in separate plugins. The
|
||||
`neovim` pip package must be installed to use Python plugins in Nvim (see
|
||||
|provider-python|).
|
||||
|
||||
|:!| and |system()| do not support "interactive" commands; use |:terminal| for
|
||||
that instead. Terminal Vim supports interactive |:!| and |system()|, but gui
|
||||
Vim does not. See ":help gui-pty" in Vim:
|
||||
http://vimdoc.sourceforge.net/htmldoc/gui_x11.html#gui-pty
|
||||
|:!| does not support "interactive" commands. Use |:terminal| instead.
|
||||
(GUI Vim has a similar limitation, see ":help gui-pty" in Vim.)
|
||||
|
||||
|system()| does not support writing/reading "backgrounded" commands. |E5677|
|
||||
|
||||
|mkdir()| behaviour changed:
|
||||
1. Assuming /tmp/foo does not exist and /tmp can be written to
|
||||
@@ -140,7 +163,7 @@ Vim does not. See ":help gui-pty" in Vim:
|
||||
'p')) mkdir() will silently exit. In Vim this was an error.
|
||||
3. mkdir() error messages now include strerror() text when mkdir fails.
|
||||
|
||||
'encoding' cannot be changed after startup.
|
||||
'encoding' is always "utf-8".
|
||||
|
||||
|string()| and |:echo| behaviour changed:
|
||||
1. No maximum recursion depth limit is applied to nested container
|
||||
@@ -219,10 +242,12 @@ planned for the current milestone.
|
||||
|
||||
These features are in Vim, but have been intentionally removed from Nvim.
|
||||
|
||||
Vi-compatible mode:
|
||||
*'cp'* *'nocompatible'* *'nocp'* *'compatible'*
|
||||
Nvim is always "non-compatible" with Vi.
|
||||
":set nocompatible" is ignored
|
||||
":set compatible" is an error
|
||||
|
||||
*'ed'* *'edcompatible'* *'noed'* *'noedcompatible'*
|
||||
Ed-compatible mode:
|
||||
":set noedcompatible" is ignored
|
||||
":set edcompatible" is an error
|
||||
@@ -232,8 +257,8 @@ Ed-compatible mode:
|
||||
":set nottyfast" is an error
|
||||
|
||||
Encryption support:
|
||||
'cryptmethod'
|
||||
'key'
|
||||
*'cryptmethod'* *'cm'*
|
||||
*'key'*
|
||||
|
||||
MS-DOS support:
|
||||
'bioskey'
|
||||
@@ -244,27 +269,28 @@ Highlight groups:
|
||||
|
||||
Other options:
|
||||
'antialias'
|
||||
'cpoptions' ('g', 'w', 'H', '*', '-', 'j', and all POSIX flags were removed)
|
||||
'guioptions' (only the 't' flag was removed)
|
||||
'guipty'
|
||||
'imactivatefunc'
|
||||
'imactivatekey'
|
||||
'imstatusfunc'
|
||||
'macatsui'
|
||||
'restorescreen'
|
||||
'cpoptions' ("g", "w", "H", "*", "-", "j", and all POSIX flags were removed)
|
||||
'encoding' ("utf-8" is always used)
|
||||
'guioptions' "t" flag was removed
|
||||
*'guipty'* (Nvim uses pipes and PTYs consistently on all platforms.)
|
||||
*'imactivatefunc'* *'imaf'*
|
||||
*'imactivatekey'* *'imak'*
|
||||
*'imstatusfunc'* *'imsf'*
|
||||
*'macatsui'*
|
||||
*'restorescreen'* *'rs'* *'norestorescreen'* *'nors'*
|
||||
'shelltype'
|
||||
'shortname'
|
||||
'swapsync'
|
||||
'term'
|
||||
'termencoding' (Vim 7.4.852 also removed this for Windows)
|
||||
*'shortname'* *'sn'* *'noshortname'* *'nosn'*
|
||||
*'swapsync'* *'sws'*
|
||||
*'term'* *E529* *E530* *E531*
|
||||
*'termencoding'* *'tenc'* (Vim 7.4.852 also removed this for Windows)
|
||||
'textauto'
|
||||
'textmode'
|
||||
'toolbar'
|
||||
'toolbariconsize'
|
||||
'ttybuiltin'
|
||||
'ttymouse'
|
||||
'ttyscroll'
|
||||
'ttytype'
|
||||
*'toolbar'* *'tb'*
|
||||
*'toolbariconsize'* *'tbis'*
|
||||
*'ttybuiltin'* *'tbi'* *'nottybuiltin'* *'notbi'*
|
||||
*'ttymouse'* *'ttym'*
|
||||
*'ttyscroll'* *'tsl'*
|
||||
*'ttytype'* *'tty'*
|
||||
'weirdinvert'
|
||||
|
||||
Other commands:
|
||||
@@ -274,6 +300,7 @@ Other commands:
|
||||
:mode (no longer accepts an argument)
|
||||
:open
|
||||
:shell
|
||||
:smile
|
||||
:tearoff
|
||||
|
||||
Other compile-time features:
|
||||
|
@@ -1,7 +1,7 @@
|
||||
" Vim support file to detect file types
|
||||
"
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2015 Oct 13
|
||||
" Last Change: 2016 Jul 12
|
||||
|
||||
" Listen very carefully, I will say this only once
|
||||
if exists("did_load_filetypes")
|
||||
@@ -1617,11 +1617,9 @@ au BufNewFile,BufRead */etc/protocols setf protocols
|
||||
" Pyrex
|
||||
au BufNewFile,BufRead *.pyx,*.pxd setf pyrex
|
||||
|
||||
" Python
|
||||
au BufNewFile,BufRead *.py,*.pyw setf python
|
||||
|
||||
" Python, Python Shell Startup Files
|
||||
" Quixote (Python-based web framework)
|
||||
au BufNewFile,BufRead *.ptl setf python
|
||||
au BufNewFile,BufRead *.py,*.pyw,.pythonstartup,.pythonrc,*.ptl setf python
|
||||
|
||||
" Radiance
|
||||
au BufNewFile,BufRead *.rad,*.mat setf radiance
|
||||
|
@@ -55,5 +55,7 @@ if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
|
||||
endif
|
||||
endif
|
||||
|
||||
let b:man_default_sects = '3,2'
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
19
runtime/ftplugin/groovy.vim
Normal file
19
runtime/ftplugin/groovy.vim
Normal file
@@ -0,0 +1,19 @@
|
||||
" Vim filetype plugin file
|
||||
" Language: groovy
|
||||
" Maintainer: Justin M. Keyes <justinkz@gmail.com>
|
||||
" Last Change: 2016 May 22
|
||||
|
||||
if exists('b:did_ftplugin')
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo-=C
|
||||
|
||||
let b:undo_ftplugin = 'setlocal commentstring<'
|
||||
|
||||
setlocal commentstring=//%s
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
@@ -1,25 +1,15 @@
|
||||
" Maintainer: Anmol Sethi <anmol@aubble.com>
|
||||
" Previous Maintainer: SungHyun Nam <goweol@gmail.com>
|
||||
|
||||
if exists('b:did_ftplugin') || &filetype !=# 'man'
|
||||
if exists('b:did_ftplugin')
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
let s:pager = 0
|
||||
let s:pager = !exists('b:man_sect')
|
||||
|
||||
if has('vim_starting')
|
||||
let s:pager = 1
|
||||
" remove all those backspaces
|
||||
silent execute 'keeppatterns keepjumps %substitute,.\b,,e'.(&gdefault?'':'g')
|
||||
if getline(1) =~# '^\s*$'
|
||||
silent keepjumps 1delete _
|
||||
else
|
||||
keepjumps 1
|
||||
endif
|
||||
" This is not perfect. See `man glDrawArraysInstanced`. Since the title is
|
||||
" all caps it is impossible to tell what the original capitilization was.
|
||||
execute 'file man://'.tolower(matchstr(getline(1), '^\S\+'))
|
||||
if s:pager
|
||||
call man#init_pager()
|
||||
endif
|
||||
|
||||
setlocal buftype=nofile
|
||||
@@ -41,8 +31,8 @@ setlocal nolist
|
||||
setlocal nofoldenable
|
||||
|
||||
if !exists('g:no_plugin_maps') && !exists('g:no_man_maps')
|
||||
nmap <silent> <buffer> <C-]> <Plug>(Man)
|
||||
nmap <silent> <buffer> K <Plug>(Man)
|
||||
nmap <silent> <buffer> <C-]> :Man<CR>
|
||||
nmap <silent> <buffer> K :Man<CR>
|
||||
nnoremap <silent> <buffer> <C-T> :call man#pop_tag()<CR>
|
||||
if s:pager
|
||||
nnoremap <silent> <buffer> <nowait> q :q<CR>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
" Header: "{{{
|
||||
" Maintainer: Bram Moolenaar
|
||||
" Original Author: Andy Wokula <anwoku@yahoo.de>
|
||||
" Last Change: 2015 Sep 25
|
||||
" Last Change: 2016 Mar 30
|
||||
" Version: 1.0
|
||||
" Description: HTML indent script with cached state for faster indenting on a
|
||||
" range of lines.
|
||||
@@ -240,13 +240,13 @@ call s:AddITags(s:indent_tags, [
|
||||
\ 'sup', 'table', 'textarea', 'title', 'tt', 'u', 'ul', 'var', 'th', 'td',
|
||||
\ 'tr', 'tbody', 'tfoot', 'thead'])
|
||||
|
||||
" Tags added 2011 Sep 09 (especially HTML5 tags):
|
||||
" New HTML5 elements:
|
||||
call s:AddITags(s:indent_tags, [
|
||||
\ 'area', 'article', 'aside', 'audio', 'bdi', 'canvas',
|
||||
\ 'command', 'datalist', 'details', 'embed', 'figure', 'footer',
|
||||
\ 'header', 'group', 'keygen', 'mark', 'math', 'meter', 'nav', 'output',
|
||||
\ 'progress', 'ruby', 'section', 'svg', 'texture', 'time', 'video',
|
||||
\ 'wbr', 'text'])
|
||||
\ 'command', 'data', 'datalist', 'details', 'embed', 'figcaption',
|
||||
\ 'figure', 'footer', 'header', 'keygen', 'mark', 'meter', 'nav', 'output',
|
||||
\ 'progress', 'rp', 'rt', 'ruby', 'section', 'source', 'summary', 'svg',
|
||||
\ 'time', 'track', 'video', 'wbr'])
|
||||
|
||||
" Tags added for web components:
|
||||
call s:AddITags(s:indent_tags, [
|
||||
|
@@ -1,7 +1,7 @@
|
||||
" These commands create the option window.
|
||||
"
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2016 Mar 19
|
||||
" Last Change: 2016 Apr 21
|
||||
|
||||
" If there already is an option window, jump to that one.
|
||||
if bufwinnr("option-window") > 0
|
||||
@@ -710,6 +710,10 @@ call <SID>Header("editing text")
|
||||
call append("$", "undolevels\tmaximum number of changes that can be undone")
|
||||
call append("$", "\t(global or local to buffer)")
|
||||
call append("$", " \tset ul=" . &ul)
|
||||
call append("$", "undofile\tautomatically save and restore undo history")
|
||||
call <SID>BinOptionG("udf", &udf)
|
||||
call append("$", "undodir\tlist of directories for undo files")
|
||||
call <SID>OptionG("udir", &udir)
|
||||
call append("$", "undoreload\tmaximum number lines to save for undo on a buffer reload")
|
||||
call append("$", " \tset ur=" . &ur)
|
||||
call append("$", "modified\tchanges have been made and not written to a file")
|
||||
@@ -1032,10 +1036,6 @@ if has("vertsplit")
|
||||
call append("$", "cmdwinheight\theight of the command-line window")
|
||||
call <SID>OptionG("cwh", &cwh)
|
||||
endif
|
||||
call append("$", "undofile\tautomatically save and restore undo history")
|
||||
call <SID>BinOptionG("udf", &udf)
|
||||
call append("$", "undodir\tlist of directories for undo files")
|
||||
call <SID>OptionG("udir", &udir)
|
||||
|
||||
|
||||
call <SID>Header("executing external commands")
|
||||
@@ -1195,6 +1195,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
|
||||
|
||||
|
||||
|
@@ -5,9 +5,7 @@ if exists('g:loaded_man')
|
||||
endif
|
||||
let g:loaded_man = 1
|
||||
|
||||
command! -range=0 -complete=customlist,man#complete -nargs=+ Man call man#open_page(v:count, v:count1, <f-args>)
|
||||
|
||||
nnoremap <silent> <Plug>(Man) :<C-U>call man#open_page(v:count, v:count1, &filetype ==# 'man' ? expand('<cWORD>') : expand('<cword>'))<CR>
|
||||
command! -range=0 -complete=customlist,man#complete -nargs=* Man call man#open_page(v:count, v:count1, <q-mods>, <f-args>)
|
||||
|
||||
augroup man
|
||||
autocmd!
|
||||
|
@@ -123,7 +123,6 @@ function! s:Match_wrapper(word, forward, mode) range
|
||||
" 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.
|
||||
@@ -135,6 +134,7 @@ function! s:Match_wrapper(word, forward, mode) range
|
||||
\ '\/\*:\*\/,#\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
|
||||
let s:last_words = match_words
|
||||
if match_words !~ s:notslash . '\\\d'
|
||||
let s:do_BR = 0
|
||||
let s:pat = match_words
|
||||
|
@@ -1,7 +1,7 @@
|
||||
" Vim support file to detect file types in scripts
|
||||
"
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last change: 2014 Aug 24
|
||||
" Last change: 2016 May 21
|
||||
|
||||
" This file is called by an autocommand for every file that has just been
|
||||
" loaded into a buffer. It checks if the type of file can be recognized by
|
||||
@@ -240,7 +240,8 @@ else
|
||||
set ft=xhtml
|
||||
|
||||
" HTML (e.g.: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN")
|
||||
elseif s:line1 =~? '\<DOCTYPE\s\+html\>'
|
||||
" Avoid "doctype html", used by slim.
|
||||
elseif s:line1 =~? '<!DOCTYPE\s\+html\>'
|
||||
set ft=html
|
||||
|
||||
" PDF
|
||||
|
@@ -61,6 +61,7 @@ an 50.10.320 &Syntax.AB.Ascii\ Doc :cal SetSyn("asciidoc")<CR>
|
||||
an 50.10.330 &Syntax.AB.ASP\ with\ VBScript :cal SetSyn("aspvbs")<CR>
|
||||
an 50.10.340 &Syntax.AB.ASP\ with\ Perl :cal SetSyn("aspperl")<CR>
|
||||
an 50.10.350 &Syntax.AB.Assembly.680x0 :cal SetSyn("asm68k")<CR>
|
||||
an 50.10.355 &Syntax.AB.Assembly.AVR :cal SetSyn("avra")<CR>
|
||||
an 50.10.360 &Syntax.AB.Assembly.Flat :cal SetSyn("fasm")<CR>
|
||||
an 50.10.370 &Syntax.AB.Assembly.GNU :cal SetSyn("asm")<CR>
|
||||
an 50.10.380 &Syntax.AB.Assembly.GNU\ H-8300 :cal SetSyn("asmh8300")<CR>
|
||||
|
73
runtime/syntax/avra.vim
Normal file
73
runtime/syntax/avra.vim
Normal file
@@ -0,0 +1,73 @@
|
||||
" Vim syntax file
|
||||
" Language: AVR Assembler (AVRA)
|
||||
" AVRA Home: http://avra.sourceforge.net/index.html
|
||||
" AVRA Version: 1.3.0
|
||||
" Maintainer: Marius Ghita <mhitza@gmail.com>
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
setlocal iskeyword=a-z,A-Z,48-57,.,_
|
||||
" 'isident' is a global option, better not set it
|
||||
" setlocal isident=a-z,A-Z,48-57,.,_
|
||||
syn case ignore
|
||||
|
||||
syn keyword avraRegister r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14
|
||||
syn keyword avraRegister r15 r16 r17 r18 r19 r20 r21 r22 r23 r24 r25 r26 r27
|
||||
syn keyword avraRegister r28 r29 r30 r31
|
||||
|
||||
syn keyword avraInstr add adc adiw sub subi sbc sbci sbiw and andi or ori eor
|
||||
syn keyword avraInstr com neg sbr cbr inc dec tst clr ser mul muls mulsu fmul
|
||||
syn keyword avraInstr fmuls fmulsu des rjmp ijmp eijmp jmp rcall icall eicall
|
||||
syn keyword avraInstr call ret reti cpse cp cpc cpi sbrc sbrs sbic sbis brbs
|
||||
syn keyword avraInstr brbc breq brne brcs brcc brsh brlo brmi brpl brge brlt
|
||||
syn keyword avraInstr brhs brhc brts brtc brvs brvc brie brid mov movw ldi lds
|
||||
syn keyword avraInstr ld ldd sts st std lpm elpm spm in out push pop xch las
|
||||
syn keyword avraInstr lac lat lsl lsr rol ror asr swap bset bclr sbi cbi bst bld
|
||||
syn keyword avraInstr sec clc sen cln sez clz sei cli ses cls sev clv set clt
|
||||
syn keyword avraInstr seh clh break nop sleep wdr
|
||||
|
||||
syn keyword avraDirective .byte .cseg .db .def .device .dseg .dw .endmacro .equ
|
||||
syn keyword avraDirective .eseg .exit .include .list .listmac .macro .nolist
|
||||
syn keyword avraDirective .org .set .define .undef .ifdef .ifndef .if .else
|
||||
syn keyword avraDirective .elif .elseif .warning
|
||||
|
||||
syn keyword avraOperator low high byte2 byte3 byte4 lwrd hwrd page exp2 log2
|
||||
|
||||
syn match avraNumericOperator "[-*/+]"
|
||||
syn match avraUnaryOperator "!"
|
||||
syn match avraBinaryOperator "<<\|>>\|<\|<=\|>\|>=\|==\|!="
|
||||
syn match avraBitwiseOperator "[~&^|]\|&&\|||"
|
||||
|
||||
syn match avraBinaryNumber "\<0[bB][0-1]*\>"
|
||||
syn match avraHexNumber "\<0[xX][0-9a-fA-F]\+\>"
|
||||
syn match avraDecNumber "\<\(0\|[1-9]\d*\)\>"
|
||||
|
||||
syn region avraComment start=";" end="$"
|
||||
syn region avraString start="\"" end="\"\|$"
|
||||
|
||||
syn match avraLabel "^\s*[^; \t]\+:"
|
||||
|
||||
hi def link avraBinaryNumber avraNumber
|
||||
hi def link avraHexNumber avraNumber
|
||||
hi def link avraDecNumber avraNumber
|
||||
|
||||
hi def link avraNumericOperator avraOperator
|
||||
hi def link avraUnaryOperator avraOperator
|
||||
hi def link avraBinaryOperator avraOperator
|
||||
hi def link avraBitwiseOperator avraOperator
|
||||
|
||||
|
||||
hi def link avraOperator operator
|
||||
hi def link avraComment comment
|
||||
hi def link avraDirective preproc
|
||||
hi def link avraRegister type
|
||||
hi def link avraNumber constant
|
||||
hi def link avraString String
|
||||
hi def link avraInstr keyword
|
||||
hi def link avraLabel label
|
||||
|
||||
let b:current_syntax = "avra"
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
@@ -1,15 +1,15 @@
|
||||
" Vim syntax file
|
||||
" Language: awk, nawk, gawk, mawk
|
||||
" Maintainer: Antonio Colombo <azc100@gmail.com>
|
||||
" Last Change: 2014 Oct 21
|
||||
" Last Change: 2016 Jul 15
|
||||
|
||||
" AWK ref. is: Alfred V. Aho, Brian W. Kernighan, Peter J. Weinberger
|
||||
" AWK ref. is: Alfred V. Aho, Brian W. Kernighan, Peter J. Weinberger
|
||||
" The AWK Programming Language, Addison-Wesley, 1988
|
||||
|
||||
" GAWK ref. is: Arnold D. Robbins
|
||||
" Effective AWK Programming, Third Edition, O'Reilly, 2001
|
||||
" Effective AWK Programming, Fourth Edition, O'Reilly, 2015
|
||||
" (also available with the gawk source distribution)
|
||||
" (also available and updated with the gawk source distribution)
|
||||
|
||||
" MAWK is a "new awk" meaning it implements AWK ref.
|
||||
" mawk conforms to the Posix 1003.2 (draft 11.3)
|
||||
@@ -19,11 +19,8 @@
|
||||
" TODO:
|
||||
" Dig into the commented out syntax expressions below.
|
||||
|
||||
" For version 5.x: Clear all syntax items
|
||||
" For version 6.x: Quit when a syntax file was already loaded
|
||||
if version < 600
|
||||
syn clear
|
||||
elseif exists("b:current_syntax")
|
||||
" Quit when a syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
@@ -35,13 +32,13 @@ set cpo&vim
|
||||
syn keyword awkStatement break continue delete exit
|
||||
syn keyword awkStatement function getline next
|
||||
syn keyword awkStatement print printf return
|
||||
" GAWK ref. Chapter 7
|
||||
syn keyword awkStatement nextfile
|
||||
" GAWK ref. Chapter 7-9
|
||||
syn keyword awkStatement switch nextfile
|
||||
syn keyword awkStatement func
|
||||
"
|
||||
" GAWK ref. Chapter 9, Functions
|
||||
"
|
||||
" Numeric Functions
|
||||
syn keyword awkFunction atan2 cos div exp int log rand sin sqrt srand
|
||||
syn keyword awkFunction atan2 cos exp int intdiv log rand sin sqrt srand
|
||||
" String Manipulation Functions
|
||||
syn keyword awkFunction asort asort1 gensub gsub index length match
|
||||
syn keyword awkFunction patsplit split sprintf strtonum sub substr
|
||||
@@ -52,17 +49,17 @@ syn keyword awkFunction close fflush system
|
||||
syn keyword awkFunction mktime strftime systime
|
||||
" Bit Manipulation Functions
|
||||
syn keyword awkFunction and compl lshift or rshift xor
|
||||
" Getting Type Function
|
||||
syn keyword awkFunction isarray
|
||||
" Getting Type Functions
|
||||
syn keyword awkFunction isarray typeof
|
||||
" String-Translation Functions
|
||||
syn keyword awkFunction bindtextdomain dcgettext dcngetext
|
||||
|
||||
syn keyword awkConditional if else
|
||||
syn keyword awkRepeat while for
|
||||
syn keyword awkRepeat while for do
|
||||
|
||||
syn keyword awkTodo contained TODO
|
||||
syn keyword awkTodo contained TODO
|
||||
|
||||
syn keyword awkPatterns BEGIN END
|
||||
syn keyword awkPatterns BEGIN END BEGINFILE ENDFILE
|
||||
|
||||
" GAWK ref. Chapter 7
|
||||
" Built-in Variables That Control awk
|
||||
@@ -74,20 +71,18 @@ syn keyword awkVariables ARGC ARGV ARGIND ENVIRON ERRNO FILENAME
|
||||
syn keyword awkVariables FNR NF FUNCTAB NR PROCINFO RLENGTH RSTART
|
||||
syn keyword awkVariables RT SYMTAB
|
||||
|
||||
syn keyword awkRepeat do
|
||||
|
||||
" Octal format character.
|
||||
syn match awkSpecialCharacter display contained "\\[0-7]\{1,3\}"
|
||||
syn keyword awkStatement func nextfile
|
||||
" Hex format character.
|
||||
syn match awkSpecialCharacter display contained "\\x[0-9A-Fa-f]\+"
|
||||
|
||||
syn match awkFieldVars "\$\d\+"
|
||||
|
||||
"catch errors caused by wrong parenthesis
|
||||
syn region awkParen transparent start="(" end=")" contains=ALLBUT,awkParenError,awkSpecialCharacter,awkArrayElement,awkArrayArray,awkTodo,awkRegExp,awkBrktRegExp,awkBrackets,awkCharClass
|
||||
" catch errors caused by wrong parenthesis
|
||||
syn region awkParen transparent start="(" end=")" contains=ALLBUT,awkParenError,awkSpecialCharacter,awkArrayElement,awkArrayArray,awkTodo,awkRegExp,awkBrktRegExp,awkBrackets,awkCharClass,awkComment
|
||||
syn match awkParenError display ")"
|
||||
syn match awkInParen display contained "[{}]"
|
||||
"syn match awkInParen display contained "[{}]"
|
||||
|
||||
" 64 lines for complex &&'s, and ||'s in a big "if"
|
||||
syn sync ccomment awkParen maxlines=64
|
||||
@@ -141,7 +136,7 @@ syn match awkExpression "?\|:"
|
||||
syn keyword awkExpression in
|
||||
|
||||
" Boolean Logic (OR, AND, NOT)
|
||||
"syn match awkBoolLogic "||\|&&\|\!"
|
||||
syn match awkBoolLogic "||\|&&\|\!"
|
||||
|
||||
" This is overridden by less-than & greater-than.
|
||||
" Put this above those to override them.
|
||||
@@ -171,63 +166,42 @@ syn region awkArray transparent start="\[" end="\]" contains=awkArray,awkArrayE
|
||||
" (for the few instances where it would be more than "oneline")
|
||||
syn sync ccomment awkArray maxlines=10
|
||||
|
||||
" define the default highlighting
|
||||
" For version 5.7 and earlier: only when not done already
|
||||
" For version 5.8 and later: only when an item doesn't have highlighting yet
|
||||
if version >= 508 || !exists("did_awk_syn_inits")
|
||||
if version < 508
|
||||
let did_awk_syn_inits = 1
|
||||
command -nargs=+ HiLink hi link <args>
|
||||
else
|
||||
command -nargs=+ HiLink hi def link <args>
|
||||
endif
|
||||
|
||||
HiLink awkConditional Conditional
|
||||
HiLink awkFunction Function
|
||||
HiLink awkRepeat Repeat
|
||||
HiLink awkStatement Statement
|
||||
|
||||
HiLink awkString String
|
||||
HiLink awkSpecialPrintf Special
|
||||
HiLink awkSpecialCharacter Special
|
||||
|
||||
HiLink awkSearch String
|
||||
HiLink awkBrackets awkRegExp
|
||||
HiLink awkBrktRegExp awkNestRegExp
|
||||
HiLink awkCharClass awkNestRegExp
|
||||
HiLink awkNestRegExp Keyword
|
||||
HiLink awkRegExp Special
|
||||
|
||||
HiLink awkNumber Number
|
||||
HiLink awkFloat Float
|
||||
|
||||
HiLink awkFileIO Special
|
||||
HiLink awkOperator Special
|
||||
HiLink awkExpression Special
|
||||
HiLink awkBoolLogic Special
|
||||
|
||||
HiLink awkPatterns Special
|
||||
HiLink awkVariables Special
|
||||
HiLink awkFieldVars Special
|
||||
|
||||
HiLink awkLineSkip Special
|
||||
HiLink awkSemicolon Special
|
||||
HiLink awkComma Special
|
||||
"HiLink awkIdentifier Identifier
|
||||
|
||||
HiLink awkComment Comment
|
||||
HiLink awkTodo Todo
|
||||
|
||||
" Change this if you want nested array names to be highlighted.
|
||||
HiLink awkArrayArray awkArray
|
||||
HiLink awkArrayElement Special
|
||||
|
||||
HiLink awkParenError awkError
|
||||
HiLink awkInParen awkError
|
||||
HiLink awkError Error
|
||||
|
||||
delcommand HiLink
|
||||
endif
|
||||
" Define the default highlighting.
|
||||
" Only used when an item doesn't have highlighting yet
|
||||
hi def link awkConditional Conditional
|
||||
hi def link awkFunction Function
|
||||
hi def link awkRepeat Repeat
|
||||
hi def link awkStatement Statement
|
||||
hi def link awkString String
|
||||
hi def link awkSpecialPrintf Special
|
||||
hi def link awkSpecialCharacter Special
|
||||
hi def link awkSearch String
|
||||
hi def link awkBrackets awkRegExp
|
||||
hi def link awkBrktRegExp awkNestRegExp
|
||||
hi def link awkCharClass awkNestRegExp
|
||||
hi def link awkNestRegExp Keyword
|
||||
hi def link awkRegExp Special
|
||||
hi def link awkNumber Number
|
||||
hi def link awkFloat Float
|
||||
hi def link awkFileIO Special
|
||||
hi def link awkOperator Special
|
||||
hi def link awkExpression Special
|
||||
hi def link awkBoolLogic Special
|
||||
hi def link awkPatterns Special
|
||||
hi def link awkVariables Special
|
||||
hi def link awkFieldVars Special
|
||||
hi def link awkLineSkip Special
|
||||
hi def link awkSemicolon Special
|
||||
hi def link awkComma Special
|
||||
hi def link awkIdentifier Identifier
|
||||
hi def link awkComment Comment
|
||||
hi def link awkTodo Todo
|
||||
" Change this if you want nested array names to be highlighted.
|
||||
hi def link awkArrayArray awkArray
|
||||
hi def link awkArrayElement Special
|
||||
hi def link awkParenError awkError
|
||||
hi def link awkInParen awkError
|
||||
hi def link awkError Error
|
||||
|
||||
let b:current_syntax = "awk"
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
" Vim syntax file
|
||||
" Language: DCL (Digital Command Language - vms)
|
||||
" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz>
|
||||
" Last Change: Jan 20, 2016
|
||||
" Version: 8
|
||||
" Last Change: May 02, 2016
|
||||
" Version: 9
|
||||
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_DCL
|
||||
|
||||
" For version 5.x: Clear all syntax items
|
||||
@@ -13,7 +13,7 @@ elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
if !has("patch-7.4.1141")
|
||||
if !has("patch-7.4.1142")
|
||||
setlocal iskeyword=$,@,48-57,_
|
||||
else
|
||||
syn iskeyword $,@,48-57,_
|
||||
|
@@ -3,7 +3,7 @@
|
||||
" Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>
|
||||
" Former Maintainers: Gerfried Fuchs <alfie@ist.org>
|
||||
" Wichert Akkerman <wakkerma@debian.org>
|
||||
" Last Change: 2015 Oct 24
|
||||
" Last Change: 2016 Apr 24
|
||||
" URL: https://anonscm.debian.org/cgit/pkg-vim/vim.git/plain/runtime/syntax/debchangelog.vim
|
||||
|
||||
" Standard syntax initialization
|
||||
@@ -23,7 +23,7 @@ let binNMU='binary-only=yes'
|
||||
syn match debchangelogName contained "^[[:alnum:]][[:alnum:].+-]\+ "
|
||||
exe 'syn match debchangelogFirstKV contained "; \('.urgency.'\|'.binNMU.'\)"'
|
||||
exe 'syn match debchangelogOtherKV contained ", \('.urgency.'\|'.binNMU.'\)"'
|
||||
syn match debchangelogTarget contained "\v %(frozen|unstable|sid|%(testing|%(old)=stable)%(-proposed-updates|-security)=|experimental|squeeze-%(backports%(-sloppy)=|volatile|lts|security)|wheezy-%(backports%(-sloppy)=|security)|jessie%(-backports|-security)=|stretch|%(devel|precise|trusty|vivid|wily|xenial)%(-%(security|proposed|updates|backports|commercial|partner))=)+"
|
||||
syn match debchangelogTarget contained "\v %(frozen|unstable|sid|%(testing|%(old)=stable)%(-proposed-updates|-security)=|experimental|squeeze-%(backports%(-sloppy)=|volatile|lts|security)|wheezy-%(backports%(-sloppy)=|security)|jessie%(-backports|-security)=|stretch|%(devel|precise|trusty|vivid|wily|xenial|yakkety)%(-%(security|proposed|updates|backports|commercial|partner))=)+"
|
||||
syn match debchangelogVersion contained "(.\{-})"
|
||||
syn match debchangelogCloses contained "closes:\_s*\(bug\)\=#\=\_s\=\d\+\(,\_s*\(bug\)\=#\=\_s\=\d\+\)*"
|
||||
syn match debchangelogLP contained "\clp:\s\+#\d\+\(,\s*#\d\+\)*"
|
||||
|
@@ -2,7 +2,7 @@
|
||||
" Language: Debian sources.list
|
||||
" Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>
|
||||
" Former Maintainer: Matthijs Mohlmann <matthijs@cacholong.nl>
|
||||
" Last Change: 2015 Oct 24
|
||||
" Last Change: 2016 Apr 24
|
||||
" URL: https://anonscm.debian.org/cgit/pkg-vim/vim.git/plain/runtime/syntax/debsources.vim
|
||||
|
||||
" Standard syntax initialization
|
||||
@@ -27,7 +27,7 @@ let s:supported = [
|
||||
\ 'oldstable', 'stable', 'testing', 'unstable', 'experimental',
|
||||
\ 'squeeze', 'wheezy', 'jessie', 'stretch', 'sid', 'rc-buggy',
|
||||
\
|
||||
\ 'precise', 'trusty', 'vivid', 'wily', 'xenial', 'devel'
|
||||
\ 'precise', 'trusty', 'wily', 'xenial', 'yakkety', 'devel'
|
||||
\ ]
|
||||
let s:unsupported = [
|
||||
\ 'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato',
|
||||
@@ -36,7 +36,7 @@ let s:unsupported = [
|
||||
\ 'warty', 'hoary', 'breezy', 'dapper', 'edgy', 'feisty',
|
||||
\ 'gutsy', 'hardy', 'intrepid', 'jaunty', 'karmic', 'lucid',
|
||||
\ 'maverick', 'natty', 'oneiric', 'quantal', 'raring', 'saucy',
|
||||
\ 'utopic'
|
||||
\ 'utopic', 'vivid'
|
||||
\ ]
|
||||
let &cpo=s:cpo
|
||||
|
||||
|
@@ -3,7 +3,8 @@
|
||||
" according to freedesktop.org specification 0.9.4
|
||||
" http://pdx.freedesktop.org/Standards/desktop-entry-spec/desktop-entry-spec-0.9.4.html
|
||||
" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
|
||||
" Last Change: 2004 May 16
|
||||
" Last Change: 2016 Apr 02
|
||||
" (added "Keywords")
|
||||
" Version Info: desktop.vim 0.9.4-1.2
|
||||
|
||||
" For version 5.x: Clear all syntax items
|
||||
@@ -53,8 +54,8 @@ syn keyword dtBooleanKey StartupNotify ReadOnly Terminal Hidden NoDisplay nextgr
|
||||
syn keyword dtBooleanValue true false containedin=dtBoolean contained
|
||||
|
||||
" String
|
||||
syn match dtString /^\s*\<\(Encoding\|Icon\|Path\|Actions\|FSType\|MountPoint\|UnmountIcon\|URL\|Categories\|OnlyShowIn\|NotShowIn\|StartupWMClass\|FilePattern\|MimeType\)\>.*/ contains=dtStringKey,dtDelim transparent
|
||||
syn keyword dtStringKey Type Encoding TryExec Exec Path Actions FSType MountPoint URL Categories OnlyShowIn NotShowIn StartupWMClass FilePattern MimeType nextgroup=dtDelim containedin=dtString contained
|
||||
syn match dtString /^\s*\<\(Encoding\|Icon\|Path\|Actions\|FSType\|MountPoint\|UnmountIcon\|URL\|Keywords\|Categories\|OnlyShowIn\|NotShowIn\|StartupWMClass\|FilePattern\|MimeType\)\>.*/ contains=dtStringKey,dtDelim transparent
|
||||
syn keyword dtStringKey Type Encoding TryExec Exec Path Actions FSType MountPoint URL Keywords Categories OnlyShowIn NotShowIn StartupWMClass FilePattern MimeType nextgroup=dtDelim containedin=dtString contained
|
||||
|
||||
" Exec
|
||||
syn match dtExec /^\s*\<\(Exec\|TryExec\|SwallowExec\)\>.*/ contains=dtExecKey,dtDelim,dtExecParam transparent
|
||||
|
@@ -2,7 +2,7 @@
|
||||
" Language: Diff (context or unified)
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Translations by Jakson Alves de Aquino.
|
||||
" Last Change: 2015 Feb 03
|
||||
" Last Change: 2016 Apr 02
|
||||
|
||||
" Quit when a (custom) syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
@@ -342,7 +342,7 @@ syn match diffLine "^\<\d\+\>.*"
|
||||
syn match diffLine "^\*\*\*\*.*"
|
||||
syn match diffLine "^---$"
|
||||
|
||||
"Some versions of diff have lines like "#c#" and "#d#" (where # is a number)
|
||||
" Some versions of diff have lines like "#c#" and "#d#" (where # is a number)
|
||||
syn match diffLine "^\d\+\(,\d\+\)\=[cda]\d\+\>.*"
|
||||
|
||||
syn match diffFile "^diff\>.*"
|
||||
@@ -352,12 +352,16 @@ syn match diffFile "^==== .*"
|
||||
syn match diffOldFile "^\*\*\* .*"
|
||||
syn match diffNewFile "^--- .*"
|
||||
|
||||
" Used by git
|
||||
syn match diffIndexLine "^index \x\x\x\x.*"
|
||||
|
||||
syn match diffComment "^#.*"
|
||||
|
||||
" Define the default highlighting.
|
||||
" Only used when an item doesn't have highlighting yet
|
||||
hi def link diffOldFile diffFile
|
||||
hi def link diffNewFile diffFile
|
||||
hi def link diffIndexLine PreProc
|
||||
hi def link diffFile Type
|
||||
hi def link diffOnly Constant
|
||||
hi def link diffIdentical Constant
|
||||
|
@@ -2,9 +2,9 @@
|
||||
" Language: Groovy
|
||||
" Original Author: Alessio Pace <billy.corgan@tiscali.it>
|
||||
" Maintainer: Tobias Rapp <yahuxo@gmx.de>
|
||||
" Version: 0.1.14
|
||||
" Version: 0.1.16
|
||||
" URL: http://www.vim.org/scripts/script.php?script_id=945
|
||||
" Last Change: 2015 Apr 21
|
||||
" Last Change: 2016 May 23
|
||||
|
||||
" THE ORIGINAL AUTHOR'S NOTES:
|
||||
"
|
||||
@@ -255,8 +255,11 @@ syn region groovyString start=+"+ end=+"+ end=+$+ contains=groovySpeci
|
||||
syn region groovyString start=+'+ end=+'+ end=+$+ contains=groovySpecialChar,groovySpecialError,@Spell
|
||||
syn region groovyString start=+"""+ end=+"""+ contains=groovySpecialChar,groovySpecialError,@Spell,groovyELExpr
|
||||
syn region groovyString start=+'''+ end=+'''+ contains=groovySpecialChar,groovySpecialError,@Spell
|
||||
" regex string
|
||||
syn region groovyString start='/[^/]' end='/' contains=groovySpecialChar,groovyRegexChar,groovyELExpr
|
||||
if exists("groovy_regex_strings")
|
||||
" regex strings interfere with the division operator and thus are disabled
|
||||
" by default
|
||||
syn region groovyString start='/[^/*]' end='/' contains=groovySpecialChar,groovyRegexChar,groovyELExpr
|
||||
endif
|
||||
" syn region groovyELExpr start=+${+ end=+}+ keepend contained
|
||||
syn match groovyELExpr /\${.\{-}}/ contained
|
||||
syn match groovyELExpr /\$[a-zA-Z_][a-zA-Z0-9_.]*/ contained
|
||||
|
@@ -1,7 +1,7 @@
|
||||
" Vim syntax file
|
||||
" Language: Vim help file
|
||||
" Maintainer: Bram Moolenaar (Bram@vim.org)
|
||||
" Last Change: 2014 Feb 12
|
||||
" Last Change: 2016 Apr 01
|
||||
|
||||
" Quit when a (custom) syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
@@ -41,6 +41,7 @@ syn match helpVim "NVIM REFERENCE.*"
|
||||
syn match helpOption "'[a-z]\{2,\}'"
|
||||
syn match helpOption "'t_..'"
|
||||
syn match helpCommand "`[^` \t]\+`"hs=s+1,he=e-1 contains=helpBacktick
|
||||
syn match helpCommand "\(^\|[^a-z"[]\)\zs`[^`]\+`\ze\([^a-z\t."']\|$\)"hs=s+1,he=e-1 contains=helpBacktick
|
||||
syn match helpHeader "\s*\zs.\{-}\ze\s\=\~$" nextgroup=helpIgnore
|
||||
syn match helpGraphic ".* \ze`$" nextgroup=helpIgnore
|
||||
if has("conceal")
|
||||
|
@@ -1,8 +1,8 @@
|
||||
" Vim syntax file
|
||||
" Language: Lisp
|
||||
" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz>
|
||||
" Last Change: Jan 20, 2016
|
||||
" Version: 24
|
||||
" Last Change: May 02, 2016
|
||||
" Version: 25
|
||||
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_LISP
|
||||
"
|
||||
" Thanks to F Xavier Noria for a list of 978 Common Lisp symbols taken from HyperSpec
|
||||
@@ -16,7 +16,7 @@ endif
|
||||
|
||||
if exists("g:lisp_isk")
|
||||
exe "setl isk=".g:lisp_isk
|
||||
elseif !has("patch-7.4.1141")
|
||||
elseif !has("patch-7.4.1142")
|
||||
setl isk=38,42,43,45,47-58,60-62,64-90,97-122,_
|
||||
else
|
||||
syn iskeyword 38,42,43,45,47-58,60-62,64-90,97-122,_
|
||||
|
@@ -7,10 +7,10 @@ endif
|
||||
|
||||
syntax case ignore
|
||||
syntax match manReference display '[^()[:space:]]\+([0-9nx][a-z]*)'
|
||||
syntax match manSectionHeading display '^\%(\S.*\)\=\S$'
|
||||
syntax match manSectionHeading display '^\S.*$'
|
||||
syntax match manTitle display '^\%1l.*$'
|
||||
syntax match manSubHeading display '^ \{3\}\S.*$'
|
||||
syntax match manOptionDesc display '^\s\+\%(+\|--\=\)\S\+'
|
||||
syntax match manOptionDesc display '^\s\+\%(+\|-\)\S\+'
|
||||
|
||||
highlight default link manTitle Title
|
||||
highlight default link manSectionHeading Statement
|
||||
@@ -18,7 +18,10 @@ highlight default link manOptionDesc Constant
|
||||
highlight default link manReference PreProc
|
||||
highlight default link manSubHeading Function
|
||||
|
||||
if getline(1) =~# '^[^()[:space:]]\+([23].*'
|
||||
if !exists('b:man_sect')
|
||||
call man#init_pager()
|
||||
endif
|
||||
if b:man_sect =~# '^[23]'
|
||||
syntax include @c $VIMRUNTIME/syntax/c.vim
|
||||
syntax match manCFuncDefinition display '\<\h\w*\>\ze\(\s\|\n\)*(' contained
|
||||
syntax region manSynopsis start='^\%(
|
||||
|
@@ -1,8 +1,8 @@
|
||||
" Vim syntax file
|
||||
" Language: Maple V (based on release 4)
|
||||
" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz>
|
||||
" Last Change: Jan 20, 2016
|
||||
" Version: 12
|
||||
" Last Change: May 02, 2016
|
||||
" Version: 13
|
||||
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_MAPLE
|
||||
"
|
||||
" Package Function Selection: {{{1
|
||||
@@ -30,7 +30,7 @@ elseif exists("b:current_syntax")
|
||||
endif
|
||||
|
||||
" Iskeyword Effects: {{{1
|
||||
if !has("patch-7.4.1141")
|
||||
if !has("patch-7.4.1142")
|
||||
setl isk=$,48-57,_,a-z,@-Z
|
||||
else
|
||||
syn iskeyword $,48-57,_,a-z,@-Z
|
||||
|
@@ -1,6 +1,6 @@
|
||||
" Vim syntax file
|
||||
" Language: Scheme (R5RS + some R6RS extras)
|
||||
" Last Change: 2012 May 13
|
||||
" Last Change: 2016 May 23
|
||||
" Maintainer: Sergey Khorev <sergey.khorev@gmail.com>
|
||||
" Original author: Dirk van Deun <dirk@igwe.vub.ac.be>
|
||||
|
||||
@@ -245,6 +245,18 @@ if exists("b:is_mzscheme") || exists("is_mzscheme")
|
||||
syn region schemeUnquote matchgroup=Delimiter start="#,@\[" end="\]" contains=ALL
|
||||
syn region schemeQuoted matchgroup=Delimiter start="#['`]" end=![ \t()\[\]";]!me=e-1 contains=ALL
|
||||
syn region schemeQuoted matchgroup=Delimiter start="#['`](" matchgroup=Delimiter end=")" contains=ALL
|
||||
|
||||
" Identifiers are very liberal in MzScheme/Racket
|
||||
syn match schemeOther ![^()[\]{}",'`;#|\\ ]\+!
|
||||
|
||||
" Language setting
|
||||
syn match schemeLang "#lang [-+_/A-Za-z0-9]\+\>"
|
||||
|
||||
" Various number forms
|
||||
syn match schemeNumber "[-+]\=[0-9]\+\(\.[0-9]*\)\=\(e[-+]\=[0-9]\+\)\=\>"
|
||||
syn match schemeNumber "[-+]\=\.[0-9]\+\(e[-+]\=[0-9]\+\)\=\>"
|
||||
syn match schemeNumber "[-+]\=[0-9]\+/[0-9]\+\>"
|
||||
syn match schemeNumber "\([-+]\=\([0-9]\+\(\.[0-9]*\)\=\(e[-+]\=[0-9]\+\)\=\|\.[0-9]\+\(e[-+]\=[0-9]\+\)\=\|[0-9]\+/[0-9]\+\)\)\=[-+]\([0-9]\+\(\.[0-9]*\)\=\(e[-+]\=[0-9]\+\)\=\|\.[0-9]\+\(e[-+]\=[0-9]\+\)\=\|[0-9]\+/[0-9]\+\)\=i\>"
|
||||
endif
|
||||
|
||||
|
||||
@@ -321,6 +333,9 @@ if version >= 508 || !exists("did_scheme_syntax_inits")
|
||||
|
||||
HiLink schemeExtSyntax Type
|
||||
HiLink schemeExtFunc PreProc
|
||||
|
||||
HiLink schemeLang PreProc
|
||||
|
||||
delcommand HiLink
|
||||
endif
|
||||
|
||||
|
@@ -2,8 +2,8 @@
|
||||
" Language: shell (sh) Korn shell (ksh) bash (sh)
|
||||
" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz>
|
||||
" Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int>
|
||||
" Last Change: Apr 11, 2016
|
||||
" Version: 147
|
||||
" Last Change: May 02, 2016
|
||||
" Version: 151
|
||||
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH
|
||||
" For options and settings, please use: :help ft-sh-syntax
|
||||
" This file includes many ideas from Eric Brunet (eric.brunet@ens.fr)
|
||||
@@ -18,19 +18,25 @@ endif
|
||||
|
||||
" trying to answer the question: which shell is /bin/sh, really?
|
||||
" If the user has not specified any of g:is_kornshell, g:is_bash, g:is_posix, g:is_sh, then guess.
|
||||
if !exists("g:is_kornshell") && !exists("g:is_bash") && !exists("g:is_posix") && !exists("g:is_sh")
|
||||
if getline(1) =~ '\<ksh$'
|
||||
let b:is_kornshell = 1
|
||||
elseif getline(1) =~ '\<bash$'
|
||||
let b:is_bash = 1
|
||||
elseif getline(1) =~ '\<dash$'
|
||||
let b:is_posix = 1
|
||||
elseif !exists("g:is_kornshell") && !exists("g:is_bash") && !exists("g:is_posix") && !exists("g:is_sh")
|
||||
let s:shell = ""
|
||||
if executable("/bin/sh")
|
||||
let s:shell = resolve("/bin/sh")
|
||||
elseif executable("/usr/bin/sh")
|
||||
let s:shell = resolve("/usr/bin/sh")
|
||||
endif
|
||||
if s:shell =~ 'bash$'
|
||||
let g:is_bash= 1
|
||||
elseif s:shell =~ 'ksh$'
|
||||
let g:is_kornshell = 1
|
||||
if s:shell =~ 'ksh$'
|
||||
let b:is_kornshell= 1
|
||||
elseif s:shell =~ 'bash$'
|
||||
let b:is_bash = 1
|
||||
elseif s:shell =~ 'dash$'
|
||||
let g:is_posix = 1
|
||||
let b:is_posix = 1
|
||||
endif
|
||||
unlet s:shell
|
||||
endif
|
||||
@@ -86,8 +92,12 @@ if g:sh_fold_enabled && &fdm == "manual"
|
||||
endif
|
||||
|
||||
" set up the syntax-highlighting iskeyword
|
||||
if has("patch-7.4.1141")
|
||||
exe "syn iskeyword ".&iskeyword.",-"
|
||||
if has("patch-7.4.1142")
|
||||
if exists("b:is_bash")
|
||||
exe "syn iskeyword ".&iskeyword.",-,:"
|
||||
else
|
||||
exe "syn iskeyword ".&iskeyword.",-"
|
||||
endif
|
||||
endif
|
||||
|
||||
" Set up folding commands for shell {{{1
|
||||
@@ -140,6 +150,7 @@ syn cluster shHereListDQ contains=shBeginHere,@shDblQuoteList,shHerePayload
|
||||
syn cluster shIdList contains=shCommandSub,shWrapLineOperator,shSetOption,shDeref,shDerefSimple,shRedir,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial,shAtExpr
|
||||
syn cluster shIfList contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey,shFunctionOne,shFunctionTwo
|
||||
syn cluster shLoopList contains=@shCaseList,@shErrorList,shCaseEsac,shConditional,shDblBrace,shExpr,shFor,shForPP,shIf,shOption,shSet,shTest,shTestOpr,shTouch
|
||||
syn cluster shPPSRightList contains=shComment,shDeref,shDerefSimple,shEscape,shPosnParm
|
||||
syn cluster shSubShList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq,shOperator
|
||||
syn cluster shTestList contains=shCharClass,shCommandSub,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shSingleQuote,shTest,shTestOpr
|
||||
|
||||
@@ -213,14 +224,15 @@ syn region shSubSh transparent matchgroup=shSubShRegion start="[^(]\zs(" end=")"
|
||||
syn region shExpr matchgroup=shRange start="\[" skip=+\\\\\|\\$\|\[+ end="\]" contains=@shTestList,shSpecial
|
||||
syn region shTest transparent matchgroup=shStatement start="\<test\s" skip=+\\\\\|\\$+ matchgroup=NONE end="[;&|]"me=e-1 end="$" contains=@shExprList1
|
||||
syn region shNoQuote start='\S' skip='\%(\\\\\)*\\.' end='\ze\s' contained
|
||||
syn match shAstQuote contained '\*\ze"' nextgroup=shString
|
||||
syn match shTestOpr contained '[^-+/%]\zs=' skipwhite nextgroup=shTestDoubleQuote,shTestSingleQuote,shTestPattern
|
||||
syn match shTestOpr contained "<=\|>=\|!=\|==\|=\~\|-.\>\|-\(nt\|ot\|ef\|eq\|ne\|lt\|le\|gt\|ge\)\>\|[!<>]"
|
||||
syn match shTestPattern contained '\w\+'
|
||||
syn region shTestDoubleQuote contained start='\%(\%(\\\\\)*\\\)\@<!"' skip=+\\\\\|\\"+ end='"'
|
||||
syn region shTestDoubleQuote contained start='\%(\%(\\\\\)*\\\)\@<!"' skip=+\\\\\|\\"+ end='"' contains=shDeref,shDerefSimple,shDerefSpecial
|
||||
syn match shTestSingleQuote contained '\\.'
|
||||
syn match shTestSingleQuote contained "'[^']*'"
|
||||
if exists("b:is_kornshell") || exists("b:is_bash")
|
||||
syn region shDblBrace matchgroup=Delimiter start="\[\[" skip=+\%(\\\\\)*\\$+ end="\]\]" contains=@shTestList,shNoQuote,shComment
|
||||
syn region shDblBrace matchgroup=Delimiter start="\[\[" skip=+\%(\\\\\)*\\$+ end="\]\]" contains=@shTestList,shAstQuote,shNoQuote,shComment
|
||||
syn region shDblParen matchgroup=Delimiter start="((" skip=+\%(\\\\\)*\\$+ end="))" contains=@shTestList,shComment
|
||||
endif
|
||||
|
||||
@@ -313,7 +325,9 @@ syn match shSource "^\.\s"
|
||||
syn match shSource "\s\.\s"
|
||||
"syn region shColon start="^\s*:" end="$" end="\s#"me=e-2 contains=@shColonList
|
||||
"syn region shColon start="^\s*\zs:" end="$" end="\s#"me=e-2
|
||||
syn match shColon '^\s*\zs:'
|
||||
if exists("b:is_kornshell")
|
||||
syn match shColon '^\s*\zs:'
|
||||
endif
|
||||
|
||||
" String And Character Constants: {{{1
|
||||
"================================
|
||||
@@ -404,21 +418,21 @@ if !exists("g:is_posix")
|
||||
endif
|
||||
|
||||
if exists("b:is_bash")
|
||||
ShFoldFunctions syn region shFunctionOne matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
|
||||
ShFoldFunctions syn region shFunctionTwo matchgroup=shFunction start="\<[^d][^o]\&\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
|
||||
ShFoldFunctions syn region shFunctionThree matchgroup=shFunction start="^\s*\h[-a-zA-Z_0-9]*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
|
||||
ShFoldFunctions syn region shFunctionFour matchgroup=shFunction start="\<[^d][^o]\&\h[-a-zA-Z_0-9]*\s*\%(()\)\=\_s*)" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
|
||||
ShFoldFunctions syn region shFunctionOne matchgroup=shFunction start="^\s*[A-Za-z_0-9:][-a-zA-Z_0-9:]*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
|
||||
ShFoldFunctions syn region shFunctionTwo matchgroup=shFunction start="\%(do\)\@!\&\<[A-Za-z_0-9:][-a-zA-Z_0-9:]*\>\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
|
||||
ShFoldFunctions syn region shFunctionThree matchgroup=shFunction start="^\s*[A-Za-z_0-9:][-a-zA-Z_0-9:]*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
|
||||
ShFoldFunctions syn region shFunctionFour matchgroup=shFunction start="\%(do\)\@!\&\<[A-Za-z_0-9:][-a-zA-Z_0-9:]*\>\s*\%(()\)\=\_s*)" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
|
||||
else
|
||||
ShFoldFunctions syn region shFunctionOne matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
|
||||
ShFoldFunctions syn region shFunctionTwo matchgroup=shFunction start="\<[^d][^o]\&\h\w*\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
|
||||
ShFoldFunctions syn region shFunctionThree matchgroup=shFunction start="^\s*\h\w*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
|
||||
ShFoldFunctions syn region shFunctionFour matchgroup=shFunction start="\<[^d][^o]\&\h\w*\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
|
||||
ShFoldFunctions syn region shFunctionOne matchgroup=shFunction start="^\s*\h\w*\s*()\_s*{" end="}" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
|
||||
ShFoldFunctions syn region shFunctionTwo matchgroup=shFunction start="\%(do\)\@!\&\<\h\w*\>\s*\%(()\)\=\_s*{" end="}" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
|
||||
ShFoldFunctions syn region shFunctionThree matchgroup=shFunction start="^\s*\h\w*\s*()\_s*(" end=")" contains=@shFunctionList skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
|
||||
ShFoldFunctions syn region shFunctionFour matchgroup=shFunction start="\%(do\)\@!\&\<\h\w*\>\s*\%(()\)\=\_s*(" end=")" contains=shFunctionKey,@shFunctionList contained skipwhite skipnl nextgroup=shFunctionStart,shQuickComment
|
||||
endif
|
||||
|
||||
" Parameter Dereferencing: {{{1
|
||||
" ========================
|
||||
if !exists("g:sh_no_error")
|
||||
syn match shDerefWordError "[^}$[]" contained
|
||||
syn match shDerefWordError "[^}$[~]" contained
|
||||
endif
|
||||
syn match shDerefSimple "\$\%(\k\+\|\d\)"
|
||||
syn region shDeref matchgroup=PreProc start="\${" end="}" contains=@shDerefList,shDerefVarArray
|
||||
@@ -498,7 +512,7 @@ if exists("b:is_bash")
|
||||
" bash : ${parameter//pattern}
|
||||
syn match shDerefPPS contained '/\{1,2}' nextgroup=shDerefPPSleft
|
||||
syn region shDerefPPSleft contained start='.' skip=@\%(\\\\\)*\\/@ matchgroup=shDerefOp end='/' end='\ze}' nextgroup=shDerefPPSright contains=@shCommandSubList
|
||||
syn region shDerefPPSright contained start='.' skip=@\%(\\\\\)\+@ end='\ze}' contains=@shCommandSubList
|
||||
syn region shDerefPPSright contained start='.' skip=@\%(\\\\\)\+@ end='\ze}' contains=@shPPSRightList
|
||||
|
||||
" bash : ${parameter/#substring/replacement}
|
||||
syn match shDerefPSR contained '/#' nextgroup=shDerefPSRleft
|
||||
@@ -567,6 +581,7 @@ syn sync match shWhileSync grouphere shRepeat "\<while\>"
|
||||
" Default Highlighting: {{{1
|
||||
" =====================
|
||||
hi def link shArithRegion shShellVariables
|
||||
hi def link shAstQuote shDoubleQuote
|
||||
hi def link shAtExpr shSetList
|
||||
hi def link shBeginHere shRedir
|
||||
hi def link shCaseBar shConditional
|
||||
@@ -597,7 +612,6 @@ hi def link shEmbeddedEcho shString
|
||||
hi def link shEscape shCommandSub
|
||||
hi def link shExDoubleQuote shDoubleQuote
|
||||
hi def link shExSingleQuote shSingleQuote
|
||||
hi def link shFunction Function
|
||||
hi def link shHereDoc shString
|
||||
hi def link shHerePayload shHereDoc
|
||||
hi def link shLoop shStatement
|
||||
@@ -628,21 +642,17 @@ if exists("b:is_bash")
|
||||
hi def link bashAdminStatement shStatement
|
||||
hi def link bashSpecialVariables shShellVariables
|
||||
hi def link bashStatement shStatement
|
||||
hi def link shFunctionParen Delimiter
|
||||
hi def link shFunctionDelim Delimiter
|
||||
hi def link shCharClass shSpecial
|
||||
endif
|
||||
if exists("b:is_kornshell")
|
||||
hi def link kshSpecialVariables shShellVariables
|
||||
hi def link kshStatement shStatement
|
||||
hi def link shFunctionParen Delimiter
|
||||
endif
|
||||
|
||||
if !exists("g:sh_no_error")
|
||||
hi def link shCaseError Error
|
||||
hi def link shCondError Error
|
||||
hi def link shCurlyError Error
|
||||
hi def link shDerefError Error
|
||||
hi def link shDerefOpError Error
|
||||
hi def link shDerefWordError Error
|
||||
hi def link shDoError Error
|
||||
|
@@ -4,8 +4,8 @@
|
||||
" Maintainer: Dominik Fischer <d dot f dot fischer at web dot de>
|
||||
" Contributor: Leonard Ehrenfried <leonard.ehrenfried@web.de>
|
||||
" Contributor: Karsten Hopp <karsten@redhat.com>
|
||||
" Last Change: 2016 Mar 1
|
||||
" SSH Version: 7.2
|
||||
" Last Change: 2016 Apr 7
|
||||
" SSH Version: 7.2p2
|
||||
"
|
||||
|
||||
" Setup
|
||||
@@ -36,7 +36,7 @@ syn keyword sshconfigTodo TODO FIXME NOTE contained
|
||||
|
||||
|
||||
" Constants
|
||||
syn keyword sshconfigYesNo yes no ask
|
||||
syn keyword sshconfigYesNo yes no ask confirm
|
||||
syn keyword sshconfigYesNo any auto
|
||||
syn keyword sshconfigYesNo force autoask none
|
||||
|
||||
@@ -139,6 +139,7 @@ syn keyword sshconfigHostSect Host
|
||||
syn keyword sshconfigMatch canonical exec host originalhost user localuser all
|
||||
|
||||
syn keyword sshconfigKeyword AddressFamily
|
||||
syn keyword sshconfigKeyword AddKeysToAgent
|
||||
syn keyword sshconfigKeyword BatchMode
|
||||
syn keyword sshconfigKeyword BindAddress
|
||||
syn keyword sshconfigKeyword CanonicalDomains
|
||||
|
@@ -1,8 +1,8 @@
|
||||
" Vim syntax file
|
||||
" Language: TeX
|
||||
" Maintainer: Charles E. Campbell <NdrchipO@ScampbellPfamily.AbizM>
|
||||
" Last Change: Apr 11, 2016
|
||||
" Version: 94
|
||||
" Last Change: May 02, 2016
|
||||
" Version: 95
|
||||
" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX
|
||||
"
|
||||
" Notes: {{{1
|
||||
@@ -133,7 +133,7 @@ endif
|
||||
" g:tex_isk
|
||||
if exists("g:tex_isk")
|
||||
exe "setlocal isk=".g:tex_isk
|
||||
elseif !has("patch-7.4.1141")
|
||||
elseif !has("patch-7.4.1142")
|
||||
setl isk=48-57,a-z,A-Z,192-255
|
||||
else
|
||||
syn iskeyword 48-57,a-z,A-Z,192-255
|
||||
|
@@ -1,145 +1,135 @@
|
||||
" Vim syntax file
|
||||
" Language: HMTL Tidy configuration file (/etc/tidyrc ~/.tidyrc)
|
||||
" Maintainer: Doug Kearns <dougkearns@gmail.com>
|
||||
" Last Change: 2013 June 01
|
||||
" Last Change: 2016 Apr 24
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
setlocal iskeyword=@,48-57,-
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
syn iskeyword @,48-57,-,_
|
||||
|
||||
syn case ignore
|
||||
syn keyword tidyBoolean contained t[rue] f[alse] y[es] n[o] 1 0
|
||||
syn keyword tidyAutoBoolean contained t[rue] f[alse] y[es] n[o] 1 0 auto
|
||||
syn case match
|
||||
syn keyword tidyDoctype contained html5 omit auto strict loose transitional user
|
||||
syn keyword tidyEncoding contained raw ascii latin0 latin1 utf8 iso2022 mac win1252 ibm858 utf16le utf16be utf16 big5 shiftjis
|
||||
syn keyword tidyNewline contained LF CRLF CR
|
||||
syn match tidyNumber contained "\<\d\+\>"
|
||||
syn keyword tidyRepeat contained keep-first keep-last
|
||||
syn keyword tidySorter contained alpha none
|
||||
syn region tidyString contained start=+"+ skip=+\\\\\|\\"+ end=+"+ oneline
|
||||
syn region tidyString contained start=+'+ skip=+\\\\\|\\'+ end=+'+ oneline
|
||||
syn match tidyTags contained "\<\w\+\(\s*,\s*\w\+\)*\>"
|
||||
|
||||
syn keyword tidyBooleanOption add-xml-decl add-xml-pi add-xml-space
|
||||
\ anchor-as-name ascii-chars assume-xml-procins bare break-before-br
|
||||
\ clean coerce-endtags decorate-inferred-ul drop-empty-paras
|
||||
\ drop-empty-elements drop-font-tags drop-proprietary-attributes
|
||||
\ enclose-block-text enclose-text escape-cdata escape-scripts
|
||||
\ fix-backslash fix-bad-comments fix-uri force-output gdoc gnu-emacs
|
||||
\ hide-comments hide-endtags indent-attributes indent-cdata
|
||||
\ indent-with-tabs input-xml join-classes join-styles keep-time
|
||||
\ language literal-attributes logical-emphasis lower-literals markup
|
||||
\ merge-emphasis ncr numeric-entities omit-optional-tags output-html
|
||||
\ output-xhtml output-xml preserve-entities punctuation-wrap quiet
|
||||
\ quote-ampersand quote-marks quote-nbsp raw replace-color show-info
|
||||
\ show-warnings skip-nested split strict-tags-attributes tidy-mark
|
||||
\ uppercase-attributes uppercase-tags word-2000 wrap-asp
|
||||
\ wrap-attributes wrap-jste wrap-php wrap-script-literals
|
||||
\ wrap-sections write-back
|
||||
\ contained nextgroup=tidyBooleanDelimiter
|
||||
|
||||
syn match tidyBooleanDelimiter ":" nextgroup=tidyBoolean contained skipwhite
|
||||
|
||||
syn keyword tidyAutoBooleanOption indent merge-divs merge-spans output-bom show-body-only vertical-space contained nextgroup=tidyAutoBooleanDelimiter
|
||||
syn match tidyAutoBooleanDelimiter ":" nextgroup=tidyAutoBoolean contained skipwhite
|
||||
|
||||
syn keyword tidyCSSSelectorOption css-prefix contained nextgroup=tidyCSSSelectorDelimiter
|
||||
syn match tidyCSSSelectorDelimiter ":" nextgroup=tidyCSSSelector contained skipwhite
|
||||
|
||||
syn keyword tidyDoctypeOption doctype contained nextgroup=tidyDoctypeDelimiter
|
||||
syn match tidyDoctypeDelimiter ":" nextgroup=tidyDoctype contained skipwhite
|
||||
|
||||
syn keyword tidyEncodingOption char-encoding input-encoding output-encoding contained nextgroup=tidyEncodingDelimiter
|
||||
syn match tidyEncodingDelimiter ":" nextgroup=tidyEncoding contained skipwhite
|
||||
|
||||
syn keyword tidyIntegerOption accessibility-check doctype-mode indent-spaces show-errors tab-size wrap contained nextgroup=tidyIntegerDelimiter
|
||||
syn match tidyIntegerDelimiter ":" nextgroup=tidyNumber contained skipwhite
|
||||
|
||||
syn keyword tidyNameOption slide-style contained nextgroup=tidyNameDelimiter
|
||||
syn match tidyNameDelimiter ":" nextgroup=tidyName contained skipwhite
|
||||
|
||||
syn keyword tidyNewlineOption newline contained nextgroup=tidyNewlineDelimiter
|
||||
syn match tidyNewlineDelimiter ":" nextgroup=tidyNewline contained skipwhite
|
||||
|
||||
syn keyword tidyTagsOption new-blocklevel-tags new-empty-tags new-inline-tags new-pre-tags contained nextgroup=tidyTagsDelimiter
|
||||
syn match tidyTagsDelimiter ":" nextgroup=tidyTags contained skipwhite
|
||||
|
||||
syn keyword tidyRepeatOption repeated-attributes contained nextgroup=tidyRepeatDelimiter
|
||||
syn match tidyRepeatDelimiter ":" nextgroup=tidyRepeat contained skipwhite
|
||||
|
||||
syn keyword tidySorterOption sort-attributes contained nextgroup=tidySorterDelimiter
|
||||
syn match tidySorterDelimiter ":" nextgroup=tidySorter contained skipwhite
|
||||
|
||||
syn keyword tidyStringOption alt-text error-file gnu-emacs-file output-file contained nextgroup=tidyStringDelimiter
|
||||
syn match tidyStringDelimiter ":" nextgroup=tidyString contained skipwhite
|
||||
|
||||
syn cluster tidyOptions contains=tidy.*Option
|
||||
|
||||
syn match tidyStart "^" nextgroup=@tidyOptions
|
||||
|
||||
syn match tidyComment "^\s*//.*$" contains=tidyTodo
|
||||
syn match tidyComment "^\s*#.*$" contains=tidyTodo
|
||||
syn keyword tidyTodo TODO NOTE FIXME XXX contained
|
||||
|
||||
syn match tidyAssignment "^[a-z0-9-]\+:\s*.*$" contains=tidyOption,@tidyValue,tidyDelimiter
|
||||
syn match tidyDelimiter ":" contained
|
||||
hi def link tidyAutoBooleanOption Identifier
|
||||
hi def link tidyBooleanOption Identifier
|
||||
hi def link tidyCSSSelectorOption Identifier
|
||||
hi def link tidyDoctypeOption Identifier
|
||||
hi def link tidyEncodingOption Identifier
|
||||
hi def link tidyIntegerOption Identifier
|
||||
hi def link tidyNameOption Identifier
|
||||
hi def link tidyNewlineOption Identifier
|
||||
hi def link tidyTagsOption Identifier
|
||||
hi def link tidyRepeatOption Identifier
|
||||
hi def link tidySorterOption Identifier
|
||||
hi def link tidyStringOption Identifier
|
||||
|
||||
syn match tidyNewTagAssignment "^new-\l\+-tags:\s*.*$" contains=tidyNewTagOption,tidyNewTagDelimiter,tidyNewTagValue,tidyDelimiter
|
||||
syn match tidyNewTagDelimiter "," contained
|
||||
syn match tidyNewTagValue "\<\w\+\>" contained
|
||||
hi def link tidyAutoBooleanDelimiter Special
|
||||
hi def link tidyBooleanDelimiter Special
|
||||
hi def link tidyCSSSelectorDelimiter Special
|
||||
hi def link tidyDoctypeDelimiter Special
|
||||
hi def link tidyEncodingDelimiter Special
|
||||
hi def link tidyIntegerDelimiter Special
|
||||
hi def link tidyNameDelimiter Special
|
||||
hi def link tidyNewlineDelimiter Special
|
||||
hi def link tidyTagsDelimiter Special
|
||||
hi def link tidyRepeatDelimiter Special
|
||||
hi def link tidySorterDelimiter Special
|
||||
hi def link tidyStringDelimiter Special
|
||||
|
||||
syn case ignore
|
||||
syn keyword tidyBoolean t[rue] f[alse] y[es] n[o] contained
|
||||
syn case match
|
||||
syn match tidyDoctype "\<\%(omit\|auto\|strict\|loose\|transitional\|user\)\>" contained
|
||||
" NOTE: use match rather than keyword here so that tidyEncoding 'raw' does not
|
||||
" always have precedence over tidyOption 'raw'
|
||||
syn match tidyEncoding "\<\%(ascii\|latin0\|latin1\|raw\|utf8\|iso2022\|mac\|utf16le\|utf16be\|utf16\|win1252\|ibm858\|big5\|shiftjis\)\>" contained
|
||||
syn match tidyNewline "\<\%(LF\|CRLF\|CR\)\>"
|
||||
syn match tidyNumber "\<\d\+\>" contained
|
||||
syn match tidyRepeat "\<\%(keep-first\|keep-last\)\>" contained
|
||||
syn region tidyString start=+"+ skip=+\\\\\|\\"+ end=+"+ contained oneline
|
||||
syn region tidyString start=+'+ skip=+\\\\\|\\'+ end=+'+ contained oneline
|
||||
syn cluster tidyValue contains=tidyBoolean,tidyDoctype,tidyEncoding,tidyNewline,tidyNumber,tidyRepeat,tidyString
|
||||
hi def link tidyAutoBoolean Boolean
|
||||
hi def link tidyBoolean Boolean
|
||||
hi def link tidyDoctype Constant
|
||||
hi def link tidyEncoding Constant
|
||||
hi def link tidyNewline Constant
|
||||
hi def link tidyTags Constant
|
||||
hi def link tidyNumber Number
|
||||
hi def link tidyRepeat Constant
|
||||
hi def link tidySorter Constant
|
||||
hi def link tidyString String
|
||||
|
||||
syn match tidyOption "^accessibility-check" contained
|
||||
syn match tidyOption "^add-xml-decl" contained
|
||||
syn match tidyOption "^add-xml-pi" contained
|
||||
syn match tidyOption "^add-xml-space" contained
|
||||
syn match tidyOption "^alt-text" contained
|
||||
syn match tidyOption "^anchor-as-name" contained
|
||||
syn match tidyOption "^ascii-chars" contained
|
||||
syn match tidyOption "^assume-xml-procins" contained
|
||||
syn match tidyOption "^bare" contained
|
||||
syn match tidyOption "^break-before-br" contained
|
||||
syn match tidyOption "^char-encoding" contained
|
||||
syn match tidyOption "^clean" contained
|
||||
syn match tidyOption "^css-prefix" contained
|
||||
syn match tidyOption "^decorate-inferred-ul" contained
|
||||
syn match tidyOption "^doctype" contained
|
||||
syn match tidyOption "^doctype-mode" contained
|
||||
syn match tidyOption "^drop-empty-paras" contained
|
||||
syn match tidyOption "^drop-font-tags" contained
|
||||
syn match tidyOption "^drop-proprietary-attributes" contained
|
||||
syn match tidyOption "^enclose-block-text" contained
|
||||
syn match tidyOption "^enclose-text" contained
|
||||
syn match tidyOption "^error-file" contained
|
||||
syn match tidyOption "^escape-cdata" contained
|
||||
syn match tidyOption "^fix-backslash" contained
|
||||
syn match tidyOption "^fix-bad-comments" contained
|
||||
syn match tidyOption "^fix-uri" contained
|
||||
syn match tidyOption "^force-output" contained
|
||||
syn match tidyOption "^gnu-emacs" contained
|
||||
syn match tidyOption "^gnu-emacs-file" contained
|
||||
syn match tidyOption "^hide-comments" contained
|
||||
syn match tidyOption "^hide-endtags" contained
|
||||
syn match tidyOption "^indent" contained
|
||||
syn match tidyOption "^indent-attributes" contained
|
||||
syn match tidyOption "^indent-cdata" contained
|
||||
syn match tidyOption "^indent-spaces" contained
|
||||
syn match tidyOption "^input-encoding" contained
|
||||
syn match tidyOption "^input-xml" contained
|
||||
syn match tidyOption "^join-classes" contained
|
||||
syn match tidyOption "^join-styles" contained
|
||||
syn match tidyOption "^keep-time" contained
|
||||
syn match tidyOption "^language" contained
|
||||
syn match tidyOption "^literal-attributes" contained
|
||||
syn match tidyOption "^logical-emphasis" contained
|
||||
syn match tidyOption "^lower-literals" contained
|
||||
syn match tidyOption "^markup" contained
|
||||
syn match tidyOption "^merge-divs" contained
|
||||
syn match tidyOption "^merge-spans" contained
|
||||
syn match tidyOption "^ncr" contained
|
||||
syn match tidyOption "^newline" contained
|
||||
syn match tidyOption "^numeric-entities" contained
|
||||
syn match tidyOption "^output-bom" contained
|
||||
syn match tidyOption "^output-encoding" contained
|
||||
syn match tidyOption "^output-file" contained
|
||||
syn match tidyOption "^output-html" contained
|
||||
syn match tidyOption "^output-xhtml" contained
|
||||
syn match tidyOption "^output-xml" contained
|
||||
syn match tidyOption "^preserve-entities" contained
|
||||
syn match tidyOption "^punctuation-wrap" contained
|
||||
syn match tidyOption "^quiet" contained
|
||||
syn match tidyOption "^quote-ampersand" contained
|
||||
syn match tidyOption "^quote-marks" contained
|
||||
syn match tidyOption "^quote-nbsp" contained
|
||||
syn match tidyOption "^raw" contained
|
||||
syn match tidyOption "^repeated-attributes" contained
|
||||
syn match tidyOption "^replace-color" contained
|
||||
syn match tidyOption "^show-body-only" contained
|
||||
syn match tidyOption "^show-errors" contained
|
||||
syn match tidyOption "^show-warnings" contained
|
||||
syn match tidyOption "^slide-style" contained
|
||||
syn match tidyOption "^sort-attributes" contained
|
||||
syn match tidyOption "^split" contained
|
||||
syn match tidyOption "^tab-size" contained
|
||||
syn match tidyOption "^tidy-mark" contained
|
||||
syn match tidyOption "^uppercase-attributes" contained
|
||||
syn match tidyOption "^uppercase-tags" contained
|
||||
syn match tidyOption "^word-2000" contained
|
||||
syn match tidyOption "^wrap" contained
|
||||
syn match tidyOption "^wrap-asp" contained
|
||||
syn match tidyOption "^wrap-attributes" contained
|
||||
syn match tidyOption "^wrap-jste" contained
|
||||
syn match tidyOption "^wrap-php" contained
|
||||
syn match tidyOption "^wrap-script-literals" contained
|
||||
syn match tidyOption "^wrap-sections" contained
|
||||
syn match tidyOption "^write-back" contained
|
||||
syn match tidyOption "^vertical-space" contained
|
||||
|
||||
syn match tidyNewTagOption "^new-blocklevel-tags" contained
|
||||
syn match tidyNewTagOption "^new-empty-tags" contained
|
||||
syn match tidyNewTagOption "^new-inline-tags" contained
|
||||
syn match tidyNewTagOption "^new-pre-tags" contained
|
||||
|
||||
hi def link tidyBoolean Boolean
|
||||
hi def link tidyComment Comment
|
||||
hi def link tidyDelimiter Special
|
||||
hi def link tidyDoctype Constant
|
||||
hi def link tidyEncoding Constant
|
||||
hi def link tidyNewline Constant
|
||||
hi def link tidyNewTagDelimiter Special
|
||||
hi def link tidyNewTagOption Identifier
|
||||
hi def link tidyNewTagValue Constant
|
||||
hi def link tidyNumber Number
|
||||
hi def link tidyOption Identifier
|
||||
hi def link tidyRepeat Constant
|
||||
hi def link tidyString String
|
||||
hi def link tidyTodo Todo
|
||||
hi def link tidyComment Comment
|
||||
hi def link tidyTodo Todo
|
||||
|
||||
let b:current_syntax = "tidy"
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
|
||||
" vim: ts=8
|
||||
|
@@ -1,9 +1,12 @@
|
||||
" Vim syntax file
|
||||
" Language: Vim 7.4 script
|
||||
" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz>
|
||||
" Last Change: Apr 02, 2015
|
||||
" Version: 7.4-33
|
||||
" Automatically generated keyword lists: {{{1
|
||||
|
||||
" #############################################################################
|
||||
" #############################################################################
|
||||
" Note: Be careful when merging the upstream version of this file.
|
||||
" Much of this is generated by scripts/genvimvim.lua (result is installed
|
||||
" to: $VIMRUNTIME/syntax/vim/generated.vim)
|
||||
" #############################################################################
|
||||
" #############################################################################
|
||||
|
||||
" Quit when a syntax file was already loaded {{{2
|
||||
if exists("b:current_syntax")
|
||||
@@ -31,8 +34,8 @@ syn keyword vimOnlyOption contained nobiosk nobioskey noconsk noconskey nocp noc
|
||||
" Invertible setting variants
|
||||
syn keyword vimOnlyOption contained invbiosk invbioskey invconsk invconskey invcp invcompatible invguipty invmacatsui invsn invshortname invta invtextauto invtx invtextmode invtf invttyfast invtbi invttybuiltin invwiv invweirdinvert
|
||||
" termcap codes (which can also be set) {{{2
|
||||
syn keyword vimTermOption contained t_AB t_al t_bc t_ce t_cl t_Co t_Cs t_CS t_CV t_da t_db t_dl t_DL t_EI t_F1 t_F2 t_F3 t_F4 t_F5 t_F6 t_F7 t_F8 t_F9 t_fs t_IE t_IS t_k1 t_K1 t_k2 t_k3 t_K3 t_k4 t_K4 t_k5 t_K5 t_k6 t_K6 t_k7 t_K7 t_k8 t_K8 t_k9 t_K9 t_KA t_kb t_kB t_KB t_KC t_kd t_kD t_KD t_ke t_KE t_KF t_KG t_kh t_KH t_kI t_KI t_KJ t_KK t_kl t_KL t_kN t_kP t_kr t_ks t_ku t_le t_mb t_md t_me t_mr t_ms t_nd t_op t_RI t_RV t_Sb t_se t_Sf t_SI t_so t_sr t_te t_ti t_ts t_u7 t_ue t_us t_ut t_vb t_ve t_vi t_vs t_WP t_WS t_xs t_ZH t_ZR
|
||||
syn keyword vimTermOption contained t_AF t_AL t_cd t_Ce t_cm t_cs
|
||||
syn keyword vimTermOption contained t_8b t_AB t_al t_bc t_ce t_cl t_Co t_Cs t_CV t_db t_DL t_F1 t_F2 t_F3 t_F4 t_F5 t_F6 t_F7 t_F8 t_F9 t_fs t_IE t_IS t_k1 t_K1 t_k2 t_k3 t_K3 t_k4 t_K4 t_k5 t_K5 t_k6 t_K6 t_k7 t_K7 t_k8 t_K8 t_k9 t_K9 t_KA t_kb t_kB t_KB t_KC t_kd t_kD t_KD t_ke t_KE t_KF t_KG t_kh t_KH t_kI t_KI t_KJ t_KK t_kl t_KL t_kN t_kP t_kr t_ks t_ku t_le t_mb t_md t_me t_mr t_ms t_nd t_op t_RB t_RI t_RV t_Sb t_se t_Sf t_SI t_so t_sr t_SR t_te t_ti t_ts t_u7 t_ue t_us t_ut t_vb t_ve t_vi t_vs t_WP t_WS t_xn t_xs t_ZH t_ZR
|
||||
syn keyword vimTermOption contained t_8f t_AF t_AL t_cd t_Ce t_cm t_cs t_CS t_da t_dl t_EI
|
||||
syn match vimTermOption contained "t_%1"
|
||||
syn match vimTermOption contained "t_#2"
|
||||
syn match vimTermOption contained "t_#4"
|
||||
@@ -53,11 +56,64 @@ syn keyword vimGroup contained Comment Constant String Character Number Boolean
|
||||
syn keyword vimHLGroup contained ColorColumn Cursor CursorColumn CursorIM CursorLine CursorLineNr DiffAdd DiffChange DiffDelete DiffText Directory ErrorMsg FoldColumn Folded IncSearch LineNr MatchParen Menu ModeMsg MoreMsg NonText Normal Pmenu PmenuSbar PmenuSel PmenuThumb Question Scrollbar Search SignColumn SpecialKey SpellBad SpellCap SpellLocal SpellRare StatusLine StatusLineNC TabLine TabLineFill TabLineSel Title Tooltip VertSplit Visual WarningMsg WildMenu
|
||||
syn match vimHLGroup contained "Conceal"
|
||||
syn keyword vimOnlyHLGroup contained VisualNOS
|
||||
syn keyword nvimHLGroup contained EndOfBuffer TermCursor TermCursorNC
|
||||
syn keyword nvimHLGroup contained EndOfBuffer Substitute TermCursor TermCursorNC QuickFixLine
|
||||
"}}}2
|
||||
syn case match
|
||||
" Special Vim Highlighting (not automatic) {{{1
|
||||
|
||||
" Set up folding commands
|
||||
if exists("g:vimsyn_folding") && g:vimsyn_folding =~# '[aflmpPrt]'
|
||||
if g:vimsyn_folding =~# 'a'
|
||||
com! -nargs=* VimFolda <args> fold
|
||||
else
|
||||
com! -nargs=* VimFolda <args>
|
||||
endif
|
||||
if g:vimsyn_folding =~# 'f'
|
||||
com! -nargs=* VimFoldf <args> fold
|
||||
else
|
||||
com! -nargs=* VimFoldf <args>
|
||||
endif
|
||||
if g:vimsyn_folding =~# 'l'
|
||||
com! -nargs=* VimFoldl <args> fold
|
||||
else
|
||||
com! -nargs=* VimFoldl <args>
|
||||
endif
|
||||
if g:vimsyn_folding =~# 'm'
|
||||
com! -nargs=* VimFoldm <args> fold
|
||||
else
|
||||
com! -nargs=* VimFoldm <args>
|
||||
endif
|
||||
if g:vimsyn_folding =~# 'p'
|
||||
com! -nargs=* VimFoldp <args> fold
|
||||
else
|
||||
com! -nargs=* VimFoldp <args>
|
||||
endif
|
||||
if g:vimsyn_folding =~# 'P'
|
||||
com! -nargs=* VimFoldP <args> fold
|
||||
else
|
||||
com! -nargs=* VimFoldP <args>
|
||||
endif
|
||||
if g:vimsyn_folding =~# 'r'
|
||||
com! -nargs=* VimFoldr <args> fold
|
||||
else
|
||||
com! -nargs=* VimFoldr <args>
|
||||
endif
|
||||
if g:vimsyn_folding =~# 't'
|
||||
com! -nargs=* VimFoldt <args> fold
|
||||
else
|
||||
com! -nargs=* VimFoldt <args>
|
||||
endif
|
||||
else
|
||||
com! -nargs=* VimFolda <args>
|
||||
com! -nargs=* VimFoldf <args>
|
||||
com! -nargs=* VimFoldl <args>
|
||||
com! -nargs=* VimFoldm <args>
|
||||
com! -nargs=* VimFoldp <args>
|
||||
com! -nargs=* VimFoldP <args>
|
||||
com! -nargs=* VimFoldr <args>
|
||||
com! -nargs=* VimFoldt <args>
|
||||
endif
|
||||
|
||||
" commands not picked up by the generator (due to non-standard format)
|
||||
syn keyword vimCommand contained py3
|
||||
|
||||
@@ -80,8 +136,8 @@ syn match vimNumber "\<0[xX]\x\+"
|
||||
syn match vimNumber "\%(^\|[^a-zA-Z]\)\zs#\x\{6}"
|
||||
|
||||
" All vimCommands are contained by vimIsCommands. {{{2
|
||||
syn match vimCmdSep "[:|]\+" skipwhite nextgroup=vimAddress,vimAutoCmd,vimCommand,vimIsCommand,vimExtCmd,vimFilter,vimLet,vimMap,vimMark,vimSet,vimSyntax,vimUserCmd,vimOnlyCommand
|
||||
syn match vimIsCommand "\<\h\w*\>" contains=vimCommand,vimOnlyCommand
|
||||
syn match vimCmdSep "[:|]\+" skipwhite nextgroup=vimAddress,vimAutoCmd,vimIsCommand,vimExtCmd,vimFilter,vimLet,vimMap,vimMark,vimSet,vimSyntax,vimUserCmd
|
||||
syn match vimIsCommand "\<\h\w*\>" contains=vimCommand
|
||||
syn match vimVar contained "\<\h[a-zA-Z0-9#_]*\>"
|
||||
syn match vimVar "\<[bwglsav]:\h[a-zA-Z0-9#_]*\>"
|
||||
syn match vimFBVar contained "\<[bwglsav]:\h[a-zA-Z0-9#_]*\>"
|
||||
@@ -113,10 +169,10 @@ syn keyword vimFTOption contained detect indent off on plugin
|
||||
" Augroup : vimAugroupError removed because long augroups caused sync'ing problems. {{{2
|
||||
" ======= : Trade-off: Increasing synclines with slower editing vs augroup END error checking.
|
||||
syn cluster vimAugroupList contains=vimAugroup,vimIsCommand,vimCommand,vimUserCmd,vimExecute,vimNotFunc,vimFuncName,vimFunction,vimFunctionError,vimLineComment,vimMap,vimSpecFile,vimOper,vimNumber,vimOperParen,vimComment,vimString,vimSubst,vimMark,vimRegister,vimAddress,vimFilter,vimCmplxRepeat,vimComment,vimLet,vimSet,vimAutoCmd,vimRegion,vimSynLine,vimNotation,vimCtrlChar,vimFuncVar,vimContinue
|
||||
if exists("g:vimsyn_folding") && g:vimsyn_folding =~ 'a'
|
||||
if exists("g:vimsyn_folding") && g:vimsyn_folding =~# 'a'
|
||||
syn region vimAugroup fold matchgroup=vimAugroupKey start="\<aug\%[roup]\>\ze\s\+\K\k*" end="\<aug\%[roup]\>\ze\s\+[eE][nN][dD]\>" contains=vimAutoCmd,@vimAugroupList
|
||||
else
|
||||
syn region vimAugroup matchgroup=vimAugroupKey start="\<aug\%[roup]\>\ze\s\+\K\k*" end="\<aug\%[roup]\>\ze\s\+[eE][nN][dD]\>" contains=vimAutoCmd,@vimAugroupList
|
||||
syn region vimAugroup matchgroup=vimAugroupKey start="\<aug\%[roup]\>\ze\s\+\K\k*" end="\<aug\%[roup]\>\ze\s\+[eE][nN][dD]\>" contains=vimAutoCmd,@vimAugroupList
|
||||
endif
|
||||
syn match vimAugroup "aug\%[roup]!" contains=vimAugroupKey
|
||||
if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_noaugrouperror")
|
||||
@@ -130,7 +186,7 @@ syn cluster vimOperGroup contains=vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperPa
|
||||
syn match vimOper "\(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\|=\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile
|
||||
syn match vimOper "||\|&&\|[-+.]" skipwhite nextgroup=vimString,vimSpecFile
|
||||
syn region vimOperParen matchgroup=vimParenSep start="(" end=")" contains=@vimOperGroup
|
||||
syn region vimOperParen matchgroup=vimSep start="{" end="}" contains=@vimOperGroup nextgroup=vimVar,vimFuncVar
|
||||
syn region vimOperParen matchgroup=vimSep start="{" end="}" contains=@vimOperGroup nextgroup=vimVar,vimFuncVar
|
||||
if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_noopererror")
|
||||
syn match vimOperError ")"
|
||||
endif
|
||||
@@ -141,7 +197,7 @@ syn cluster vimFuncList contains=vimCommand,vimFunctionError,vimFuncKey,Tag,vimF
|
||||
syn cluster vimFuncBodyList contains=vimAbb,vimAddress,vimAugroupKey,vimAutoCmd,vimCmplxRepeat,vimComment,vimComment,vimContinue,vimCtrlChar,vimEcho,vimEchoHL,vimExecute,vimIf,vimIsCommand,vimFBVar,vimFunc,vimFunction,vimFuncVar,vimGlobal,vimHighlight,vimIsCommand,vimLet,vimLineComment,vimMap,vimMark,vimNorm,vimNotation,vimNotFunc,vimNumber,vimOper,vimOperParen,vimRegion,vimRegister,vimSet,vimSpecFile,vimString,vimSubst,vimSynLine,vimUnmap,vimUserCommand,nvimUnmap,nvimMap
|
||||
syn match vimFunction "\<fu\%[nction]!\=\s\+\%(<[sS][iI][dD]>\|[sSgGbBwWtTlL]:\)\=\%(\i\|[#.]\|{.\{-1,}}\)*\ze\s*(" contains=@vimFuncList nextgroup=vimFuncBody
|
||||
|
||||
if exists("g:vimsyn_folding") && g:vimsyn_folding =~ 'f'
|
||||
if exists("g:vimsyn_folding") && g:vimsyn_folding =~# 'f'
|
||||
syn region vimFuncBody contained fold start="\ze\s*(" matchgroup=vimCommand end="\<\(endf\>\|endfu\%[nction]\>\)" contains=@vimFuncBodyList
|
||||
else
|
||||
syn region vimFuncBody contained start="\ze\s*(" matchgroup=vimCommand end="\<\(endf\>\|endfu\%[nction]\>\)" contains=@vimFuncBodyList
|
||||
@@ -224,10 +280,11 @@ syn match vimStringCont contained +\(\\\\\|.\)\{-}[^\\]"+
|
||||
syn cluster vimSubstList contains=vimPatSep,vimPatRegion,vimPatSepErr,vimSubstTwoBS,vimSubstRange,vimNotation
|
||||
syn cluster vimSubstRepList contains=vimSubstSubstr,vimSubstTwoBS,vimNotation
|
||||
syn cluster vimSubstList add=vimCollection
|
||||
syn match vimSubst "\(:\+\s*\|^\s*\||\s*\)\<\%(s\%[ubstitute]\|sm\%[agic]\|sno\%[magic]\)[:[:alpha:]]\@!" nextgroup=vimSubstPat
|
||||
syn match vimSubst "s\%[ubstitute][:#[:alpha:]]\@!" nextgroup=vimSubstPat contained
|
||||
syn match vimSubst "/\zss\%[ubstitute]\ze/" nextgroup=vimSubstPat
|
||||
syn match vimSubst1 contained "s\%[ubstitute]\>" nextgroup=vimSubstPat
|
||||
syn match vimSubst "\(:\+\s*\|^\s*\||\s*\)\<\%(\<s\%[ubstitute]\>\|\<sm\%[agic]\>\|\<sno\%[magic]\>\)[:#[:alpha:]]\@!" nextgroup=vimSubstPat
|
||||
syn match vimSubst "\%(^\|[^\\]\)\<s\%[ubstitute]\>[:#[:alpha:]]\@!" nextgroup=vimSubstPat contained
|
||||
syn match vimSubst "/\zs\<s\%[ubstitute]\>\ze/" nextgroup=vimSubstPat
|
||||
syn match vimSubst "\(:\+\s*\|^\s*\)s\ze#.\{-}#.\{-}#" nextgroup=vimSubstPat
|
||||
syn match vimSubst1 contained "\<s\%[ubstitute]\>" nextgroup=vimSubstPat
|
||||
syn region vimSubstPat contained matchgroup=vimSubstDelim start="\z([^a-zA-Z( \t[\]&]\)"rs=s+1 skip="\\\\\|\\\z1" end="\z1"re=e-1,me=e-1 contains=@vimSubstList nextgroup=vimSubstRep4 oneline
|
||||
syn region vimSubstRep4 contained matchgroup=vimSubstDelim start="\z(.\)" skip="\\\\\|\\\z1" end="\z1" matchgroup=vimNotation end="<[cC][rR]>" contains=@vimSubstRepList nextgroup=vimSubstFlagErr oneline
|
||||
syn region vimCollection contained transparent start="\\\@<!\[" skip="\\\[" end="\]" contains=vimCollClass
|
||||
@@ -267,7 +324,7 @@ syn match vimCmplxRepeat '[^a-zA-Z_/\\()]q[0-9a-zA-Z"]\>'lc=1
|
||||
syn match vimCmplxRepeat '@[0-9a-z".=@:]\ze\($\|[^a-zA-Z]\>\)'
|
||||
|
||||
" Set command and associated set-options (vimOptions) with comment {{{2
|
||||
syn region vimSet matchgroup=vimCommand start="\<\%(setl\%[ocal]\|setg\%[lobal]\|se\%[t]\)\>" skip="\%(\\\\\)*\\." end="$" matchgroup=vimNotation end="<[cC][rR]>" keepend oneline contains=vimSetEqual,vimOption,vimErrSetting,vimComment,vimSetString,vimSetMod,vimTermOption,vimOnlyOption
|
||||
syn region vimSet matchgroup=vimCommand start="\<\%(setl\%[ocal]\|setg\%[lobal]\|se\%[t]\)\>" skip="\%(\\\\\)*\\." end="$" matchgroup=vimNotation end="<[cC][rR]>" keepend oneline contains=vimSetEqual,vimOption,vimErrSetting,vimComment,vimSetString,vimSetMod
|
||||
syn region vimSetEqual contained start="[=:]\|[-+^]=" skip="\\\\\|\\\s" end="[| \t]\|$"me=e-1 contains=vimCtrlChar,vimSetSep,vimNotation,vimEnvvar oneline
|
||||
syn region vimSetString contained start=+="+hs=s+1 skip=+\\\\\|\\"+ end=+"+ contains=vimCtrlChar
|
||||
syn match vimSetSep contained "[,:]" skipwhite nextgroup=vimCommand
|
||||
@@ -341,8 +398,8 @@ syn case match
|
||||
" User Function Highlighting {{{2
|
||||
" (following Gautam Iyer's suggestion)
|
||||
" ==========================
|
||||
syn match vimFunc "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%([a-zA-Z0-9_.]\+\.\)*\I[a-zA-Z0-9_.]*\)\ze\s*(" contains=vimFuncName,vimUserFunc,vimExecute
|
||||
syn match vimUserFunc contained "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%([a-zA-Z0-9_.]\+\.\)*\I[a-zA-Z0-9_.]*\)\|\<\u[a-zA-Z0-9.]*\>\|\<if\>" contains=vimNotation
|
||||
syn match vimFunc "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%([a-zA-Z0-9_]\+\.\)*\I[a-zA-Z0-9_.]*\)\ze\s*(" contains=vimFuncName,vimUserFunc,vimExecute
|
||||
syn match vimUserFunc contained "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%([a-zA-Z0-9_]\+\.\)*\I[a-zA-Z0-9_.]*\)\|\<\u[a-zA-Z0-9.]*\>\|\<if\>" contains=vimNotation
|
||||
syn match vimNotFunc "\<if\>\|\<el\%[seif]\>\|\<return\>\|\<while\>"
|
||||
|
||||
" Errors And Warnings: {{{2
|
||||
@@ -388,11 +445,16 @@ syn keyword vimSynType contained clear skipwhite nextgroup=vimGroupList
|
||||
|
||||
" Syntax: cluster {{{2
|
||||
syn keyword vimSynType contained cluster skipwhite nextgroup=vimClusterName
|
||||
syn region vimClusterName contained matchgroup=vimGroupName start="\k\+" skip="\\\\\|\\|" matchgroup=vimSep end="$\||" contains=vimGroupAdd,vimGroupRem,vimSynContains,vimSynError
|
||||
syn region vimClusterName contained matchgroup=vimGroupName start="\h\w*" skip="\\\\\|\\|" matchgroup=vimSep end="$\||" contains=vimGroupAdd,vimGroupRem,vimSynContains,vimSynError
|
||||
syn match vimGroupAdd contained "add=" nextgroup=vimGroupList
|
||||
syn match vimGroupRem contained "remove=" nextgroup=vimGroupList
|
||||
syn cluster vimFuncBodyList add=vimSynType,vimGroupAdd,vimGroupRem
|
||||
|
||||
" Syntax: iskeyword {{{2
|
||||
syn keyword vimSynType contained iskeyword skipwhite nextgroup=vimIskList
|
||||
syn match vimIskList contained '\S\+' contains=vimIskSep
|
||||
syn match vimIskSep contained ','
|
||||
|
||||
" Syntax: include {{{2
|
||||
syn keyword vimSynType contained include skipwhite nextgroup=vimGroupList
|
||||
syn cluster vimFuncBodyList add=vimSynType
|
||||
@@ -400,14 +462,14 @@ syn cluster vimFuncBodyList add=vimSynType
|
||||
" Syntax: keyword {{{2
|
||||
syn cluster vimSynKeyGroup contains=vimSynNextgroup,vimSynKeyOpt,vimSynKeyContainedin
|
||||
syn keyword vimSynType contained keyword skipwhite nextgroup=vimSynKeyRegion
|
||||
syn region vimSynKeyRegion contained oneline keepend matchgroup=vimGroupName start="\k\+" skip="\\\\\|\\|" matchgroup=vimSep end="|\|$" contains=@vimSynKeyGroup
|
||||
syn region vimSynKeyRegion contained oneline keepend matchgroup=vimGroupName start="\h\w*" skip="\\\\\|\\|" matchgroup=vimSep end="|\|$" contains=@vimSynKeyGroup
|
||||
syn match vimSynKeyOpt contained "\<\(conceal\|contained\|transparent\|skipempty\|skipwhite\|skipnl\)\>"
|
||||
syn cluster vimFuncBodyList add=vimSynType
|
||||
|
||||
" Syntax: match {{{2
|
||||
syn cluster vimSynMtchGroup contains=vimMtchComment,vimSynContains,vimSynError,vimSynMtchOpt,vimSynNextgroup,vimSynRegPat,vimNotation
|
||||
syn keyword vimSynType contained match skipwhite nextgroup=vimSynMatchRegion
|
||||
syn region vimSynMatchRegion contained keepend matchgroup=vimGroupName start="\k\+" matchgroup=vimSep end="|\|$" contains=@vimSynMtchGroup
|
||||
syn region vimSynMatchRegion contained keepend matchgroup=vimGroupName start="\h\w*" matchgroup=vimSep end="|\|$" contains=@vimSynMtchGroup
|
||||
syn match vimSynMtchOpt contained "\<\(conceal\|transparent\|contained\|excludenl\|skipempty\|skipwhite\|display\|extend\|skipnl\|fold\)\>"
|
||||
if has("conceal")
|
||||
syn match vimSynMtchOpt contained "\<cchar=" nextgroup=vimSynMtchCchar
|
||||
@@ -422,7 +484,7 @@ syn keyword vimSynType contained enable list manual off on reset
|
||||
syn cluster vimSynRegPatGroup contains=vimPatSep,vimNotPatSep,vimSynPatRange,vimSynNotPatRange,vimSubstSubstr,vimPatRegion,vimPatSepErr,vimNotation
|
||||
syn cluster vimSynRegGroup contains=vimSynContains,vimSynNextgroup,vimSynRegOpt,vimSynReg,vimSynMtchGrp
|
||||
syn keyword vimSynType contained region skipwhite nextgroup=vimSynRegion
|
||||
syn region vimSynRegion contained keepend matchgroup=vimGroupName start="\k\+" skip="\\\\\|\\|" end="|\|$" contains=@vimSynRegGroup
|
||||
syn region vimSynRegion contained keepend matchgroup=vimGroupName start="\h\w*" skip="\\\\\|\\|" end="|\|$" contains=@vimSynRegGroup
|
||||
syn match vimSynRegOpt contained "\<\(conceal\(ends\)\=\|transparent\|contained\|excludenl\|skipempty\|skipwhite\|display\|keepend\|oneline\|extend\|skipnl\|fold\)\>"
|
||||
syn match vimSynReg contained "\(start\|skip\|end\)="he=e-1 nextgroup=vimSynRegPat
|
||||
syn match vimSynMtchGrp contained "matchgroup=" nextgroup=vimGroup,vimHLGroup,vimOnlyHLGroup,nvimHLGroup
|
||||
@@ -448,9 +510,9 @@ syn keyword vimSyncRegion contained region skipwhite nextgroup=vimSynReg
|
||||
syn match vimSyncLinebreak contained "\<linebreaks=" skipwhite nextgroup=vimNumber
|
||||
syn keyword vimSyncLinecont contained linecont skipwhite nextgroup=vimSynRegPat
|
||||
syn match vimSyncLines contained "\(min\|max\)\=lines=" nextgroup=vimNumber
|
||||
syn match vimSyncGroupName contained "\k\+" skipwhite nextgroup=vimSyncKey
|
||||
syn match vimSyncGroupName contained "\h\w*" skipwhite nextgroup=vimSyncKey
|
||||
syn match vimSyncKey contained "\<groupthere\|grouphere\>" skipwhite nextgroup=vimSyncGroup
|
||||
syn match vimSyncGroup contained "\k\+" skipwhite nextgroup=vimSynRegPat,vimSyncNone
|
||||
syn match vimSyncGroup contained "\h\w*" skipwhite nextgroup=vimSynRegPat,vimSyncNone
|
||||
syn keyword vimSyncNone contained NONE
|
||||
|
||||
" Additional IsCommand, here by reasons of precedence {{{2
|
||||
@@ -531,9 +593,14 @@ syn region vimGlobal matchgroup=Statement start='\<v\%[global]!\=/' skip='\\.' e
|
||||
" Allows users to specify the type of embedded script highlighting
|
||||
" they want: (perl/python/ruby/tcl support)
|
||||
" g:vimsyn_embed == 0 : don't embed any scripts
|
||||
" g:vimsyn_embed ~= 'P' : embed python (but only if vim supports it)
|
||||
" g:vimsyn_embed =~# 'l' : embed lua (but only if vim supports it)
|
||||
" g:vimsyn_embed =~# 'm' : embed mzscheme (but only if vim supports it)
|
||||
" g:vimsyn_embed =~# 'p' : embed perl (but only if vim supports it)
|
||||
" g:vimsyn_embed =~# 'P' : embed python (but only if vim supports it)
|
||||
" g:vimsyn_embed =~# 'r' : embed ruby (but only if vim supports it)
|
||||
" g:vimsyn_embed =~# 't' : embed tcl (but only if vim supports it)
|
||||
if !exists("g:vimsyn_embed")
|
||||
let g:vimsyn_embed= "P"
|
||||
let g:vimsyn_embed= "lmpPr"
|
||||
endif
|
||||
|
||||
" [-- lua --] {{{3
|
||||
@@ -546,9 +613,16 @@ if !filereadable(s:luapath)
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
syn region vimEmbedError start=+lua\s*<<\s*\z(.*\)$+ end=+^\z1$+
|
||||
syn region vimEmbedError start=+lua\s*<<\s*$+ end=+\.$+
|
||||
if (g:vimsyn_embed =~# 'l' && has("lua")) && filereadable(s:luapath)
|
||||
unlet! b:current_syntax
|
||||
exe "syn include @vimLuaScript ".s:luapath
|
||||
VimFoldl syn region vimLuaRegion matchgroup=vimScriptDelim start=+lua\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimLuaScript
|
||||
VimFoldl syn region vimLuaRegion matchgroup=vimScriptDelim start=+lua\s*<<\s*$+ end=+\.$+ contains=@vimLuaScript
|
||||
syn cluster vimFuncBodyList add=vimLuaRegion
|
||||
else
|
||||
syn region vimEmbedError start=+lua\s*<<\s*\z(.*\)$+ end=+^\z1$+
|
||||
syn region vimEmbedError start=+lua\s*<<\s*$+ end=+\.$+
|
||||
endif
|
||||
unlet s:luapath
|
||||
|
||||
" [-- perl --] {{{3
|
||||
@@ -561,9 +635,16 @@ if !filereadable(s:perlpath)
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
syn region vimEmbedError start=+pe\%[rl]\s*<<\s*\z(.*\)$+ end=+^\z1$+
|
||||
syn region vimEmbedError start=+pe\%[rl]\s*<<\s*$+ end=+\.$+
|
||||
if (g:vimsyn_embed =~# 'p' && has("perl")) && filereadable(s:perlpath)
|
||||
unlet! b:current_syntax
|
||||
exe "syn include @vimPerlScript ".s:perlpath
|
||||
VimFoldp syn region vimPerlRegion matchgroup=vimScriptDelim start=+pe\%[rl]\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimPerlScript
|
||||
VimFoldp syn region vimPerlRegion matchgroup=vimScriptDelim start=+pe\%[rl]\s*<<\s*$+ end=+\.$+ contains=@vimPerlScript
|
||||
syn cluster vimFuncBodyList add=vimPerlRegion
|
||||
else
|
||||
syn region vimEmbedError start=+pe\%[rl]\s*<<\s*\z(.*\)$+ end=+^\z1$+
|
||||
syn region vimEmbedError start=+pe\%[rl]\s*<<\s*$+ end=+\.$+
|
||||
endif
|
||||
unlet s:perlpath
|
||||
|
||||
" [-- ruby --] {{{3
|
||||
@@ -576,9 +657,16 @@ if !filereadable(s:rubypath)
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
syn region vimEmbedError start=+rub[y]\s*<<\s*\z(.*\)$+ end=+^\z1$+
|
||||
syn region vimEmbedError start=+rub[y]\s*<<\s*$+ end=+\.$+
|
||||
if (g:vimsyn_embed =~# 'r' && has("ruby")) && filereadable(s:rubypath)
|
||||
unlet! b:current_syntax
|
||||
exe "syn include @vimRubyScript ".s:rubypath
|
||||
VimFoldr syn region vimRubyRegion matchgroup=vimScriptDelim start=+rub[y]\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimRubyScript
|
||||
syn region vimRubyRegion matchgroup=vimScriptDelim start=+rub[y]\s*<<\s*$+ end=+\.$+ contains=@vimRubyScript
|
||||
syn cluster vimFuncBodyList add=vimRubyRegion
|
||||
else
|
||||
syn region vimEmbedError start=+rub[y]\s*<<\s*\z(.*\)$+ end=+^\z1$+
|
||||
syn region vimEmbedError start=+rub[y]\s*<<\s*$+ end=+\.$+
|
||||
endif
|
||||
unlet s:rubypath
|
||||
|
||||
" [-- python --] {{{3
|
||||
@@ -591,16 +679,13 @@ if !filereadable(s:pythonpath)
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
if g:vimsyn_embed =~ 'P' && filereadable(s:pythonpath)
|
||||
if g:vimsyn_embed =~# 'P' && (has("python") || has("python3")) && filereadable(s:pythonpath)
|
||||
unlet! b:current_syntax
|
||||
exe "syn include @vimPythonScript ".s:pythonpath
|
||||
if exists("g:vimsyn_folding") && g:vimsyn_folding =~ 'P'
|
||||
syn region vimPythonRegion fold matchgroup=vimScriptDelim start=+py\%[thon]3\=\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimPythonScript
|
||||
syn region vimPythonRegion fold matchgroup=vimScriptDelim start=+py\%[thon]3\=\s*<<\s*$+ end=+\.$+ contains=@vimPythonScript
|
||||
else
|
||||
syn region vimPythonRegion matchgroup=vimScriptDelim start=+py\%[thon]3\=\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimPythonScript
|
||||
syn region vimPythonRegion matchgroup=vimScriptDelim start=+py\%[thon]3\=\s*<<\s*$+ end=+\.$+ contains=@vimPythonScript
|
||||
endif
|
||||
VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+py\%[thon]3\=\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimPythonScript
|
||||
VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+py\%[thon]3\=\s*<<\s*$+ end=+\.$+ contains=@vimPythonScript
|
||||
VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+Py\%[thon]2or3\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimPythonScript
|
||||
VimFoldP syn region vimPythonRegion matchgroup=vimScriptDelim start=+Py\%[thon]2or3\=\s*<<\s*$+ end=+\.$+ contains=@vimPythonScript
|
||||
syn cluster vimFuncBodyList add=vimPythonRegion
|
||||
else
|
||||
syn region vimEmbedError start=+py\%[thon]3\=\s*<<\s*\z(.*\)$+ end=+^\z1$+
|
||||
@@ -625,11 +710,17 @@ if s:trytcl
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
syn region vimEmbedError start=+tc[l]\=\s*<<\s*\z(.*\)$+ end=+^\z1$+
|
||||
syn region vimEmbedError start=+tc[l]\=\s*<<\s*$+ end=+\.$+
|
||||
if (g:vimsyn_embed =~# 't' && has("tcl")) && filereadable(s:tclpath)
|
||||
unlet! b:current_syntax
|
||||
exe "syn include @vimTclScript ".s:tclpath
|
||||
VimFoldt syn region vimTclRegion matchgroup=vimScriptDelim start=+tc[l]\=\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimTclScript
|
||||
VimFoldt syn region vimTclRegion matchgroup=vimScriptDelim start=+tc[l]\=\s*<<\s*$+ end=+\.$+ contains=@vimTclScript
|
||||
syn cluster vimFuncBodyList add=vimTclScript
|
||||
else
|
||||
syn region vimEmbedError start=+tc[l]\=\s*<<\s*\z(.*\)$+ end=+^\z1$+
|
||||
syn region vimEmbedError start=+tc[l]\=\s*<<\s*$+ end=+\.$+
|
||||
endif
|
||||
unlet s:tclpath
|
||||
|
||||
else
|
||||
syn region vimEmbedError start=+tc[l]\=\s*<<\s*\z(.*\)$+ end=+^\z1$+
|
||||
syn region vimEmbedError start=+tc[l]\=\s*<<\s*$+ end=+\.$+
|
||||
@@ -646,9 +737,18 @@ if !filereadable(s:mzschemepath)
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
syn region vimEmbedError start=+mz\%[scheme]\s*<<\s*\z(.*\)$+ end=+^\z1$+
|
||||
syn region vimEmbedError start=+mz\%[scheme]\s*<<\s*$+ end=+\.$+
|
||||
if (g:vimsyn_embed =~# 'm' && has("mzscheme")) && filereadable(s:mzschemepath)
|
||||
unlet! b:current_syntax
|
||||
let iskKeep= &isk
|
||||
exe "syn include @vimMzSchemeScript ".s:mzschemepath
|
||||
let &isk= iskKeep
|
||||
VimFoldm syn region vimMzSchemeRegion matchgroup=vimScriptDelim start=+mz\%[scheme]\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimMzSchemeScript
|
||||
VimFoldm syn region vimMzSchemeRegion matchgroup=vimScriptDelim start=+mz\%[scheme]\s*<<\s*$+ end=+\.$+ contains=@vimMzSchemeScript
|
||||
syn cluster vimFuncBodyList add=vimMzSchemeRegion
|
||||
else
|
||||
syn region vimEmbedError start=+mz\%[scheme]\s*<<\s*\z(.*\)$+ end=+^\z1$+
|
||||
syn region vimEmbedError start=+mz\%[scheme]\s*<<\s*$+ end=+\.$+
|
||||
endif
|
||||
unlet s:mzschemepath
|
||||
|
||||
" Synchronize (speed) {{{2
|
||||
@@ -668,7 +768,6 @@ syn sync match vimAugroupSyncA groupthere NONE "\<aug\%[roup]\>\s\+[eE][nN][dD]"
|
||||
" Highlighting Settings {{{2
|
||||
" ====================
|
||||
|
||||
|
||||
if !exists("g:vimsyn_noerror")
|
||||
hi def link vimBehaveError vimError
|
||||
hi def link vimCollClassErr vimError
|
||||
@@ -685,14 +784,11 @@ if !exists("g:vimsyn_noerror")
|
||||
hi def link vimSubstFlagErr vimError
|
||||
hi def link vimSynCaseError vimError
|
||||
hi def link vimBufnrWarn vimWarn
|
||||
hi def link vimOnlyCommand vimError
|
||||
hi def link vimTermOption vimError
|
||||
hi def link vimOnlyOption vimError
|
||||
hi def link vimOnlyHLGroup vimError
|
||||
endif
|
||||
|
||||
hi def link vimAbb vimCommand
|
||||
hi def link vimAddress vimMark
|
||||
hi def link vimAugroupError vimError
|
||||
hi def link vimAugroupKey vimCommand
|
||||
hi def link vimAuHighlight vimHighlight
|
||||
hi def link vimAutoCmdOpt vimOption
|
||||
@@ -748,6 +844,7 @@ hi def link vimHLGroup vimGroup
|
||||
hi def link nvimHLGroup vimHLGroup
|
||||
hi def link vimHLMod PreProc
|
||||
hi def link vimInsert vimString
|
||||
hi def link vimIskSep Delimiter
|
||||
hi def link vimKeyCode vimSpecFile
|
||||
hi def link vimKeyword Statement
|
||||
hi def link vimLet vimCommand
|
||||
@@ -830,6 +927,7 @@ hi def link vimUserAttrbCmpltFunc Special
|
||||
hi def link vimUserAttrbCmplt vimSpecial
|
||||
hi def link vimUserAttrbKey vimOption
|
||||
hi def link vimUserAttrb vimSpecial
|
||||
hi def link vimUserAttrbError Error
|
||||
hi def link vimUserCmdError Error
|
||||
hi def link vimUserCommand vimCommand
|
||||
hi def link vimUserFunc Normal
|
||||
@@ -841,6 +939,14 @@ let b:current_syntax = "vim"
|
||||
|
||||
" ---------------------------------------------------------------------
|
||||
" Cleanup: {{{1
|
||||
delc VimFolda
|
||||
delc VimFoldf
|
||||
delc VimFoldl
|
||||
delc VimFoldm
|
||||
delc VimFoldp
|
||||
delc VimFoldP
|
||||
delc VimFoldr
|
||||
delc VimFoldt
|
||||
let &cpo = s:keepcpo
|
||||
unlet s:keepcpo
|
||||
" vim:ts=18 fdm=marker
|
||||
|
@@ -19,6 +19,12 @@ inoremap <C-U> <C-G>u<C-U>
|
||||
" Switch syntax highlighting on
|
||||
syntax on
|
||||
|
||||
" Also switch on highlighting the last used search pattern.
|
||||
set hlsearch
|
||||
|
||||
" I like highlighting strings inside C comments.
|
||||
let c_comment_strings=1
|
||||
|
||||
" Enable file type detection.
|
||||
" Use the default filetype settings, so that mail gets 'textwidth' set to 72,
|
||||
" 'cindent' is on in C files, etc.
|
||||
|
@@ -1,11 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
files="UnicodeData.txt CaseFolding.txt EastAsianWidth.txt"
|
||||
data_files="UnicodeData.txt CaseFolding.txt EastAsianWidth.txt"
|
||||
emoji_files="emoji-data.txt"
|
||||
|
||||
UNIDIR_DEFAULT=unicode
|
||||
DOWNLOAD_URL_BASE_DEFAULT='http://unicode.org/Public/UNIDATA'
|
||||
DOWNLOAD_URL_BASE_DEFAULT='http://unicode.org/Public'
|
||||
|
||||
if test x$1 = 'x--help' ; then
|
||||
echo 'Usage:'
|
||||
@@ -21,8 +21,16 @@ fi
|
||||
UNIDIR=${1:-$UNIDIR_DEFAULT}
|
||||
DOWNLOAD_URL_BASE=${2:-$DOWNLOAD_URL_BASE_DEFAULT}
|
||||
|
||||
for filename in $files ; do
|
||||
curl -o "$UNIDIR/$filename" "$DOWNLOAD_URL_BASE/$filename"
|
||||
for filename in $data_files ; do
|
||||
curl -o "$UNIDIR/$filename" "$DOWNLOAD_URL_BASE/UNIDATA/$filename"
|
||||
(
|
||||
cd "$UNIDIR"
|
||||
git add $filename
|
||||
)
|
||||
done
|
||||
|
||||
for filename in $emoji_files ; do
|
||||
curl -o "$UNIDIR/$filename" "$DOWNLOAD_URL_BASE/emoji/3.0/$filename"
|
||||
(
|
||||
cd "$UNIDIR"
|
||||
git add $filename
|
||||
|
329
scripts/gendispatch.lua
Normal file
329
scripts/gendispatch.lua
Normal file
@@ -0,0 +1,329 @@
|
||||
lpeg = require('lpeg')
|
||||
mpack = require('mpack')
|
||||
|
||||
-- lpeg grammar for building api metadata from a set of header files. It
|
||||
-- ignores comments and preprocessor commands and parses a very small subset
|
||||
-- of C prototypes with a limited set of types
|
||||
P, R, S = lpeg.P, lpeg.R, lpeg.S
|
||||
C, Ct, Cc, Cg = lpeg.C, lpeg.Ct, lpeg.Cc, lpeg.Cg
|
||||
|
||||
any = P(1) -- (consume one character)
|
||||
letter = R('az', 'AZ') + S('_$')
|
||||
alpha = letter + R('09')
|
||||
nl = P('\r\n') + P('\n')
|
||||
not_nl = any - nl
|
||||
ws = S(' \t') + nl
|
||||
fill = ws ^ 0
|
||||
c_comment = P('//') * (not_nl ^ 0)
|
||||
c_preproc = P('#') * (not_nl ^ 0)
|
||||
typed_container =
|
||||
(P('ArrayOf(') + P('DictionaryOf(')) * ((any - P(')')) ^ 1) * P(')')
|
||||
c_id = (
|
||||
typed_container +
|
||||
(letter * (alpha ^ 0))
|
||||
)
|
||||
c_void = P('void')
|
||||
c_param_type = (
|
||||
((P('Error') * fill * P('*') * fill) * Cc('error')) +
|
||||
(C(c_id) * (ws ^ 1))
|
||||
)
|
||||
c_type = (C(c_void) * (ws ^ 1)) + c_param_type
|
||||
c_param = Ct(c_param_type * C(c_id))
|
||||
c_param_list = c_param * (fill * (P(',') * fill * c_param) ^ 0)
|
||||
c_params = Ct(c_void + c_param_list)
|
||||
c_proto = Ct(
|
||||
Cg(c_type, 'return_type') * Cg(c_id, 'name') *
|
||||
fill * P('(') * fill * Cg(c_params, 'parameters') * fill * P(')') *
|
||||
Cg(Cc(false), 'async') *
|
||||
(fill * Cg((P('FUNC_API_ASYNC') * Cc(true)), 'async') ^ -1) *
|
||||
(fill * Cg((P('FUNC_API_NOEXPORT') * Cc(true)), 'noexport') ^ -1) *
|
||||
(fill * Cg((P('FUNC_API_NOEVAL') * Cc(true)), 'noeval') ^ -1) *
|
||||
fill * P(';')
|
||||
)
|
||||
grammar = Ct((c_proto + c_comment + c_preproc + ws) ^ 1)
|
||||
|
||||
-- we need at least 4 arguments since the last two are output files
|
||||
assert(#arg >= 3)
|
||||
functions = {}
|
||||
|
||||
local nvimsrcdir = arg[1]
|
||||
package.path = nvimsrcdir .. '/?.lua;' .. package.path
|
||||
|
||||
-- names of all headers relative to the source root (for inclusion in the
|
||||
-- generated file)
|
||||
headers = {}
|
||||
-- output h file with generated dispatch functions
|
||||
dispatch_outputf = arg[#arg-2]
|
||||
-- output h file with packed metadata
|
||||
funcs_metadata_outputf = arg[#arg-1]
|
||||
-- output metadata mpack file, for use by other build scripts
|
||||
mpack_outputf = arg[#arg]
|
||||
|
||||
-- set of function names, used to detect duplicates
|
||||
function_names = {}
|
||||
|
||||
-- read each input file, parse and append to the api metadata
|
||||
for i = 2, #arg - 3 do
|
||||
local full_path = arg[i]
|
||||
local parts = {}
|
||||
for part in string.gmatch(full_path, '[^/]+') do
|
||||
parts[#parts + 1] = part
|
||||
end
|
||||
headers[#headers + 1] = parts[#parts - 1]..'/'..parts[#parts]
|
||||
|
||||
local input = io.open(full_path, 'rb')
|
||||
local tmp = grammar:match(input:read('*all'))
|
||||
for i = 1, #tmp do
|
||||
local fn = tmp[i]
|
||||
if not fn.noexport then
|
||||
functions[#functions + 1] = tmp[i]
|
||||
function_names[fn.name] = true
|
||||
if #fn.parameters ~= 0 and fn.parameters[1][2] == 'channel_id' then
|
||||
-- this function should receive the channel id
|
||||
fn.receives_channel_id = true
|
||||
-- remove the parameter since it won't be passed by the api client
|
||||
table.remove(fn.parameters, 1)
|
||||
end
|
||||
if #fn.parameters ~= 0 and fn.parameters[#fn.parameters][1] == 'error' then
|
||||
-- function can fail if the last parameter type is 'Error'
|
||||
fn.can_fail = true
|
||||
-- remove the error parameter, msgpack has it's own special field
|
||||
-- for specifying errors
|
||||
fn.parameters[#fn.parameters] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
input:close()
|
||||
end
|
||||
|
||||
local function shallowcopy(orig)
|
||||
local copy = {}
|
||||
for orig_key, orig_value in pairs(orig) do
|
||||
copy[orig_key] = orig_value
|
||||
end
|
||||
return copy
|
||||
end
|
||||
|
||||
local function startswith(String,Start)
|
||||
return string.sub(String,1,string.len(Start))==Start
|
||||
end
|
||||
|
||||
-- Export functions under older deprecated names.
|
||||
-- These will be removed eventually.
|
||||
local deprecated_aliases = require("api.dispatch_deprecated")
|
||||
for i,f in ipairs(shallowcopy(functions)) do
|
||||
local ismethod = false
|
||||
if startswith(f.name, "nvim_") then
|
||||
-- TODO(bfredl) after 0.1.6 allow method definitions
|
||||
-- to specify the since and deprecated_since field
|
||||
f.since = 1
|
||||
if startswith(f.name, "nvim_buf_") then
|
||||
ismethod = true
|
||||
elseif startswith(f.name, "nvim_win_") then
|
||||
ismethod = true
|
||||
elseif startswith(f.name, "nvim_tabpage_") then
|
||||
ismethod = true
|
||||
end
|
||||
else
|
||||
f.noeval = true
|
||||
f.since = 0
|
||||
f.deprecated_since = 1
|
||||
end
|
||||
f.method = ismethod
|
||||
local newname = deprecated_aliases[f.name]
|
||||
if newname ~= nil then
|
||||
if function_names[newname] then
|
||||
-- duplicate
|
||||
print("Function "..f.name.." has deprecated alias\n"
|
||||
..newname.." which has a separate implementation.\n"..
|
||||
"Please remove it from src/nvim/api/dispatch_deprecated.lua")
|
||||
os.exit(1)
|
||||
end
|
||||
local newf = shallowcopy(f)
|
||||
newf.name = newname
|
||||
if newname == "ui_try_resize" then
|
||||
-- The return type was incorrectly set to Object in 0.1.5.
|
||||
-- Keep it that way for clients that rely on this.
|
||||
newf.return_type = "Object"
|
||||
end
|
||||
newf.impl_name = f.name
|
||||
newf.noeval = true
|
||||
newf.since = 0
|
||||
newf.deprecated_since = 1
|
||||
functions[#functions+1] = newf
|
||||
end
|
||||
end
|
||||
|
||||
-- don't expose internal attributes like "impl_name" in public metadata
|
||||
exported_attributes = {'name', 'parameters', 'return_type', 'method',
|
||||
'since', 'deprecated_since'}
|
||||
exported_functions = {}
|
||||
for _,f in ipairs(functions) do
|
||||
local f_exported = {}
|
||||
for _,attr in ipairs(exported_attributes) do
|
||||
f_exported[attr] = f[attr]
|
||||
end
|
||||
exported_functions[#exported_functions+1] = f_exported
|
||||
end
|
||||
|
||||
|
||||
funcs_metadata_output = io.open(funcs_metadata_outputf, 'wb')
|
||||
funcs_metadata_output:write([[
|
||||
static const uint8_t funcs_metadata[] = {
|
||||
]])
|
||||
|
||||
-- serialize the API metadata using msgpack and embed into the resulting
|
||||
-- binary for easy querying by clients
|
||||
packed_exported_functions = mpack.pack(exported_functions)
|
||||
for i = 1, #packed_exported_functions do
|
||||
funcs_metadata_output:write(string.byte(packed_exported_functions, i)..', ')
|
||||
if i % 10 == 0 then
|
||||
funcs_metadata_output:write('\n ')
|
||||
end
|
||||
end
|
||||
funcs_metadata_output:write([[
|
||||
};
|
||||
]])
|
||||
funcs_metadata_output:close()
|
||||
|
||||
-- start building the dispatch wrapper output
|
||||
output = io.open(dispatch_outputf, 'wb')
|
||||
|
||||
local function real_type(type)
|
||||
local rv = type
|
||||
if typed_container:match(rv) then
|
||||
if rv:match('Array') then
|
||||
rv = 'Array'
|
||||
else
|
||||
rv = 'Dictionary'
|
||||
end
|
||||
end
|
||||
return rv
|
||||
end
|
||||
|
||||
-- start the handler functions. Visit each function metadata to build the
|
||||
-- handler function with code generated for validating arguments and calling to
|
||||
-- the real API.
|
||||
for i = 1, #functions do
|
||||
local fn = functions[i]
|
||||
if fn.impl_name == nil then
|
||||
local args = {}
|
||||
|
||||
output:write('Object handle_'..fn.name..'(uint64_t channel_id, Array args, Error *error)')
|
||||
output:write('\n{')
|
||||
output:write('\n Object ret = NIL;')
|
||||
-- Declare/initialize variables that will hold converted arguments
|
||||
for j = 1, #fn.parameters do
|
||||
local param = fn.parameters[j]
|
||||
local converted = 'arg_'..j
|
||||
output:write('\n '..param[1]..' '..converted..';')
|
||||
end
|
||||
output:write('\n')
|
||||
output:write('\n if (args.size != '..#fn.parameters..') {')
|
||||
output:write('\n snprintf(error->msg, sizeof(error->msg), "Wrong number of arguments: expecting '..#fn.parameters..' but got %zu", args.size);')
|
||||
output:write('\n error->set = true;')
|
||||
output:write('\n goto cleanup;')
|
||||
output:write('\n }\n')
|
||||
|
||||
-- Validation/conversion for each argument
|
||||
for j = 1, #fn.parameters do
|
||||
local converted, convert_arg, param, arg
|
||||
param = fn.parameters[j]
|
||||
converted = 'arg_'..j
|
||||
local rt = real_type(param[1])
|
||||
if rt ~= 'Object' then
|
||||
if rt:match('^Buffer$') or rt:match('^Window$') or rt:match('^Tabpage$') then
|
||||
-- Buffer, Window, and Tabpage have a specific type, but are stored in integer
|
||||
output:write('\n if (args.items['..(j - 1)..'].type == kObjectType'..rt..' && args.items['..(j - 1)..'].data.integer >= 0) {')
|
||||
output:write('\n '..converted..' = (handle_T)args.items['..(j - 1)..'].data.integer;')
|
||||
else
|
||||
output:write('\n if (args.items['..(j - 1)..'].type == kObjectType'..rt..') {')
|
||||
output:write('\n '..converted..' = args.items['..(j - 1)..'].data.'..rt:lower()..';')
|
||||
end
|
||||
if rt:match('^Buffer$') or rt:match('^Window$') or rt:match('^Tabpage$') or rt:match('^Boolean$') then
|
||||
-- accept nonnegative integers for Booleans, Buffers, Windows and Tabpages
|
||||
output:write('\n } else if (args.items['..(j - 1)..'].type == kObjectTypeInteger && args.items['..(j - 1)..'].data.integer >= 0) {')
|
||||
output:write('\n '..converted..' = (handle_T)args.items['..(j - 1)..'].data.integer;')
|
||||
end
|
||||
output:write('\n } else {')
|
||||
output:write('\n snprintf(error->msg, sizeof(error->msg), "Wrong type for argument '..j..', expecting '..param[1]..'");')
|
||||
output:write('\n error->set = true;')
|
||||
output:write('\n goto cleanup;')
|
||||
output:write('\n }\n')
|
||||
else
|
||||
output:write('\n '..converted..' = args.items['..(j - 1)..'];\n')
|
||||
end
|
||||
|
||||
args[#args + 1] = converted
|
||||
end
|
||||
|
||||
-- function call
|
||||
local call_args = table.concat(args, ', ')
|
||||
output:write('\n ')
|
||||
if fn.return_type ~= 'void' then
|
||||
-- has a return value, prefix the call with a declaration
|
||||
output:write(fn.return_type..' rv = ')
|
||||
end
|
||||
|
||||
-- write the function name and the opening parenthesis
|
||||
output:write(fn.name..'(')
|
||||
|
||||
if fn.receives_channel_id then
|
||||
-- if the function receives the channel id, pass it as first argument
|
||||
if #args > 0 or fn.can_fail then
|
||||
output:write('channel_id, '..call_args)
|
||||
else
|
||||
output:write('channel_id')
|
||||
end
|
||||
else
|
||||
output:write(call_args)
|
||||
end
|
||||
|
||||
if fn.can_fail then
|
||||
-- if the function can fail, also pass a pointer to the local error object
|
||||
if #args > 0 then
|
||||
output:write(', error);\n')
|
||||
else
|
||||
output:write('error);\n')
|
||||
end
|
||||
-- and check for the error
|
||||
output:write('\n if (error->set) {')
|
||||
output:write('\n goto cleanup;')
|
||||
output:write('\n }\n')
|
||||
else
|
||||
output:write(');\n')
|
||||
end
|
||||
|
||||
if fn.return_type ~= 'void' then
|
||||
output:write('\n ret = '..string.upper(real_type(fn.return_type))..'_OBJ(rv);')
|
||||
end
|
||||
output:write('\n\ncleanup:');
|
||||
|
||||
output:write('\n return ret;\n}\n\n');
|
||||
end
|
||||
end
|
||||
|
||||
-- Generate a function that initializes method names with handler functions
|
||||
output:write([[
|
||||
void msgpack_rpc_init_method_table(void)
|
||||
{
|
||||
methods = map_new(String, MsgpackRpcRequestHandler)();
|
||||
|
||||
]])
|
||||
|
||||
for i = 1, #functions do
|
||||
local fn = functions[i]
|
||||
output:write(' msgpack_rpc_add_method_handler('..
|
||||
'(String) {.data = "'..fn.name..'", '..
|
||||
'.size = sizeof("'..fn.name..'") - 1}, '..
|
||||
'(MsgpackRpcRequestHandler) {.fn = handle_'.. (fn.impl_name or fn.name)..
|
||||
', .async = '..tostring(fn.async)..'});\n')
|
||||
|
||||
end
|
||||
|
||||
output:write('\n}\n\n')
|
||||
output:close()
|
||||
|
||||
mpack_output = io.open(mpack_outputf, 'wb')
|
||||
mpack_output:write(mpack.pack(functions))
|
||||
mpack_output:close()
|
66
scripts/geneval.lua
Normal file
66
scripts/geneval.lua
Normal file
@@ -0,0 +1,66 @@
|
||||
mpack = require('mpack')
|
||||
|
||||
local nvimsrcdir = arg[1]
|
||||
local autodir = arg[2]
|
||||
local metadata_file = arg[3]
|
||||
local funcs_file = arg[4]
|
||||
|
||||
if nvimsrcdir == '--help' then
|
||||
print([[
|
||||
Usage:
|
||||
lua geneval.lua src/nvim build/src/nvim/auto
|
||||
|
||||
Will generate build/src/nvim/auto/funcs.generated.h with definition of functions
|
||||
static const array.
|
||||
]])
|
||||
os.exit(0)
|
||||
end
|
||||
|
||||
package.path = nvimsrcdir .. '/?.lua;' .. package.path
|
||||
|
||||
local funcsfname = autodir .. '/funcs.generated.h'
|
||||
|
||||
local gperfpipe = io.open(funcsfname .. '.gperf', 'wb')
|
||||
|
||||
local funcs = require('eval').funcs
|
||||
local metadata = mpack.unpack(io.open(arg[3], 'rb'):read("*all"))
|
||||
for i,fun in ipairs(metadata) do
|
||||
if not fun.noeval then
|
||||
funcs[fun.name] = {
|
||||
args=#fun.parameters,
|
||||
func='api_wrapper',
|
||||
data='&handle_'..fun.name,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
local funcsdata = io.open(funcs_file, 'w')
|
||||
funcsdata:write(mpack.pack(funcs))
|
||||
funcsdata:close()
|
||||
|
||||
gperfpipe:write([[
|
||||
%language=ANSI-C
|
||||
%global-table
|
||||
%define initializer-suffix ,0,0,NULL,NULL
|
||||
%define word-array-name functions
|
||||
%define hash-function-name hash_internal_func_gperf
|
||||
%define lookup-function-name find_internal_func_gperf
|
||||
%omit-struct-type
|
||||
%struct-type
|
||||
VimLFuncDef;
|
||||
%%
|
||||
]])
|
||||
|
||||
for name, def in pairs(funcs) do
|
||||
args = def.args or 0
|
||||
if type(args) == 'number' then
|
||||
args = {args, args}
|
||||
elseif #args == 1 then
|
||||
args[2] = 'MAX_FUNC_ARGS'
|
||||
end
|
||||
func = def.func or ('f_' .. name)
|
||||
data = def.data or "NULL"
|
||||
gperfpipe:write(('%s, %s, %s, &%s, (FunPtr)%s\n')
|
||||
:format(name, args[1], args[2], func, data))
|
||||
end
|
||||
gperfpipe:close()
|
@@ -12,19 +12,27 @@
|
||||
-- 2 then interval applies only to first, third, fifth, … character in range.
|
||||
-- Fourth value is number that should be added to the codepoint to yield
|
||||
-- folded/lower/upper codepoint.
|
||||
-- 4. emoji_width and emoji_all tables: sorted lists of non-overlapping closed
|
||||
-- intervals of Emoji characters. emoji_width contains all the characters
|
||||
-- which don't have ambiguous or double width, and emoji_all has all Emojis.
|
||||
if arg[1] == '--help' then
|
||||
print('Usage:')
|
||||
print(' genunicodetables.lua UnicodeData.txt CaseFolding.txt ' ..
|
||||
'EastAsianWidth.txt')
|
||||
print(' unicode_tables.generated.h')
|
||||
print(' genunicodetables.lua unicode/ unicode_tables.generated.h')
|
||||
os.exit(0)
|
||||
end
|
||||
|
||||
local unicodedata_fname = arg[1]
|
||||
local casefolding_fname = arg[2]
|
||||
local eastasianwidth_fname = arg[3]
|
||||
local basedir = arg[1]
|
||||
local pathsep = package.config:sub(1, 1)
|
||||
local get_path = function(fname)
|
||||
return basedir .. pathsep .. fname
|
||||
end
|
||||
|
||||
local utf_tables_fname = arg[4]
|
||||
local unicodedata_fname = get_path('UnicodeData.txt')
|
||||
local casefolding_fname = get_path('CaseFolding.txt')
|
||||
local eastasianwidth_fname = get_path('EastAsianWidth.txt')
|
||||
local emoji_fname = get_path('emoji-data.txt')
|
||||
|
||||
local utf_tables_fname = arg[2]
|
||||
|
||||
local split_on_semicolons = function(s)
|
||||
local ret = {}
|
||||
@@ -79,6 +87,10 @@ local parse_width_props = function(eaw_fp)
|
||||
return fp_lines_to_lists(eaw_fp, 2, true)
|
||||
end
|
||||
|
||||
local parse_emoji_props = function(emoji_fp)
|
||||
return fp_lines_to_lists(emoji_fp, 2, true)
|
||||
end
|
||||
|
||||
local make_range = function(start, end_, step, add)
|
||||
if step and add then
|
||||
return (' {0x%x, 0x%x, %d, %d},\n'):format(
|
||||
@@ -168,6 +180,7 @@ local build_width_table = function(ut_fp, dataprops, widthprops, widths,
|
||||
local start = -1
|
||||
local end_ = -1
|
||||
local dataidx = 1
|
||||
local ret = {}
|
||||
for _, p in ipairs(widthprops) do
|
||||
if widths[p[2]:sub(1, 1)] then
|
||||
local rng_start, rng_end = p[1]:find('%.%.')
|
||||
@@ -200,6 +213,7 @@ local build_width_table = function(ut_fp, dataprops, widthprops, widths,
|
||||
else
|
||||
if start >= 0 then
|
||||
ut_fp:write(make_range(start, end_))
|
||||
table.insert(ret, {start, end_})
|
||||
end
|
||||
start = n
|
||||
end
|
||||
@@ -209,6 +223,72 @@ local build_width_table = function(ut_fp, dataprops, widthprops, widths,
|
||||
end
|
||||
if start >= 0 then
|
||||
ut_fp:write(make_range(start, end_))
|
||||
table.insert(ret, {start, end_})
|
||||
end
|
||||
ut_fp:write('};\n')
|
||||
return ret
|
||||
end
|
||||
|
||||
local build_emoji_table = function(ut_fp, emojiprops, doublewidth, ambiwidth)
|
||||
local emojiwidth = {}
|
||||
local emoji = {}
|
||||
for _, p in ipairs(emojiprops) do
|
||||
if p[2]:match('Emoji%s+#') then
|
||||
local rng_start, rng_end = p[1]:find('%.%.')
|
||||
if rng_start then
|
||||
n = tonumber(p[1]:sub(1, rng_start - 1), 16)
|
||||
n_last = tonumber(p[1]:sub(rng_end + 1), 16)
|
||||
else
|
||||
n = tonumber(p[1], 16)
|
||||
n_last = n
|
||||
end
|
||||
if #emoji > 0 and n - 1 == emoji[#emoji][2] then
|
||||
emoji[#emoji][2] = n_last
|
||||
else
|
||||
table.insert(emoji, { n, n_last })
|
||||
end
|
||||
|
||||
-- Characters below 1F000 may be considered single width traditionally,
|
||||
-- making them double width causes problems.
|
||||
if n >= 0x1f000 then
|
||||
-- exclude characters that are in the ambiguous/doublewidth table
|
||||
for _, ambi in ipairs(ambiwidth) do
|
||||
if n >= ambi[1] and n <= ambi[2] then
|
||||
n = ambi[2] + 1
|
||||
end
|
||||
if n_last >= ambi[1] and n_last <= ambi[2] then
|
||||
n_last = ambi[1] - 1
|
||||
end
|
||||
end
|
||||
for _, double in ipairs(doublewidth) do
|
||||
if n >= double[1] and n <= double[2] then
|
||||
n = double[2] + 1
|
||||
end
|
||||
if n_last >= double[1] and n_last <= double[2] then
|
||||
n_last = double[1] - 1
|
||||
end
|
||||
end
|
||||
|
||||
if n <= n_last then
|
||||
if #emojiwidth > 0 and n - 1 == emojiwidth[#emojiwidth][2] then
|
||||
emojiwidth[#emojiwidth][2] = n_last
|
||||
else
|
||||
table.insert(emojiwidth, { n, n_last })
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ut_fp:write('static const struct interval emoji_all[] = {\n')
|
||||
for _, p in ipairs(emoji) do
|
||||
ut_fp:write(make_range(p[1], p[2]))
|
||||
end
|
||||
ut_fp:write('};\n')
|
||||
|
||||
ut_fp:write('static const struct interval emoji_width[] = {\n')
|
||||
for _, p in ipairs(emojiwidth) do
|
||||
ut_fp:write(make_range(p[1], p[2]))
|
||||
end
|
||||
ut_fp:write('};\n')
|
||||
end
|
||||
@@ -233,7 +313,15 @@ local eaw_fp = io.open(eastasianwidth_fname, 'r')
|
||||
local widthprops = parse_width_props(eaw_fp)
|
||||
eaw_fp:close()
|
||||
|
||||
build_width_table(ut_fp, dataprops, widthprops, {W=true, F=true}, 'doublewidth')
|
||||
build_width_table(ut_fp, dataprops, widthprops, {A=true}, 'ambiguous')
|
||||
local doublewidth = build_width_table(ut_fp, dataprops, widthprops,
|
||||
{W=true, F=true}, 'doublewidth')
|
||||
local ambiwidth = build_width_table(ut_fp, dataprops, widthprops,
|
||||
{A=true}, 'ambiguous')
|
||||
|
||||
local emoji_fp = io.open(emoji_fname, 'r')
|
||||
local emojiprops = parse_emoji_props(emoji_fp)
|
||||
emoji_fp:close()
|
||||
|
||||
build_emoji_table(ut_fp, emojiprops, doublewidth, ambiwidth)
|
||||
|
||||
ut_fp:close()
|
||||
|
@@ -1,10 +1,13 @@
|
||||
mpack = require('mpack')
|
||||
|
||||
if arg[1] == '--help' then
|
||||
print('Usage: genoptions.lua src/nvim runtime/syntax/vim/generated.vim')
|
||||
print('Usage: lua genvimvim.lua src/nvim runtime/syntax/vim/generated.vim')
|
||||
os.exit(0)
|
||||
end
|
||||
|
||||
local nvimsrcdir = arg[1]
|
||||
local syntax_file = arg[2]
|
||||
local funcs_file = arg[3]
|
||||
|
||||
package.path = nvimsrcdir .. '/?.lua;' .. package.path
|
||||
|
||||
@@ -111,28 +114,16 @@ end
|
||||
w('\n\nsyn case match')
|
||||
local vimfun_start = 'syn keyword vimFuncName contained '
|
||||
w('\n\n' .. vimfun_start)
|
||||
eval_fd = io.open(nvimsrcdir .. '/eval.c', 'r')
|
||||
funcs = mpack.unpack(io.open(funcs_file):read("*all"))
|
||||
local started = 0
|
||||
for line in eval_fd:lines() do
|
||||
if line == '} functions[] =' then
|
||||
started = 1
|
||||
elseif started == 1 then
|
||||
assert (line == '{')
|
||||
started = 2
|
||||
elseif started == 2 then
|
||||
if line == '};' then
|
||||
break
|
||||
end
|
||||
local func_name = line:match('^ { "([%w_]+)",')
|
||||
if func_name then
|
||||
if lld.line_length > 850 then
|
||||
w('\n' .. vimfun_start)
|
||||
end
|
||||
w(' ' .. func_name)
|
||||
for name, def in pairs(funcs) do
|
||||
if name then
|
||||
if lld.line_length > 850 then
|
||||
w('\n' .. vimfun_start)
|
||||
end
|
||||
w(' ' .. name)
|
||||
end
|
||||
end
|
||||
eval_fd:close()
|
||||
|
||||
w('\n')
|
||||
syn_fd:close()
|
||||
|
@@ -19,7 +19,7 @@ is_merge_commit() {
|
||||
git log $1^2 >/dev/null 2>&1 && return 0 || return 1
|
||||
}
|
||||
|
||||
for commit in $(git log --format='%H' --first-parent --since $__SINCE); do
|
||||
for commit in $(git log --format='%H' --first-parent "$__SINCE"..HEAD); do
|
||||
if is_merge_commit ${commit} ; then
|
||||
if [ -z "$__INVMATCH" ] || ! git log --oneline ${commit}^1..${commit}^2 \
|
||||
| grep -E "$__INVMATCH" >/dev/null 2>&1 ; then
|
||||
|
@@ -1,313 +0,0 @@
|
||||
lpeg = require('lpeg')
|
||||
mpack = require('mpack')
|
||||
|
||||
-- lpeg grammar for building api metadata from a set of header files. It
|
||||
-- ignores comments and preprocessor commands and parses a very small subset
|
||||
-- of C prototypes with a limited set of types
|
||||
P, R, S = lpeg.P, lpeg.R, lpeg.S
|
||||
C, Ct, Cc, Cg = lpeg.C, lpeg.Ct, lpeg.Cc, lpeg.Cg
|
||||
|
||||
any = P(1) -- (consume one character)
|
||||
letter = R('az', 'AZ') + S('_$')
|
||||
alpha = letter + R('09')
|
||||
nl = P('\r\n') + P('\n')
|
||||
not_nl = any - nl
|
||||
ws = S(' \t') + nl
|
||||
fill = ws ^ 0
|
||||
c_comment = P('//') * (not_nl ^ 0)
|
||||
c_preproc = P('#') * (not_nl ^ 0)
|
||||
typed_container =
|
||||
(P('ArrayOf(') + P('DictionaryOf(')) * ((any - P(')')) ^ 1) * P(')')
|
||||
c_id = (
|
||||
typed_container +
|
||||
(letter * (alpha ^ 0))
|
||||
)
|
||||
c_void = P('void')
|
||||
c_param_type = (
|
||||
((P('Error') * fill * P('*') * fill) * Cc('error')) +
|
||||
(C(c_id) * (ws ^ 1))
|
||||
)
|
||||
c_type = (C(c_void) * (ws ^ 1)) + c_param_type
|
||||
c_param = Ct(c_param_type * C(c_id))
|
||||
c_param_list = c_param * (fill * (P(',') * fill * c_param) ^ 0)
|
||||
c_params = Ct(c_void + c_param_list)
|
||||
c_proto = Ct(
|
||||
Cg(c_type, 'return_type') * Cg(c_id, 'name') *
|
||||
fill * P('(') * fill * Cg(c_params, 'parameters') * fill * P(')') *
|
||||
Cg(Cc(false), 'async') *
|
||||
(fill * Cg((P('FUNC_API_ASYNC') * Cc(true)), 'async') ^ -1) *
|
||||
(fill * Cg((P('FUNC_API_NOEXPORT') * Cc(true)), 'noexport') ^ -1) *
|
||||
fill * P(';')
|
||||
)
|
||||
grammar = Ct((c_proto + c_comment + c_preproc + ws) ^ 1)
|
||||
|
||||
-- we need at least 2 arguments since the last one is the output file
|
||||
assert(#arg >= 1)
|
||||
functions = {}
|
||||
|
||||
-- names of all headers relative to the source root (for inclusion in the
|
||||
-- generated file)
|
||||
headers = {}
|
||||
-- output file(dispatch function + metadata serialized with msgpack)
|
||||
outputf = arg[#arg]
|
||||
|
||||
-- read each input file, parse and append to the api metadata
|
||||
for i = 1, #arg - 1 do
|
||||
local full_path = arg[i]
|
||||
local parts = {}
|
||||
for part in string.gmatch(full_path, '[^/]+') do
|
||||
parts[#parts + 1] = part
|
||||
end
|
||||
headers[#headers + 1] = parts[#parts - 1]..'/'..parts[#parts]
|
||||
|
||||
local input = io.open(full_path, 'rb')
|
||||
local tmp = grammar:match(input:read('*all'))
|
||||
for i = 1, #tmp do
|
||||
local fn = tmp[i]
|
||||
if not fn.noexport then
|
||||
functions[#functions + 1] = tmp[i]
|
||||
if #fn.parameters ~= 0 and fn.parameters[1][2] == 'channel_id' then
|
||||
-- this function should receive the channel id
|
||||
fn.receives_channel_id = true
|
||||
-- remove the parameter since it won't be passed by the api client
|
||||
table.remove(fn.parameters, 1)
|
||||
end
|
||||
if #fn.parameters ~= 0 and fn.parameters[#fn.parameters][1] == 'error' then
|
||||
-- function can fail if the last parameter type is 'Error'
|
||||
fn.can_fail = true
|
||||
-- remove the error parameter, msgpack has it's own special field
|
||||
-- for specifying errors
|
||||
fn.parameters[#fn.parameters] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
input:close()
|
||||
end
|
||||
|
||||
|
||||
-- start building the output
|
||||
output = io.open(outputf, 'wb')
|
||||
|
||||
output:write([[
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
#include <msgpack.h>
|
||||
|
||||
#include "nvim/map.h"
|
||||
#include "nvim/log.h"
|
||||
#include "nvim/vim.h"
|
||||
#include "nvim/msgpack_rpc/helpers.h"
|
||||
#include "nvim/msgpack_rpc/defs.h"
|
||||
#include "nvim/api/private/helpers.h"
|
||||
#include "nvim/api/private/defs.h"
|
||||
]])
|
||||
|
||||
for i = 1, #headers do
|
||||
if headers[i]:sub(-12) ~= '.generated.h' then
|
||||
output:write('\n#include "nvim/'..headers[i]..'"')
|
||||
end
|
||||
end
|
||||
|
||||
output:write([[
|
||||
|
||||
|
||||
static const uint8_t msgpack_metadata[] = {
|
||||
|
||||
]])
|
||||
-- serialize the API metadata using msgpack and embed into the resulting
|
||||
-- binary for easy querying by clients
|
||||
packed = mpack.pack(functions)
|
||||
for i = 1, #packed do
|
||||
output:write(string.byte(packed, i)..', ')
|
||||
if i % 10 == 0 then
|
||||
output:write('\n ')
|
||||
end
|
||||
end
|
||||
output:write([[
|
||||
};
|
||||
|
||||
void msgpack_rpc_init_function_metadata(Dictionary *metadata)
|
||||
{
|
||||
msgpack_unpacked unpacked;
|
||||
msgpack_unpacked_init(&unpacked);
|
||||
if (msgpack_unpack_next(&unpacked,
|
||||
(const char *)msgpack_metadata,
|
||||
sizeof(msgpack_metadata),
|
||||
NULL) != MSGPACK_UNPACK_SUCCESS) {
|
||||
abort();
|
||||
}
|
||||
Object functions;
|
||||
msgpack_rpc_to_object(&unpacked.data, &functions);
|
||||
msgpack_unpacked_destroy(&unpacked);
|
||||
PUT(*metadata, "functions", functions);
|
||||
}
|
||||
|
||||
]])
|
||||
|
||||
local function real_type(type)
|
||||
local rv = type
|
||||
if typed_container:match(rv) then
|
||||
if rv:match('Array') then
|
||||
rv = 'Array'
|
||||
else
|
||||
rv = 'Dictionary'
|
||||
end
|
||||
end
|
||||
return rv
|
||||
end
|
||||
|
||||
-- start the handler functions. Visit each function metadata to build the
|
||||
-- handler function with code generated for validating arguments and calling to
|
||||
-- the real API.
|
||||
for i = 1, #functions do
|
||||
local fn = functions[i]
|
||||
local args = {}
|
||||
|
||||
output:write('static Object handle_'..fn.name..'(uint64_t channel_id, uint64_t request_id, Array args, Error *error)')
|
||||
output:write('\n{')
|
||||
output:write('\n Object ret = NIL;')
|
||||
-- Declare/initialize variables that will hold converted arguments
|
||||
for j = 1, #fn.parameters do
|
||||
local param = fn.parameters[j]
|
||||
local converted = 'arg_'..j
|
||||
output:write('\n '..param[1]..' '..converted..' api_init_'..string.lower(real_type(param[1]))..';')
|
||||
end
|
||||
output:write('\n')
|
||||
output:write('\n if (args.size != '..#fn.parameters..') {')
|
||||
output:write('\n snprintf(error->msg, sizeof(error->msg), "Wrong number of arguments: expecting '..#fn.parameters..' but got %zu", args.size);')
|
||||
output:write('\n error->set = true;')
|
||||
output:write('\n goto cleanup;')
|
||||
output:write('\n }\n')
|
||||
|
||||
-- Validation/conversion for each argument
|
||||
for j = 1, #fn.parameters do
|
||||
local converted, convert_arg, param, arg
|
||||
param = fn.parameters[j]
|
||||
converted = 'arg_'..j
|
||||
local rt = real_type(param[1])
|
||||
if rt ~= 'Object' then
|
||||
output:write('\n if (args.items['..(j - 1)..'].type == kObjectType'..rt..') {')
|
||||
output:write('\n '..converted..' = args.items['..(j - 1)..'].data.'..rt:lower()..';')
|
||||
if rt:match('^Buffer$') or rt:match('^Window$') or rt:match('^Tabpage$') or rt:match('^Boolean$') then
|
||||
-- accept positive integers for Buffers, Windows and Tabpages
|
||||
output:write('\n } else if (args.items['..(j - 1)..'].type == kObjectTypeInteger && args.items['..(j - 1)..'].data.integer > 0) {')
|
||||
output:write('\n '..converted..' = (unsigned)args.items['..(j - 1)..'].data.integer;')
|
||||
end
|
||||
output:write('\n } else {')
|
||||
output:write('\n snprintf(error->msg, sizeof(error->msg), "Wrong type for argument '..j..', expecting '..param[1]..'");')
|
||||
output:write('\n error->set = true;')
|
||||
output:write('\n goto cleanup;')
|
||||
output:write('\n }\n')
|
||||
else
|
||||
output:write('\n '..converted..' = args.items['..(j - 1)..'];\n')
|
||||
end
|
||||
|
||||
args[#args + 1] = converted
|
||||
end
|
||||
|
||||
-- function call
|
||||
local call_args = table.concat(args, ', ')
|
||||
output:write('\n ')
|
||||
if fn.return_type ~= 'void' then
|
||||
-- has a return value, prefix the call with a declaration
|
||||
output:write(fn.return_type..' rv = ')
|
||||
end
|
||||
|
||||
-- write the function name and the opening parenthesis
|
||||
output:write(fn.name..'(')
|
||||
|
||||
if fn.receives_channel_id then
|
||||
-- if the function receives the channel id, pass it as first argument
|
||||
if #args > 0 or fn.can_fail then
|
||||
output:write('channel_id, '..call_args)
|
||||
else
|
||||
output:write('channel_id')
|
||||
end
|
||||
else
|
||||
output:write(call_args)
|
||||
end
|
||||
|
||||
if fn.can_fail then
|
||||
-- if the function can fail, also pass a pointer to the local error object
|
||||
if #args > 0 then
|
||||
output:write(', error);\n')
|
||||
else
|
||||
output:write('error);\n')
|
||||
end
|
||||
-- and check for the error
|
||||
output:write('\n if (error->set) {')
|
||||
output:write('\n goto cleanup;')
|
||||
output:write('\n }\n')
|
||||
else
|
||||
output:write(');\n')
|
||||
end
|
||||
|
||||
if fn.return_type ~= 'void' then
|
||||
output:write('\n ret = '..string.upper(real_type(fn.return_type))..'_OBJ(rv);')
|
||||
end
|
||||
-- Now generate the cleanup label for freeing memory allocated for the
|
||||
-- arguments
|
||||
output:write('\n\ncleanup:');
|
||||
|
||||
for j = 1, #fn.parameters do
|
||||
local param = fn.parameters[j]
|
||||
output:write('\n api_free_'..string.lower(real_type(param[1]))..'(arg_'..j..');')
|
||||
end
|
||||
output:write('\n return ret;\n}\n\n');
|
||||
end
|
||||
|
||||
-- Generate a function that initializes method names with handler functions
|
||||
output:write([[
|
||||
static Map(String, MsgpackRpcRequestHandler) *methods = NULL;
|
||||
|
||||
void msgpack_rpc_add_method_handler(String method, MsgpackRpcRequestHandler handler)
|
||||
{
|
||||
map_put(String, MsgpackRpcRequestHandler)(methods, method, handler);
|
||||
}
|
||||
|
||||
void msgpack_rpc_init_method_table(void)
|
||||
{
|
||||
methods = map_new(String, MsgpackRpcRequestHandler)();
|
||||
|
||||
]])
|
||||
|
||||
-- Keep track of the maximum method name length in order to avoid walking
|
||||
-- strings longer than that when searching for a method handler
|
||||
local max_fname_len = 0
|
||||
for i = 1, #functions do
|
||||
local fn = functions[i]
|
||||
output:write(' msgpack_rpc_add_method_handler('..
|
||||
'(String) {.data = "'..fn.name..'", '..
|
||||
'.size = sizeof("'..fn.name..'") - 1}, '..
|
||||
'(MsgpackRpcRequestHandler) {.fn = handle_'.. fn.name..
|
||||
', .async = '..tostring(fn.async)..'});\n')
|
||||
|
||||
if #fn.name > max_fname_len then
|
||||
max_fname_len = #fn.name
|
||||
end
|
||||
end
|
||||
|
||||
output:write('\n}\n\n')
|
||||
|
||||
output:write([[
|
||||
MsgpackRpcRequestHandler msgpack_rpc_get_handler_for(const char *name,
|
||||
size_t name_len)
|
||||
{
|
||||
String m = {
|
||||
.data=(char *)name,
|
||||
.size=MIN(name_len, ]]..max_fname_len..[[)
|
||||
};
|
||||
MsgpackRpcRequestHandler rv =
|
||||
map_get(String, MsgpackRpcRequestHandler)(methods, m);
|
||||
|
||||
if (!rv.fn) {
|
||||
rv.fn = msgpack_rpc_handle_missing_method;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
]])
|
||||
|
||||
output:close()
|
@@ -1,10 +1,11 @@
|
||||
#!/bin/sh
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Performs steps to tag a release.
|
||||
#
|
||||
# Steps:
|
||||
# Create the "release" commit:
|
||||
# - CMakeLists.txt: Unset NVIM_VERSION_PRERELEASE
|
||||
# - CMakeLists.txt: Unset NVIM_API_PRERELEASE
|
||||
# - Tag the commit.
|
||||
# Create the "version bump" commit:
|
||||
# - CMakeLists.txt: Set NVIM_VERSION_PRERELEASE to "-dev"
|
||||
@@ -17,42 +18,48 @@ set -e
|
||||
set -u
|
||||
set -o pipefail
|
||||
|
||||
__sed=$( [ "$(uname)" = Darwin ] && echo 'sed -E' || echo 'sed -r' )
|
||||
|
||||
cd "$(git rev-parse --show-toplevel)"
|
||||
|
||||
__LAST_TAG=$(git describe --abbrev=0)
|
||||
[ -z "$__LAST_TAG" ] && { echo 'ERROR: no tag found'; exit 1; }
|
||||
__VERSION_MAJOR=$(grep 'set(NVIM_VERSION_MAJOR' CMakeLists.txt\
|
||||
|sed -r 's/.*NVIM_VERSION_MAJOR ([[:digit:]]).*/\1/')
|
||||
|$__sed 's/.*NVIM_VERSION_MAJOR ([[:digit:]]).*/\1/')
|
||||
__VERSION_MINOR=$(grep 'set(NVIM_VERSION_MINOR' CMakeLists.txt\
|
||||
|sed -r 's/.*NVIM_VERSION_MINOR ([[:digit:]]).*/\1/')
|
||||
|$__sed 's/.*NVIM_VERSION_MINOR ([[:digit:]]).*/\1/')
|
||||
__VERSION_PATCH=$(grep 'set(NVIM_VERSION_PATCH' CMakeLists.txt\
|
||||
|sed -r 's/.*NVIM_VERSION_PATCH ([[:digit:]]).*/\1/')
|
||||
|$__sed 's/.*NVIM_VERSION_PATCH ([[:digit:]]).*/\1/')
|
||||
__VERSION="${__VERSION_MAJOR}.${__VERSION_MINOR}.${__VERSION_PATCH}"
|
||||
{ [ -z "$__VERSION_MAJOR" ] || [ -z "$__VERSION_MINOR" ] || [ -z "$__VERSION_PATCH" ]; } \
|
||||
&& { echo "ERROR: version parse failed: '${__VERSION}'"; exit 1; }
|
||||
__RELEASE_MSG="NVIM v${__VERSION}
|
||||
|
||||
Features:
|
||||
FEATURES:
|
||||
|
||||
Fixes:
|
||||
FIXES:
|
||||
|
||||
Changes:
|
||||
CHANGES:
|
||||
|
||||
"
|
||||
__BUMP_MSG="version bump"
|
||||
|
||||
echo "Most recent tag: ${__LAST_TAG}"
|
||||
echo "Release version: ${__VERSION}"
|
||||
sed -i -r 's/(NVIM_VERSION_PRERELEASE) "-dev"/\1 ""/' CMakeLists.txt
|
||||
$__sed -i.bk 's/(NVIM_VERSION_PRERELEASE) "-dev"/\1 ""/' CMakeLists.txt
|
||||
$__sed -i.bk 's/(NVIM_API_PRERELEASE) true/\1 false/' CMakeLists.txt
|
||||
echo "Building changelog since ${__LAST_TAG}..."
|
||||
__CHANGELOG="$(./scripts/git-log-pretty-since.sh "$__LAST_TAG" 'vim-patch:\S')"
|
||||
|
||||
git add CMakeLists.txt
|
||||
git commit --edit -m "${__RELEASE_MSG} ${__CHANGELOG}"
|
||||
git tag -a v"${__VERSION}" -m "NVIM v${__VERSION}"
|
||||
git tag --sign -a v"${__VERSION}" -m "NVIM v${__VERSION}"
|
||||
|
||||
$__sed -i.bk 's/(NVIM_VERSION_PRERELEASE) ""/\1 "-dev"/' CMakeLists.txt
|
||||
$__sed -i.bk 's/set\((NVIM_VERSION_PATCH) [[:digit:]]/set(\1 ?/' CMakeLists.txt
|
||||
nvim +'/NVIM_VERSION' +10new +'exe "norm! iUpdate version numbers!!!\<CR>"' \
|
||||
+'norm! 10.' CMakeLists.txt
|
||||
|
||||
sed -i -r 's/(NVIM_VERSION_PRERELEASE) ""/\1 "-dev"/' CMakeLists.txt
|
||||
nvim -c '/NVIM_VERSION' -c 'echo "Update version numbers"' CMakeLists.txt
|
||||
git add CMakeLists.txt
|
||||
git commit -m "$__BUMP_MSG"
|
||||
|
||||
|
@@ -2,12 +2,11 @@
|
||||
|
||||
set -e
|
||||
set -u
|
||||
set -o pipefail
|
||||
# Use privileged mode, which e.g. skips using CDPATH.
|
||||
set -p
|
||||
|
||||
readonly NEOVIM_SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
readonly VIM_SOURCE_DIR_DEFAULT="${NEOVIM_SOURCE_DIR}/.vim-src"
|
||||
readonly NVIM_SOURCE_DIR="${NVIM_SOURCE_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}"
|
||||
readonly VIM_SOURCE_DIR_DEFAULT="${NVIM_SOURCE_DIR}/.vim-src"
|
||||
readonly VIM_SOURCE_DIR="${VIM_SOURCE_DIR:-${VIM_SOURCE_DIR_DEFAULT}}"
|
||||
readonly BASENAME="$(basename "${0}")"
|
||||
readonly BRANCH_PREFIX="vim-"
|
||||
@@ -124,6 +123,36 @@ assign_commit_details() {
|
||||
patch_file="vim-${vim_version}.patch"
|
||||
}
|
||||
|
||||
# Patch surgery
|
||||
preprocess_patch() {
|
||||
local file="$1"
|
||||
local nvim="nvim -u NORC -i NONE --headless"
|
||||
|
||||
# Remove *.proto, Make*, gui_*, some if_*
|
||||
local na_src='proto\|Make*\|gui_*\|if_lua\|if_mzsch\|if_olepp\|if_ole\|if_perl\|if_py\|if_ruby\|if_tcl\|if_xcmdsrv'
|
||||
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/\S*\<\%('${na_src}'\)@norm! d/\v(^diff)|%$
|
||||
' +w +q "$file"
|
||||
|
||||
# Remove channel.txt, netbeans.txt, os_*.txt, todo.txt, version*.txt, tags
|
||||
local na_doc='channel\.txt\|netbeans\.txt\|os_\w\+\.txt\|todo\.txt\|version\d\.txt\|tags'
|
||||
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/runtime/doc/\%('${na_doc}'\)@norm! d/\v(^diff)|%$
|
||||
' +w +q "$file"
|
||||
|
||||
# Remove some testdir/Make_*.mak files
|
||||
local na_src_testdir='Make_amiga.mak\|Make_dos.mak\|Make_ming.mak\|Make_vms.mms'
|
||||
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/testdir/\%('${na_src_testdir}'\)@norm! d/\v(^diff)|%$
|
||||
' +w +q "$file"
|
||||
|
||||
# Remove some *.po files. #5622
|
||||
local na_po='sjiscorr.c\|ja.sjis.po\|ko.po\|pl.cp1250.po\|pl.po\|ru.cp1251.po\|uk.cp1251.po\|zh_CN.cp936.po\|zh_CN.po\|zh_TW.po'
|
||||
2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/po/\%('${na_po}'\)@norm! d/\v(^diff)|%$
|
||||
' +w +q "$file"
|
||||
|
||||
# Rename src/ paths to src/nvim/
|
||||
LC_ALL=C sed -e 's/\( [ab]\/src\)/\1\/nvim/g' \
|
||||
"$file" > "$file".tmp && mv "$file".tmp "$file"
|
||||
|
||||
# Rename path to matchit plugin.
|
||||
LC_ALL=C sed -e 's@\( [ab]/runtime\)/pack/dist/opt/matchit/\(plugin/matchit.vim\)@\1/\2@g' \
|
||||
"$file" > "$file".tmp && mv "$file".tmp "$file"
|
||||
}
|
||||
@@ -133,17 +162,13 @@ get_vim_patch() {
|
||||
|
||||
assign_commit_details "${1}"
|
||||
|
||||
echo
|
||||
git log -1 "${vim_commit}" -- >/dev/null 2>&1 || {
|
||||
>&2 echo "✘ Couldn't find Vim revision '${vim_commit}'."
|
||||
# Patch surgery: preprocess the patch.
|
||||
# - transform src/ paths to src/nvim/
|
||||
local vim_full
|
||||
vim_full="$(git --no-pager show --color=never -1 --pretty=medium "${vim_commit}" \
|
||||
| LC_ALL=C sed -e 's/\( [ab]\/src\)/\1\/nvim/g')"
|
||||
local neovim_branch="${BRANCH_PREFIX}${vim_version}"
|
||||
exit 3
|
||||
}
|
||||
echo "✔ Found Vim revision '${vim_commit}'."
|
||||
|
||||
cd "${NEOVIM_SOURCE_DIR}"
|
||||
local patch_content
|
||||
patch_content="$(git --no-pager show --color=never -1 --pretty=medium "${vim_commit}")"
|
||||
local nvim_branch="${BRANCH_PREFIX}${vim_version}"
|
||||
|
||||
@@ -153,51 +178,48 @@ get_vim_patch() {
|
||||
local checked_out_branch
|
||||
checked_out_branch="$(git rev-parse --abbrev-ref HEAD)"
|
||||
|
||||
echo
|
||||
echo "Fetching '${git_remote}/master'."
|
||||
if [[ "${checked_out_branch}" == ${BRANCH_PREFIX}* ]]; then
|
||||
echo "✔ Current branch '${checked_out_branch}' seems to be a vim-patch"
|
||||
echo " branch; not creating a new branch."
|
||||
else
|
||||
printf "\nFetching '${git_remote}/master'.\n"
|
||||
output="$(git fetch "${git_remote}" master 2>&1)" &&
|
||||
echo "Creating new branch '${neovim_branch}' based on '${git_remote}/master'."
|
||||
cd "${NEOVIM_SOURCE_DIR}"
|
||||
output="$(git checkout -b "${neovim_branch}" "${git_remote}/master" 2>&1)" &&
|
||||
echo "✔ ${output}" ||
|
||||
(echo "✘ ${output}"; false)
|
||||
|
||||
echo
|
||||
echo "Creating new branch '${nvim_branch}' based on '${git_remote}/master'."
|
||||
cd "${NVIM_SOURCE_DIR}"
|
||||
output="$(git checkout -b "${nvim_branch}" "${git_remote}/master" 2>&1)" &&
|
||||
echo
|
||||
echo "Creating empty commit with correct commit message."
|
||||
echo "✔ ${output}" ||
|
||||
(echo "✘ ${output}"; false)
|
||||
fi
|
||||
|
||||
printf "\nCreating empty commit with correct commit message.\n"
|
||||
echo
|
||||
echo "Creating files."
|
||||
echo "${vim_full}" > "${NEOVIM_SOURCE_DIR}/${patch_file}"
|
||||
echo "✔ Saved full commit details to '${NEOVIM_SOURCE_DIR}/${patch_file}'."
|
||||
output="$(commit_message | git commit --allow-empty --file 2>&1 -)" &&
|
||||
echo "✔ ${output}" ||
|
||||
(echo "✘ ${output}"; false)
|
||||
echo
|
||||
echo "Instructions:"
|
||||
echo
|
||||
echo " Proceed to port the patch."
|
||||
echo " You might want to try 'patch -p1 < ${patch_file}' first."
|
||||
echo
|
||||
echo " If the patch contains a new test, consider porting it to Lua."
|
||||
echo " You might want to try 'scripts/legacy2luatest.pl'."
|
||||
echo
|
||||
echo " Stage your changes ('git add ...') and use 'git commit --amend' to commit."
|
||||
echo
|
||||
echo " To port additional patches related to ${vim_version} and add them to the current"
|
||||
echo " branch, call '${BASENAME} -p' again. Please use this only if it wouldn't make"
|
||||
echo " sense to send in each patch individually, as it will increase the size of the"
|
||||
echo " pull request and make it harder to review."
|
||||
echo
|
||||
echo " When you are finished, use '${BASENAME} -s' to submit a pull request."
|
||||
echo
|
||||
echo " See https://github.com/neovim/neovim/wiki/Merging-patches-from-upstream-vim"
|
||||
echo " for more information."
|
||||
|
||||
printf "Creating patch...\n"
|
||||
echo "$patch_content" > "${NVIM_SOURCE_DIR}/${patch_file}"
|
||||
|
||||
printf "Pre-processing patch...\n"
|
||||
preprocess_patch "${NVIM_SOURCE_DIR}/${patch_file}"
|
||||
|
||||
printf "✔ Saved patch to '${NVIM_SOURCE_DIR}/${patch_file}'.\n"
|
||||
|
||||
printf "\nInstructions:
|
||||
Proceed to port the patch. This may help:
|
||||
patch -p1 < ${patch_file}
|
||||
|
||||
Stage your changes ('git add ...') and use 'git commit --amend' to commit.
|
||||
|
||||
To port additional patches related to ${vim_version} and add them to the
|
||||
current branch, call '${BASENAME} -p' again.
|
||||
* Do this only for _related_ patches (otherwise it increases the
|
||||
size of the pull request, making it harder to review)
|
||||
|
||||
When you're done, try '${BASENAME} -s' to create the pull request.
|
||||
|
||||
See the wiki for more information:
|
||||
* https://github.com/neovim/neovim/wiki/Merging-patches-from-upstream-vim
|
||||
@@ -223,7 +245,7 @@ submit_pr() {
|
||||
push_first=0
|
||||
submit_fn="git_hub_pr"
|
||||
else
|
||||
cd "${NEOVIM_SOURCE_DIR}"
|
||||
>&2 echo "${BASENAME}: 'hub' or 'git-hub' not found in PATH or not executable."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -263,11 +285,11 @@ submit_pr() {
|
||||
(echo "✘ ${output}"; false)
|
||||
|
||||
echo
|
||||
if [[ ! -f "${NEOVIM_SOURCE_DIR}/${patch_file}" ]]; then
|
||||
echo "Cleaning up files."
|
||||
local patch_file
|
||||
for patch_file in "${patches[@]}"; do
|
||||
rm -- "${NEOVIM_SOURCE_DIR}/${patch_file}"
|
||||
echo "✔ Removed '${NEOVIM_SOURCE_DIR}/${patch_file}'."
|
||||
patch_file="vim-${patch_file}.patch"
|
||||
if [[ ! -f "${NVIM_SOURCE_DIR}/${patch_file}" ]]; then
|
||||
continue
|
||||
fi
|
||||
rm -- "${NVIM_SOURCE_DIR}/${patch_file}"
|
||||
@@ -289,7 +311,7 @@ list_vim_patches() {
|
||||
local is_missing
|
||||
local vim_tag
|
||||
# This fails for untagged commits (e.g., runtime file updates) so mask the return status
|
||||
is_missing="$(sed -n '/static int included_patches/,/}/p' "${NEOVIM_SOURCE_DIR}/src/nvim/version.c" |
|
||||
vim_tag="$(cd "${VIM_SOURCE_DIR}" && git describe --tags --exact-match "${vim_commit}" 2>/dev/null)" || true
|
||||
if [[ -n "${vim_tag}" ]]; then
|
||||
local patch_number="${vim_tag:5}" # Remove prefix like "v7.4."
|
||||
# Tagged Vim patch, check version.c:
|
||||
@@ -297,7 +319,7 @@ list_vim_patches() {
|
||||
grep -x -e "[[:space:]]*//[[:space:]]${patch_number} NA.*" -e "[[:space:]]*${patch_number}," >/dev/null && echo "false" || echo "true")"
|
||||
vim_commit="${vim_tag#v}"
|
||||
if (cd "${VIM_SOURCE_DIR}" && git --no-pager show --color=never --name-only "v${vim_commit}" 2>/dev/null) | grep -q ^runtime; then
|
||||
is_missing="$(cd "${NEOVIM_SOURCE_DIR}" &&
|
||||
vim_commit="${vim_commit} (+runtime)"
|
||||
fi
|
||||
else
|
||||
# Untagged Vim patch (e.g. runtime updates), check the Neovim git log:
|
||||
@@ -321,14 +343,14 @@ list_vim_patches() {
|
||||
echo " '${BASENAME} -p 1e8ebf870720e7b671f98f22d653009826304c4f'"
|
||||
echo
|
||||
echo " NOTE: Please port the _oldest_ patch if you possibly can."
|
||||
local neovim_commit_url="${1}"
|
||||
local neovim_patch_url="${neovim_commit_url}.patch"
|
||||
echo " Out-of-order patches increase the possibility of bugs."
|
||||
}
|
||||
|
||||
review_commit() {
|
||||
local neovim_patch
|
||||
neovim_patch="$(curl -Ssf "${neovim_patch_url}")"
|
||||
local nvim_commit_url="${1}"
|
||||
local nvim_patch_url="${nvim_commit_url}.patch"
|
||||
|
||||
vim_version="$(head -n 4 <<< "${neovim_patch}" | sed -n "s/${git_patch_prefix}vim-patch:\([a-z0-9.]*\)$/\1/p")"
|
||||
local git_patch_prefix='Subject: \[PATCH\] '
|
||||
local nvim_patch
|
||||
nvim_patch="$(curl -Ssf "${nvim_patch_url}")"
|
||||
local vim_version
|
||||
@@ -349,7 +371,7 @@ review_commit() {
|
||||
local vim_patch_url="${vim_commit_url}.patch"
|
||||
|
||||
local expected_commit_message
|
||||
commit_message="$(tail -n +4 <<< "${neovim_patch}" | head -n "${message_length}")"
|
||||
expected_commit_message="$(commit_message)"
|
||||
local message_length
|
||||
message_length="$(wc -l <<< "${expected_commit_message}")"
|
||||
local commit_message
|
||||
@@ -362,18 +384,18 @@ review_commit() {
|
||||
echo "${expected_commit_message}"
|
||||
echo " Actual:"
|
||||
echo "${commit_message#${git_patch_prefix}}"
|
||||
echo "${neovim_patch}" > "${NEOVIM_SOURCE_DIR}/n${patch_file}"
|
||||
echo "✔ Saved pull request diff to '${NEOVIM_SOURCE_DIR}/n${patch_file}'."
|
||||
CREATED_FILES+=("${NEOVIM_SOURCE_DIR}/n${patch_file}")
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Creating files."
|
||||
curl -Ssfo "${NEOVIM_SOURCE_DIR}/${patch_file}" "${vim_patch_url}"
|
||||
echo "✔ Saved Vim diff to '${NEOVIM_SOURCE_DIR}/${patch_file}'."
|
||||
CREATED_FILES+=("${NEOVIM_SOURCE_DIR}/${patch_file}")
|
||||
echo "${nvim_patch}" > "${NVIM_SOURCE_DIR}/n${patch_file}"
|
||||
echo "✔ Saved pull request diff to '${NVIM_SOURCE_DIR}/n${patch_file}'."
|
||||
CREATED_FILES+=("${NVIM_SOURCE_DIR}/n${patch_file}")
|
||||
|
||||
curl -Ssfo "${NVIM_SOURCE_DIR}/${patch_file}" "${vim_patch_url}"
|
||||
echo "✔ Saved Vim diff to '${NVIM_SOURCE_DIR}/${patch_file}'."
|
||||
nvim -c "cd ${NEOVIM_SOURCE_DIR}" \
|
||||
-O "${NEOVIM_SOURCE_DIR}/${patch_file}" "${NEOVIM_SOURCE_DIR}/n${patch_file}"
|
||||
CREATED_FILES+=("${NVIM_SOURCE_DIR}/${patch_file}")
|
||||
|
||||
echo
|
||||
echo "Launching nvim."
|
||||
nvim -c "cd ${NVIM_SOURCE_DIR}" \
|
||||
|
@@ -1,3 +1,3 @@
|
||||
# libuv queue.h pointer arithmetic is not accepted by asan
|
||||
fun:queue_node_data
|
||||
# multiqueue.h pointer arithmetic is not accepted by asan
|
||||
fun:multiqueue_node_data
|
||||
fun:dictwatcher_node_data
|
||||
|
@@ -11,31 +11,37 @@ endif()
|
||||
endif()
|
||||
|
||||
set(GENERATED_DIR ${PROJECT_BINARY_DIR}/src/nvim/auto)
|
||||
set(DISPATCH_GENERATOR ${PROJECT_SOURCE_DIR}/scripts/msgpack-gen.lua)
|
||||
set(DISPATCH_GENERATOR ${PROJECT_SOURCE_DIR}/scripts/gendispatch.lua)
|
||||
file(GLOB API_HEADERS api/*.h)
|
||||
file(GLOB MSGPACK_RPC_HEADERS msgpack_rpc/*.h)
|
||||
set(MSGPACK_DISPATCH ${GENERATED_DIR}/msgpack_dispatch.c)
|
||||
set(API_METADATA ${PROJECT_BINARY_DIR}/api_metadata.mpack)
|
||||
set(FUNCS_DATA ${PROJECT_BINARY_DIR}/funcs_data.mpack)
|
||||
set(HEADER_GENERATOR ${PROJECT_SOURCE_DIR}/scripts/gendeclarations.lua)
|
||||
set(GENERATED_INCLUDES_DIR ${PROJECT_BINARY_DIR}/include)
|
||||
set(GENERATED_API_DISPATCH ${GENERATED_DIR}/api/private/dispatch_wrappers.generated.h)
|
||||
set(GENERATED_FUNCS_METADATA ${GENERATED_DIR}/api/private/funcs_metadata.generated.h)
|
||||
set(GENERATED_EX_CMDS_ENUM ${GENERATED_INCLUDES_DIR}/ex_cmds_enum.generated.h)
|
||||
set(GENERATED_EX_CMDS_DEFS ${GENERATED_DIR}/ex_cmds_defs.generated.h)
|
||||
set(GENERATED_FUNCS_HASH_INPUT ${GENERATED_DIR}/funcs.generated.h.gperf)
|
||||
set(GENERATED_FUNCS ${GENERATED_DIR}/funcs.generated.h)
|
||||
set(GENERATED_EVENTS_ENUM ${GENERATED_INCLUDES_DIR}/auevents_enum.generated.h)
|
||||
set(GENERATED_EVENTS_NAMES_MAP ${GENERATED_DIR}/auevents_name_map.generated.h)
|
||||
set(GENERATED_OPTIONS ${GENERATED_DIR}/options.generated.h)
|
||||
set(EX_CMDS_GENERATOR ${PROJECT_SOURCE_DIR}/scripts/genex_cmds.lua)
|
||||
set(FUNCS_GENERATOR ${PROJECT_SOURCE_DIR}/scripts/geneval.lua)
|
||||
set(EVENTS_GENERATOR ${PROJECT_SOURCE_DIR}/scripts/gen_events.lua)
|
||||
set(OPTIONS_GENERATOR ${PROJECT_SOURCE_DIR}/scripts/genoptions.lua)
|
||||
set(EVENTS_LIST_FILE ${PROJECT_SOURCE_DIR}/src/nvim/auevents.lua)
|
||||
set(EX_CMDS_DEFS_FILE ${PROJECT_SOURCE_DIR}/src/nvim/ex_cmds.lua)
|
||||
set(EVAL_DEFS_FILE ${PROJECT_SOURCE_DIR}/src/nvim/eval.lua)
|
||||
set(OPTIONS_LIST_FILE ${PROJECT_SOURCE_DIR}/src/nvim/options.lua)
|
||||
set(UNICODE_TABLES_GENERATOR ${PROJECT_SOURCE_DIR}/scripts/genunicodetables.lua)
|
||||
set(UNICODE_DIR ${PROJECT_SOURCE_DIR}/unicode)
|
||||
set(UNICODEDATA_FILE ${UNICODE_DIR}/UnicodeData.txt)
|
||||
set(CASEFOLDING_FILE ${UNICODE_DIR}/CaseFolding.txt)
|
||||
set(EASTASIANWIDTH_FILE ${UNICODE_DIR}/EastAsianWidth.txt)
|
||||
file(GLOB UNICODE_FILES ${UNICODE_DIR}/*.txt)
|
||||
set(GENERATED_UNICODE_TABLES ${GENERATED_DIR}/unicode_tables.generated.h)
|
||||
|
||||
include_directories(${GENERATED_DIR})
|
||||
include_directories(${CACHED_GENERATED_DIR})
|
||||
include_directories(${GENERATED_INCLUDES_DIR})
|
||||
|
||||
file(MAKE_DIRECTORY ${GENERATED_DIR})
|
||||
@@ -82,7 +88,7 @@ endforeach()
|
||||
|
||||
list(REMOVE_ITEM NEOVIM_SOURCES ${to_remove})
|
||||
|
||||
# Handle legacy files that don't yet pass -Wconversion.
|
||||
# Legacy files that do not yet pass -Wconversion.
|
||||
set(CONV_SOURCES
|
||||
buffer.c
|
||||
diff.c
|
||||
@@ -112,6 +118,15 @@ endforeach()
|
||||
if(NOT MSVC)
|
||||
set_source_files_properties(
|
||||
${CONV_SOURCES} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-conversion")
|
||||
# gperf generates ANSI-C with incorrect linkage, ignore it.
|
||||
check_c_compiler_flag(-Wno-static-in-inline HAS_WNO_STATIC_IN_INLINE_FLAG)
|
||||
if(HAS_WNO_STATIC_IN_INLINE_FLAG)
|
||||
set_source_files_properties(
|
||||
eval.c PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-static-in-inline -Wno-conversion")
|
||||
else()
|
||||
set_source_files_properties(
|
||||
eval.c PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-conversion")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(DEFINED MIN_LOG_LEVEL)
|
||||
@@ -138,9 +153,13 @@ separate_arguments(C_FLAGS_${build_type}_ARRAY UNIX_COMMAND ${CMAKE_C_FLAGS_${bu
|
||||
set(gen_cflags ${gen_cflags} ${C_FLAGS_${build_type}_ARRAY} ${C_FLAGS_ARRAY})
|
||||
|
||||
foreach(sfile ${NEOVIM_SOURCES}
|
||||
"${PROJECT_SOURCE_DIR}/src/nvim/regexp_nfa.c")
|
||||
"${PROJECT_SOURCE_DIR}/src/nvim/regexp_nfa.c"
|
||||
${GENERATED_API_DISPATCH})
|
||||
get_filename_component(full_d ${sfile} PATH)
|
||||
file(RELATIVE_PATH d "${PROJECT_SOURCE_DIR}/src/nvim" "${full_d}")
|
||||
if(${d} MATCHES "^([.][.]|auto/)")
|
||||
file(RELATIVE_PATH d "${GENERATED_DIR}" "${full_d}")
|
||||
endif()
|
||||
get_filename_component(f ${sfile} NAME)
|
||||
get_filename_component(r ${sfile} NAME_WE)
|
||||
if(NOT ${d} EQUAL ".")
|
||||
@@ -172,28 +191,28 @@ endforeach()
|
||||
|
||||
add_custom_command(OUTPUT ${GENERATED_UNICODE_TABLES}
|
||||
COMMAND ${LUA_PRG} ${UNICODE_TABLES_GENERATOR}
|
||||
${UNICODEDATA_FILE}
|
||||
${CASEFOLDING_FILE}
|
||||
${EASTASIANWIDTH_FILE}
|
||||
${UNICODE_DIR}
|
||||
${GENERATED_UNICODE_TABLES}
|
||||
DEPENDS
|
||||
${UNICODE_TABLES_GENERATOR}
|
||||
${UNICODEDATA_FILE}
|
||||
${CASEFOLDING_FILE}
|
||||
${EASTASIANWIDTH_FILE}
|
||||
${UNICODE_FILES}
|
||||
)
|
||||
|
||||
add_custom_command(OUTPUT ${MSGPACK_DISPATCH}
|
||||
COMMAND ${LUA_PRG} ${DISPATCH_GENERATOR} ${API_HEADERS} ${MSGPACK_DISPATCH}
|
||||
add_custom_command(OUTPUT ${GENERATED_API_DISPATCH} ${GENERATED_FUNCS_METADATA}
|
||||
${API_METADATA}
|
||||
COMMAND ${LUA_PRG} ${DISPATCH_GENERATOR} ${CMAKE_CURRENT_LIST_DIR}
|
||||
${API_HEADERS} ${GENERATED_API_DISPATCH}
|
||||
${GENERATED_FUNCS_METADATA} ${API_METADATA}
|
||||
DEPENDS
|
||||
${API_HEADERS}
|
||||
${MSGPACK_RPC_HEADERS}
|
||||
${DISPATCH_GENERATOR}
|
||||
${CMAKE_CURRENT_LIST_DIR}/api/dispatch_deprecated.lua
|
||||
)
|
||||
|
||||
list(APPEND NEOVIM_GENERATED_SOURCES
|
||||
"${PROJECT_BINARY_DIR}/config/auto/pathdef.c"
|
||||
"${MSGPACK_DISPATCH}"
|
||||
"${GENERATED_API_DISPATCH}"
|
||||
"${GENERATED_EX_CMDS_ENUM}"
|
||||
"${GENERATED_EX_CMDS_DEFS}"
|
||||
"${GENERATED_EVENTS_ENUM}"
|
||||
@@ -208,6 +227,19 @@ add_custom_command(OUTPUT ${GENERATED_EX_CMDS_ENUM} ${GENERATED_EX_CMDS_DEFS}
|
||||
DEPENDS ${EX_CMDS_GENERATOR} ${EX_CMDS_DEFS_FILE}
|
||||
)
|
||||
|
||||
if(NOT GPERF_PRG)
|
||||
message(FATAL_ERROR "gperf was not found.")
|
||||
endif()
|
||||
add_custom_command(OUTPUT ${GENERATED_FUNCS} ${FUNCS_DATA}
|
||||
COMMAND ${LUA_PRG} ${FUNCS_GENERATOR}
|
||||
${PROJECT_SOURCE_DIR}/src/nvim ${GENERATED_DIR} ${API_METADATA} ${FUNCS_DATA}
|
||||
COMMAND ${GPERF_PRG}
|
||||
${GENERATED_FUNCS_HASH_INPUT} --output-file=${GENERATED_FUNCS}
|
||||
DEPENDS ${FUNCS_GENERATOR} ${EVAL_DEFS_FILE} ${API_METADATA}
|
||||
)
|
||||
list(APPEND NEOVIM_GENERATED_SOURCES
|
||||
"${GENERATED_FUNCS}")
|
||||
|
||||
add_custom_command(OUTPUT ${GENERATED_EVENTS_ENUM} ${GENERATED_EVENTS_NAMES_MAP}
|
||||
COMMAND ${LUA_PRG} ${EVENTS_GENERATOR}
|
||||
${PROJECT_SOURCE_DIR}/src/nvim ${GENERATED_EVENTS_ENUM} ${GENERATED_EVENTS_NAMES_MAP}
|
||||
@@ -294,6 +326,7 @@ elseif(CLANG_TSAN)
|
||||
message(STATUS "Enabling Clang thread sanitizer for nvim.")
|
||||
set_property(TARGET nvim APPEND_STRING PROPERTY COMPILE_FLAGS "-DEXITFREE ")
|
||||
set_property(TARGET nvim APPEND_STRING PROPERTY COMPILE_FLAGS "-fsanitize=thread ")
|
||||
set_property(TARGET nvim APPEND_STRING PROPERTY COMPILE_FLAGS "-fPIE ")
|
||||
set_property(TARGET nvim APPEND_STRING PROPERTY LINK_FLAGS "-fsanitize=thread ")
|
||||
endif()
|
||||
|
||||
|
@@ -14,7 +14,6 @@
|
||||
#include "nvim/memline.h"
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/misc1.h"
|
||||
#include "nvim/misc2.h"
|
||||
#include "nvim/ex_cmds.h"
|
||||
#include "nvim/mark.h"
|
||||
#include "nvim/fileio.h"
|
||||
@@ -29,10 +28,10 @@
|
||||
|
||||
/// Gets the buffer line count
|
||||
///
|
||||
/// @param buffer The buffer handle
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The line count
|
||||
Integer buffer_line_count(Buffer buffer, Error *err)
|
||||
/// @param buffer Buffer handle
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Line count
|
||||
Integer nvim_buf_line_count(Buffer buffer, Error *err)
|
||||
{
|
||||
buf_T *buf = find_buffer_by_handle(buffer, err);
|
||||
|
||||
@@ -45,22 +44,22 @@ Integer buffer_line_count(Buffer buffer, Error *err)
|
||||
|
||||
/// Gets a buffer line
|
||||
///
|
||||
/// @deprecated use buffer_get_lines instead.
|
||||
/// @deprecated use nvim_buf_get_lines instead.
|
||||
/// for positive indices (including 0) use
|
||||
/// "buffer_get_lines(buffer, index, index+1, true)"
|
||||
/// "nvim_buf_get_lines(buffer, index, index+1, true)"
|
||||
/// for negative indices use
|
||||
/// "buffer_get_lines(buffer, index-1, index, true)"
|
||||
/// "nvim_buf_get_lines(buffer, index-1, index, true)"
|
||||
///
|
||||
/// @param buffer The buffer handle
|
||||
/// @param index The line index
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The line string
|
||||
/// @param buffer Buffer handle
|
||||
/// @param index Line index
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Line string
|
||||
String buffer_get_line(Buffer buffer, Integer index, Error *err)
|
||||
{
|
||||
String rv = { .size = 0 };
|
||||
|
||||
index = convert_index(index);
|
||||
Array slice = buffer_get_lines(buffer, index, index+1, true, err);
|
||||
Array slice = nvim_buf_get_lines(0, buffer, index, index+1, true, err);
|
||||
|
||||
if (!err->set && slice.size) {
|
||||
rv = slice.items[0].data.string;
|
||||
@@ -73,64 +72,64 @@ String buffer_get_line(Buffer buffer, Integer index, Error *err)
|
||||
|
||||
/// Sets a buffer line
|
||||
///
|
||||
/// @deprecated use buffer_set_lines instead.
|
||||
/// @deprecated use nvim_buf_set_lines instead.
|
||||
/// for positive indices use
|
||||
/// "buffer_set_lines(buffer, index, index+1, true, [line])"
|
||||
/// "nvim_buf_set_lines(buffer, index, index+1, true, [line])"
|
||||
/// for negative indices use
|
||||
/// "buffer_set_lines(buffer, index-1, index, true, [line])"
|
||||
/// "nvim_buf_set_lines(buffer, index-1, index, true, [line])"
|
||||
///
|
||||
/// @param buffer The buffer handle
|
||||
/// @param index The line index
|
||||
/// @param line The new line.
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @param buffer Buffer handle
|
||||
/// @param index Line index
|
||||
/// @param line Contents of the new line
|
||||
/// @param[out] err Error details, if any
|
||||
void buffer_set_line(Buffer buffer, Integer index, String line, Error *err)
|
||||
{
|
||||
Object l = STRING_OBJ(line);
|
||||
Array array = { .items = &l, .size = 1 };
|
||||
index = convert_index(index);
|
||||
buffer_set_lines(buffer, index, index+1, true, array, err);
|
||||
nvim_buf_set_lines(0, buffer, index, index+1, true, array, err);
|
||||
}
|
||||
|
||||
/// Deletes a buffer line
|
||||
///
|
||||
/// @deprecated use buffer_set_lines instead.
|
||||
/// @deprecated use nvim_buf_set_lines instead.
|
||||
/// for positive indices use
|
||||
/// "buffer_set_lines(buffer, index, index+1, true, [])"
|
||||
/// "nvim_buf_set_lines(buffer, index, index+1, true, [])"
|
||||
/// for negative indices use
|
||||
/// "buffer_set_lines(buffer, index-1, index, true, [])"
|
||||
/// @param buffer The buffer handle
|
||||
/// @param index The line index
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// "nvim_buf_set_lines(buffer, index-1, index, true, [])"
|
||||
/// @param buffer buffer handle
|
||||
/// @param index line index
|
||||
/// @param[out] err Error details, if any
|
||||
void buffer_del_line(Buffer buffer, Integer index, Error *err)
|
||||
{
|
||||
Array array = ARRAY_DICT_INIT;
|
||||
index = convert_index(index);
|
||||
buffer_set_lines(buffer, index, index+1, true, array, err);
|
||||
nvim_buf_set_lines(0, buffer, index, index+1, true, array, err);
|
||||
}
|
||||
|
||||
/// Retrieves a line range from the buffer
|
||||
///
|
||||
/// @deprecated use buffer_get_lines(buffer, newstart, newend, false)
|
||||
/// @deprecated use nvim_buf_get_lines(buffer, newstart, newend, false)
|
||||
/// where newstart = start + int(not include_start) - int(start < 0)
|
||||
/// newend = end + int(include_end) - int(end < 0)
|
||||
/// int(bool) = 1 if bool is true else 0
|
||||
/// @param buffer The buffer handle
|
||||
/// @param start The first line index
|
||||
/// @param end The last line index
|
||||
/// @param include_start True if the slice includes the `start` parameter
|
||||
/// @param include_end True if the slice includes the `end` parameter
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return An array of lines
|
||||
/// @param buffer Buffer handle
|
||||
/// @param start First line index
|
||||
/// @param end Last line index
|
||||
/// @param include_start True if the slice includes the `start` parameter
|
||||
/// @param include_end True if the slice includes the `end` parameter
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Array of lines
|
||||
ArrayOf(String) buffer_get_line_slice(Buffer buffer,
|
||||
Integer start,
|
||||
Integer end,
|
||||
Boolean include_start,
|
||||
Boolean include_end,
|
||||
Error *err)
|
||||
Integer start,
|
||||
Integer end,
|
||||
Boolean include_start,
|
||||
Boolean include_end,
|
||||
Error *err)
|
||||
{
|
||||
start = convert_index(start) + !include_start;
|
||||
end = convert_index(end) + include_end;
|
||||
return buffer_get_lines(buffer, start , end, false, err);
|
||||
return nvim_buf_get_lines(0, buffer, start , end, false, err);
|
||||
}
|
||||
|
||||
|
||||
@@ -143,17 +142,18 @@ ArrayOf(String) buffer_get_line_slice(Buffer buffer,
|
||||
/// Out-of-bounds indices are clamped to the nearest valid value, unless
|
||||
/// `strict_indexing` is set.
|
||||
///
|
||||
/// @param buffer The buffer handle
|
||||
/// @param start The first line index
|
||||
/// @param end The last line index (exclusive)
|
||||
/// @param strict_indexing whether out-of-bounds should be an error.
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return An array of lines
|
||||
ArrayOf(String) buffer_get_lines(Buffer buffer,
|
||||
Integer start,
|
||||
Integer end,
|
||||
Boolean strict_indexing,
|
||||
Error *err)
|
||||
/// @param buffer Buffer handle
|
||||
/// @param start First line index
|
||||
/// @param end Last line index (exclusive)
|
||||
/// @param strict_indexing Whether out-of-bounds should be an error.
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Array of lines
|
||||
ArrayOf(String) nvim_buf_get_lines(uint64_t channel_id,
|
||||
Buffer buffer,
|
||||
Integer start,
|
||||
Integer end,
|
||||
Boolean strict_indexing,
|
||||
Error *err)
|
||||
{
|
||||
Array rv = ARRAY_DICT_INIT;
|
||||
buf_T *buf = find_buffer_by_handle(buffer, err);
|
||||
@@ -191,7 +191,9 @@ ArrayOf(String) buffer_get_lines(Buffer buffer,
|
||||
Object str = STRING_OBJ(cstr_to_string(bufstr));
|
||||
|
||||
// Vim represents NULs as NLs, but this may confuse clients.
|
||||
strchrsub(str.data.string.data, '\n', '\0');
|
||||
if (channel_id != INTERNAL_CALL) {
|
||||
strchrsub(str.data.string.data, '\n', '\0');
|
||||
}
|
||||
|
||||
rv.items[i] = str;
|
||||
}
|
||||
@@ -212,30 +214,30 @@ end:
|
||||
|
||||
/// Replaces a line range on the buffer
|
||||
///
|
||||
/// @deprecated use buffer_set_lines(buffer, newstart, newend, false, lines)
|
||||
/// @deprecated use nvim_buf_set_lines(buffer, newstart, newend, false, lines)
|
||||
/// where newstart = start + int(not include_start) + int(start < 0)
|
||||
/// newend = end + int(include_end) + int(end < 0)
|
||||
/// int(bool) = 1 if bool is true else 0
|
||||
///
|
||||
/// @param buffer The buffer handle
|
||||
/// @param start The first line index
|
||||
/// @param end The last line index
|
||||
/// @param include_start True if the slice includes the `start` parameter
|
||||
/// @param include_end True if the slice includes the `end` parameter
|
||||
/// @param replacement An array of lines to use as replacement(A 0-length
|
||||
// array will simply delete the line range)
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @param buffer Buffer handle
|
||||
/// @param start First line index
|
||||
/// @param end Last line index
|
||||
/// @param include_start True if the slice includes the `start` parameter
|
||||
/// @param include_end True if the slice includes the `end` parameter
|
||||
/// @param replacement Array of lines to use as replacement (0-length
|
||||
// array will delete the line range)
|
||||
/// @param[out] err Error details, if any
|
||||
void buffer_set_line_slice(Buffer buffer,
|
||||
Integer start,
|
||||
Integer end,
|
||||
Boolean include_start,
|
||||
Boolean include_end,
|
||||
ArrayOf(String) replacement,
|
||||
Error *err)
|
||||
Integer start,
|
||||
Integer end,
|
||||
Boolean include_start,
|
||||
Boolean include_end,
|
||||
ArrayOf(String) replacement, // NOLINT
|
||||
Error *err)
|
||||
{
|
||||
start = convert_index(start) + !include_start;
|
||||
end = convert_index(end) + include_end;
|
||||
buffer_set_lines(buffer, start, end, false, replacement, err);
|
||||
nvim_buf_set_lines(0, buffer, start, end, false, replacement, err);
|
||||
}
|
||||
|
||||
|
||||
@@ -251,18 +253,19 @@ void buffer_set_line_slice(Buffer buffer,
|
||||
/// Out-of-bounds indices are clamped to the nearest valid value, unless
|
||||
/// `strict_indexing` is set.
|
||||
///
|
||||
/// @param buffer The buffer handle
|
||||
/// @param start The first line index
|
||||
/// @param end The last line index (exclusive)
|
||||
/// @param strict_indexing whether out-of-bounds should be an error.
|
||||
/// @param replacement An array of lines to use as replacement
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
void buffer_set_lines(Buffer buffer,
|
||||
Integer start,
|
||||
Integer end,
|
||||
Boolean strict_indexing,
|
||||
ArrayOf(String) replacement,
|
||||
Error *err)
|
||||
/// @param buffer Buffer handle
|
||||
/// @param start First line index
|
||||
/// @param end Last line index (exclusive)
|
||||
/// @param strict_indexing Whether out-of-bounds should be an error.
|
||||
/// @param replacement Array of lines to use as replacement
|
||||
/// @param[out] err Error details, if any
|
||||
void nvim_buf_set_lines(uint64_t channel_id,
|
||||
Buffer buffer,
|
||||
Integer start,
|
||||
Integer end,
|
||||
Boolean strict_indexing,
|
||||
ArrayOf(String) replacement, // NOLINT
|
||||
Error *err)
|
||||
{
|
||||
buf_T *buf = find_buffer_by_handle(buffer, err);
|
||||
|
||||
@@ -309,7 +312,7 @@ void buffer_set_lines(Buffer buffer,
|
||||
// line and convert NULs to newlines to avoid truncation.
|
||||
lines[i] = xmallocz(l.size);
|
||||
for (size_t j = 0; j < l.size; j++) {
|
||||
if (l.data[j] == '\n') {
|
||||
if (l.data[j] == '\n' && channel_id != INTERNAL_CALL) {
|
||||
api_set_error(err, Exception, _("string cannot contain newlines"));
|
||||
new_len = i + 1;
|
||||
goto end;
|
||||
@@ -408,11 +411,11 @@ end:
|
||||
|
||||
/// Gets a buffer-scoped (b:) variable.
|
||||
///
|
||||
/// @param buffer The buffer handle
|
||||
/// @param name The variable name
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The variable value
|
||||
Object buffer_get_var(Buffer buffer, String name, Error *err)
|
||||
/// @param buffer Buffer handle
|
||||
/// @param name Variable name
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Variable value
|
||||
Object nvim_buf_get_var(Buffer buffer, String name, Error *err)
|
||||
{
|
||||
buf_T *buf = find_buffer_by_handle(buffer, err);
|
||||
|
||||
@@ -425,11 +428,46 @@ Object buffer_get_var(Buffer buffer, String name, Error *err)
|
||||
|
||||
/// Sets a buffer-scoped (b:) variable
|
||||
///
|
||||
/// @param buffer The buffer handle
|
||||
/// @param name The variable name
|
||||
/// @param value The variable value
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The old value or nil if there was no previous value.
|
||||
/// @param buffer Buffer handle
|
||||
/// @param name Variable name
|
||||
/// @param value Variable value
|
||||
/// @param[out] err Error details, if any
|
||||
void nvim_buf_set_var(Buffer buffer, String name, Object value, Error *err)
|
||||
{
|
||||
buf_T *buf = find_buffer_by_handle(buffer, err);
|
||||
|
||||
if (!buf) {
|
||||
return;
|
||||
}
|
||||
|
||||
dict_set_value(buf->b_vars, name, value, false, false, err);
|
||||
}
|
||||
|
||||
/// Removes a buffer-scoped (b:) variable
|
||||
///
|
||||
/// @param buffer Buffer handle
|
||||
/// @param name Variable name
|
||||
/// @param[out] err Error details, if any
|
||||
void nvim_buf_del_var(Buffer buffer, String name, Error *err)
|
||||
{
|
||||
buf_T *buf = find_buffer_by_handle(buffer, err);
|
||||
|
||||
if (!buf) {
|
||||
return;
|
||||
}
|
||||
|
||||
dict_set_value(buf->b_vars, name, NIL, true, false, err);
|
||||
}
|
||||
|
||||
/// Sets a buffer-scoped (b:) variable
|
||||
///
|
||||
/// @deprecated
|
||||
///
|
||||
/// @param buffer Buffer handle
|
||||
/// @param name Variable name
|
||||
/// @param value Variable value
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Old value or nil if there was no previous value.
|
||||
///
|
||||
/// @warning It may return nil if there was no previous value
|
||||
/// or if previous value was `v:null`.
|
||||
@@ -441,18 +479,17 @@ Object buffer_set_var(Buffer buffer, String name, Object value, Error *err)
|
||||
return (Object) OBJECT_INIT;
|
||||
}
|
||||
|
||||
return dict_set_value(buf->b_vars, name, value, false, err);
|
||||
return dict_set_value(buf->b_vars, name, value, false, true, err);
|
||||
}
|
||||
|
||||
/// Removes a buffer-scoped (b:) variable
|
||||
///
|
||||
/// @param buffer The buffer handle
|
||||
/// @param name The variable name
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The old value or nil if there was no previous value.
|
||||
/// @deprecated
|
||||
///
|
||||
/// @warning It may return nil if there was no previous value
|
||||
/// or if previous value was `v:null`.
|
||||
/// @param buffer Buffer handle
|
||||
/// @param name Variable name
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Old value
|
||||
Object buffer_del_var(Buffer buffer, String name, Error *err)
|
||||
{
|
||||
buf_T *buf = find_buffer_by_handle(buffer, err);
|
||||
@@ -461,16 +498,17 @@ Object buffer_del_var(Buffer buffer, String name, Error *err)
|
||||
return (Object) OBJECT_INIT;
|
||||
}
|
||||
|
||||
return dict_set_value(buf->b_vars, name, NIL, true, err);
|
||||
return dict_set_value(buf->b_vars, name, NIL, true, true, err);
|
||||
}
|
||||
|
||||
|
||||
/// Gets a buffer option value
|
||||
///
|
||||
/// @param buffer The buffer handle
|
||||
/// @param name The option name
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The option value
|
||||
Object buffer_get_option(Buffer buffer, String name, Error *err)
|
||||
/// @param buffer Buffer handle
|
||||
/// @param name Option name
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Option value
|
||||
Object nvim_buf_get_option(Buffer buffer, String name, Error *err)
|
||||
{
|
||||
buf_T *buf = find_buffer_by_handle(buffer, err);
|
||||
|
||||
@@ -481,14 +519,14 @@ Object buffer_get_option(Buffer buffer, String name, Error *err)
|
||||
return get_option_from(buf, SREQ_BUF, name, err);
|
||||
}
|
||||
|
||||
/// Sets a buffer option value. Passing 'nil' as value deletes the option(only
|
||||
/// Sets a buffer option value. Passing 'nil' as value deletes the option (only
|
||||
/// works if there's a global fallback)
|
||||
///
|
||||
/// @param buffer The buffer handle
|
||||
/// @param name The option name
|
||||
/// @param value The option value
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
void buffer_set_option(Buffer buffer, String name, Object value, Error *err)
|
||||
/// @param buffer Buffer handle
|
||||
/// @param name Option name
|
||||
/// @param value Option value
|
||||
/// @param[out] err Error details, if any
|
||||
void nvim_buf_set_option(Buffer buffer, String name, Object value, Error *err)
|
||||
{
|
||||
buf_T *buf = find_buffer_by_handle(buffer, err);
|
||||
|
||||
@@ -501,10 +539,10 @@ void buffer_set_option(Buffer buffer, String name, Object value, Error *err)
|
||||
|
||||
/// Gets the buffer number
|
||||
///
|
||||
/// @param buffer The buffer handle
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The buffer number
|
||||
Integer buffer_get_number(Buffer buffer, Error *err)
|
||||
/// @param buffer Buffer handle
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Buffer number
|
||||
Integer nvim_buf_get_number(Buffer buffer, Error *err)
|
||||
{
|
||||
Integer rv = 0;
|
||||
buf_T *buf = find_buffer_by_handle(buffer, err);
|
||||
@@ -518,10 +556,10 @@ Integer buffer_get_number(Buffer buffer, Error *err)
|
||||
|
||||
/// Gets the full file name for the buffer
|
||||
///
|
||||
/// @param buffer The buffer handle
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The buffer name
|
||||
String buffer_get_name(Buffer buffer, Error *err)
|
||||
/// @param buffer Buffer handle
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Buffer name
|
||||
String nvim_buf_get_name(Buffer buffer, Error *err)
|
||||
{
|
||||
String rv = STRING_INIT;
|
||||
buf_T *buf = find_buffer_by_handle(buffer, err);
|
||||
@@ -535,10 +573,10 @@ String buffer_get_name(Buffer buffer, Error *err)
|
||||
|
||||
/// Sets the full file name for a buffer
|
||||
///
|
||||
/// @param buffer The buffer handle
|
||||
/// @param name The buffer name
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
void buffer_set_name(Buffer buffer, String name, Error *err)
|
||||
/// @param buffer Buffer handle
|
||||
/// @param name Buffer name
|
||||
/// @param[out] err Error details, if any
|
||||
void nvim_buf_set_name(Buffer buffer, String name, Error *err)
|
||||
{
|
||||
buf_T *buf = find_buffer_by_handle(buffer, err);
|
||||
|
||||
@@ -565,9 +603,9 @@ void buffer_set_name(Buffer buffer, String name, Error *err)
|
||||
|
||||
/// Checks if a buffer is valid
|
||||
///
|
||||
/// @param buffer The buffer handle
|
||||
/// @param buffer Buffer handle
|
||||
/// @return true if the buffer is valid, false otherwise
|
||||
Boolean buffer_is_valid(Buffer buffer)
|
||||
Boolean nvim_buf_is_valid(Buffer buffer)
|
||||
{
|
||||
Error stub = ERROR_INIT;
|
||||
return find_buffer_by_handle(buffer, &stub) != NULL;
|
||||
@@ -575,13 +613,13 @@ Boolean buffer_is_valid(Buffer buffer)
|
||||
|
||||
/// Inserts a sequence of lines to a buffer at a certain index
|
||||
///
|
||||
/// @deprecated use buffer_set_lines(buffer, lnum, lnum, true, lines)
|
||||
/// @deprecated use nvim_buf_set_lines(buffer, lnum, lnum, true, lines)
|
||||
///
|
||||
/// @param buffer The buffer handle
|
||||
/// @param lnum Insert the lines after `lnum`. If negative, it will append
|
||||
/// to the end of the buffer.
|
||||
/// @param lines An array of lines
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @param buffer Buffer handle
|
||||
/// @param lnum Insert the lines after `lnum`. If negative, appends to
|
||||
/// the end of the buffer.
|
||||
/// @param lines Array of lines
|
||||
/// @param[out] err Error details, if any
|
||||
void buffer_insert(Buffer buffer,
|
||||
Integer lnum,
|
||||
ArrayOf(String) lines,
|
||||
@@ -589,16 +627,16 @@ void buffer_insert(Buffer buffer,
|
||||
{
|
||||
// "lnum" will be the index of the line after inserting,
|
||||
// no matter if it is negative or not
|
||||
buffer_set_lines(buffer, lnum, lnum, true, lines, err);
|
||||
nvim_buf_set_lines(0, buffer, lnum, lnum, true, lines, err);
|
||||
}
|
||||
|
||||
/// Return a tuple (row,col) representing the position of the named mark
|
||||
///
|
||||
/// @param buffer The buffer handle
|
||||
/// @param name The mark's name
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The (row, col) tuple
|
||||
ArrayOf(Integer, 2) buffer_get_mark(Buffer buffer, String name, Error *err)
|
||||
/// @param buffer Buffer handle
|
||||
/// @param name Mark name
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return (row, col) tuple
|
||||
ArrayOf(Integer, 2) nvim_buf_get_mark(Buffer buffer, String name, Error *err)
|
||||
{
|
||||
Array rv = ARRAY_DICT_INIT;
|
||||
buf_T *buf = find_buffer_by_handle(buffer, err);
|
||||
@@ -648,7 +686,7 @@ ArrayOf(Integer, 2) buffer_get_mark(Buffer buffer, String name, Error *err)
|
||||
/// called with src_id = 0, an unique source id is generated and returned.
|
||||
/// Succesive calls can pass in it as "src_id" to add new highlights to the same
|
||||
/// source group. All highlights in the same group can then be cleared with
|
||||
/// buffer_clear_highlight. If the highlight never will be manually deleted
|
||||
/// nvim_buf_clear_highlight. If the highlight never will be manually deleted
|
||||
/// pass in -1 for "src_id".
|
||||
///
|
||||
/// If "hl_group" is the empty string no highlight is added, but a new src_id
|
||||
@@ -656,23 +694,23 @@ ArrayOf(Integer, 2) buffer_get_mark(Buffer buffer, String name, Error *err)
|
||||
/// request an unique src_id at initialization, and later asynchronously add and
|
||||
/// clear highlights in response to buffer changes.
|
||||
///
|
||||
/// @param buffer The buffer handle
|
||||
/// @param src_id Source group to use or 0 to use a new group,
|
||||
/// or -1 for ungrouped highlight
|
||||
/// @param hl_group Name of the highlight group to use
|
||||
/// @param line The line to highlight
|
||||
/// @param col_start Start of range of columns to highlight
|
||||
/// @param col_end End of range of columns to highlight,
|
||||
/// or -1 to highlight to end of line
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @param buffer Buffer handle
|
||||
/// @param src_id Source group to use or 0 to use a new group,
|
||||
/// or -1 for ungrouped highlight
|
||||
/// @param hl_group Name of the highlight group to use
|
||||
/// @param line Line to highlight
|
||||
/// @param col_start Start of range of columns to highlight
|
||||
/// @param col_end End of range of columns to highlight,
|
||||
/// or -1 to highlight to end of line
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return The src_id that was used
|
||||
Integer buffer_add_highlight(Buffer buffer,
|
||||
Integer src_id,
|
||||
String hl_group,
|
||||
Integer line,
|
||||
Integer col_start,
|
||||
Integer col_end,
|
||||
Error *err)
|
||||
Integer nvim_buf_add_highlight(Buffer buffer,
|
||||
Integer src_id,
|
||||
String hl_group,
|
||||
Integer line,
|
||||
Integer col_start,
|
||||
Integer col_end,
|
||||
Error *err)
|
||||
{
|
||||
buf_T *buf = find_buffer_by_handle(buffer, err);
|
||||
if (!buf) {
|
||||
@@ -702,17 +740,17 @@ Integer buffer_add_highlight(Buffer buffer,
|
||||
/// To clear a source group in the entire buffer, pass in 1 and -1 to
|
||||
/// line_start and line_end respectively.
|
||||
///
|
||||
/// @param buffer The buffer handle
|
||||
/// @param src_id Highlight source group to clear, or -1 to clear all groups.
|
||||
/// @param buffer Buffer handle
|
||||
/// @param src_id Highlight source group to clear, or -1 to clear all.
|
||||
/// @param line_start Start of range of lines to clear
|
||||
/// @param line_end End of range of lines to clear (exclusive)
|
||||
/// or -1 to clear to end of file.
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
void buffer_clear_highlight(Buffer buffer,
|
||||
Integer src_id,
|
||||
Integer line_start,
|
||||
Integer line_end,
|
||||
Error *err)
|
||||
/// @param line_end End of range of lines to clear (exclusive) or -1 to clear
|
||||
/// to end of file.
|
||||
/// @param[out] err Error details, if any
|
||||
void nvim_buf_clear_highlight(Buffer buffer,
|
||||
Integer src_id,
|
||||
Integer line_start,
|
||||
Integer line_end,
|
||||
Error *err)
|
||||
{
|
||||
buf_T *buf = find_buffer_by_handle(buffer, err);
|
||||
if (!buf) {
|
||||
|
69
src/nvim/api/dispatch_deprecated.lua
Normal file
69
src/nvim/api/dispatch_deprecated.lua
Normal file
@@ -0,0 +1,69 @@
|
||||
local deprecated_aliases = {
|
||||
nvim_buf_add_highlight="buffer_add_highlight",
|
||||
nvim_buf_clear_highlight="buffer_clear_highlight",
|
||||
nvim_buf_get_lines="buffer_get_lines",
|
||||
nvim_buf_get_mark="buffer_get_mark",
|
||||
nvim_buf_get_name="buffer_get_name",
|
||||
nvim_buf_get_number="buffer_get_number",
|
||||
nvim_buf_get_option="buffer_get_option",
|
||||
nvim_buf_get_var="buffer_get_var",
|
||||
nvim_buf_is_valid="buffer_is_valid",
|
||||
nvim_buf_line_count="buffer_line_count",
|
||||
nvim_buf_set_lines="buffer_set_lines",
|
||||
nvim_buf_set_name="buffer_set_name",
|
||||
nvim_buf_set_option="buffer_set_option",
|
||||
nvim_call_function="vim_call_function",
|
||||
nvim_command="vim_command",
|
||||
nvim_command_output="vim_command_output",
|
||||
nvim_del_current_line="vim_del_current_line",
|
||||
nvim_err_write="vim_err_write",
|
||||
nvim_err_writeln="vim_report_error",
|
||||
nvim_eval="vim_eval",
|
||||
nvim_feedkeys="vim_feedkeys",
|
||||
nvim_get_api_info="vim_get_api_info",
|
||||
nvim_get_color_by_name="vim_name_to_color",
|
||||
nvim_get_color_map="vim_get_color_map",
|
||||
nvim_get_current_buf="vim_get_current_buffer",
|
||||
nvim_get_current_line="vim_get_current_line",
|
||||
nvim_get_current_tabpage="vim_get_current_tabpage",
|
||||
nvim_get_current_win="vim_get_current_window",
|
||||
nvim_get_option="vim_get_option",
|
||||
nvim_get_var="vim_get_var",
|
||||
nvim_get_vvar="vim_get_vvar",
|
||||
nvim_input="vim_input",
|
||||
nvim_list_bufs="vim_get_buffers",
|
||||
nvim_list_runtime_paths="vim_list_runtime_paths",
|
||||
nvim_list_tabpages="vim_get_tabpages",
|
||||
nvim_list_wins="vim_get_windows",
|
||||
nvim_out_write="vim_out_write",
|
||||
nvim_replace_termcodes="vim_replace_termcodes",
|
||||
nvim_set_current_buf="vim_set_current_buffer",
|
||||
nvim_set_current_dir="vim_change_directory",
|
||||
nvim_set_current_line="vim_set_current_line",
|
||||
nvim_set_current_tabpage="vim_set_current_tabpage",
|
||||
nvim_set_current_win="vim_set_current_window",
|
||||
nvim_set_option="vim_set_option",
|
||||
nvim_strwidth="vim_strwidth",
|
||||
nvim_subscribe="vim_subscribe",
|
||||
nvim_tabpage_get_var="tabpage_get_var",
|
||||
nvim_tabpage_get_win="tabpage_get_window",
|
||||
nvim_tabpage_is_valid="tabpage_is_valid",
|
||||
nvim_tabpage_list_wins="tabpage_get_windows",
|
||||
nvim_ui_detach="ui_detach",
|
||||
nvim_ui_try_resize="ui_try_resize",
|
||||
nvim_unsubscribe="vim_unsubscribe",
|
||||
nvim_win_get_buf="window_get_buffer",
|
||||
nvim_win_get_cursor="window_get_cursor",
|
||||
nvim_win_get_height="window_get_height",
|
||||
nvim_win_get_option="window_get_option",
|
||||
nvim_win_get_position="window_get_position",
|
||||
nvim_win_get_tabpage="window_get_tabpage",
|
||||
nvim_win_get_var="window_get_var",
|
||||
nvim_win_get_width="window_get_width",
|
||||
nvim_win_is_valid="window_is_valid",
|
||||
nvim_win_set_cursor="window_set_cursor",
|
||||
nvim_win_set_height="window_set_height",
|
||||
nvim_win_set_option="window_set_option",
|
||||
nvim_win_set_width="window_set_width",
|
||||
}
|
||||
return deprecated_aliases
|
@@ -9,13 +9,15 @@
|
||||
#define STRING_INIT {.data = NULL, .size = 0}
|
||||
#define OBJECT_INIT { .type = kObjectTypeNil }
|
||||
#define ERROR_INIT { .set = false }
|
||||
#define REMOTE_TYPE(type) typedef uint64_t type
|
||||
#define REMOTE_TYPE(type) typedef handle_T type
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# define ArrayOf(...) Array
|
||||
# define DictionaryOf(...) Dictionary
|
||||
#endif
|
||||
|
||||
typedef int handle_T;
|
||||
|
||||
// Basic types
|
||||
typedef enum {
|
||||
kErrorTypeException,
|
||||
@@ -31,6 +33,9 @@ typedef enum {
|
||||
/// Used as the message ID of notifications.
|
||||
#define NO_RESPONSE UINT64_MAX
|
||||
|
||||
/// Used as channel_id when the call is local.
|
||||
#define INTERNAL_CALL UINT64_MAX
|
||||
|
||||
typedef struct {
|
||||
ErrorType type;
|
||||
char msg[1024];
|
||||
@@ -86,9 +91,6 @@ typedef enum {
|
||||
struct object {
|
||||
ObjectType type;
|
||||
union {
|
||||
Buffer buffer;
|
||||
Window window;
|
||||
Tabpage tabpage;
|
||||
Boolean boolean;
|
||||
Integer integer;
|
||||
Float floating;
|
||||
|
45
src/nvim/api/private/dispatch.c
Normal file
45
src/nvim/api/private/dispatch.c
Normal file
@@ -0,0 +1,45 @@
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
#include <msgpack.h>
|
||||
|
||||
#include "nvim/map.h"
|
||||
#include "nvim/log.h"
|
||||
#include "nvim/vim.h"
|
||||
#include "nvim/msgpack_rpc/helpers.h"
|
||||
#include "nvim/api/private/dispatch.h"
|
||||
#include "nvim/api/private/helpers.h"
|
||||
#include "nvim/api/private/defs.h"
|
||||
|
||||
#include "nvim/api/buffer.h"
|
||||
#include "nvim/api/tabpage.h"
|
||||
#include "nvim/api/ui.h"
|
||||
#include "nvim/api/vim.h"
|
||||
#include "nvim/api/window.h"
|
||||
|
||||
static Map(String, MsgpackRpcRequestHandler) *methods = NULL;
|
||||
|
||||
static void msgpack_rpc_add_method_handler(String method,
|
||||
MsgpackRpcRequestHandler handler)
|
||||
{
|
||||
map_put(String, MsgpackRpcRequestHandler)(methods, method, handler);
|
||||
}
|
||||
|
||||
MsgpackRpcRequestHandler msgpack_rpc_get_handler_for(const char *name,
|
||||
size_t name_len)
|
||||
{
|
||||
String m = { .data = (char *)name, .size = name_len };
|
||||
MsgpackRpcRequestHandler rv =
|
||||
map_get(String, MsgpackRpcRequestHandler)(methods, m);
|
||||
|
||||
if (!rv.fn) {
|
||||
rv.fn = msgpack_rpc_handle_missing_method;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
#include "api/private/dispatch_wrappers.generated.h"
|
||||
#endif
|
23
src/nvim/api/private/dispatch.h
Normal file
23
src/nvim/api/private/dispatch.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef NVIM_API_PRIVATE_DISPATCH_H
|
||||
#define NVIM_API_PRIVATE_DISPATCH_H
|
||||
|
||||
#include "nvim/api/private/defs.h"
|
||||
|
||||
typedef Object (*ApiDispatchWrapper)(uint64_t channel_id,
|
||||
Array args,
|
||||
Error *error);
|
||||
|
||||
/// The rpc_method_handlers table, used in msgpack_rpc_dispatch(), stores
|
||||
/// functions of this type.
|
||||
typedef struct {
|
||||
ApiDispatchWrapper fn;
|
||||
bool async; // function is always safe to run immediately instead of being
|
||||
// put in a request queue for handling when nvim waits for input.
|
||||
} MsgpackRpcRequestHandler;
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "api/private/dispatch.h.generated.h"
|
||||
# include "api/private/dispatch_wrappers.h.generated.h"
|
||||
#endif
|
||||
|
||||
#endif // NVIM_API_PRIVATE_DISPATCH_H
|
@@ -5,30 +5,26 @@
|
||||
#include "nvim/map.h"
|
||||
#include "nvim/api/private/handle.h"
|
||||
|
||||
#define HANDLE_INIT(name) name##_handles = pmap_new(uint64_t)()
|
||||
#define HANDLE_INIT(name) name##_handles = pmap_new(handle_T)()
|
||||
|
||||
#define HANDLE_IMPL(type, name) \
|
||||
static PMap(uint64_t) *name##_handles = NULL; \
|
||||
static PMap(handle_T) *name##_handles = NULL; /* NOLINT */ \
|
||||
\
|
||||
type *handle_get_##name(uint64_t handle) \
|
||||
type *handle_get_##name(handle_T handle) \
|
||||
{ \
|
||||
return pmap_get(uint64_t)(name##_handles, handle); \
|
||||
return pmap_get(handle_T)(name##_handles, handle); \
|
||||
} \
|
||||
\
|
||||
void handle_register_##name(type *name) \
|
||||
{ \
|
||||
assert(!name->handle); \
|
||||
name->handle = next_handle++; \
|
||||
pmap_put(uint64_t)(name##_handles, name->handle, name); \
|
||||
pmap_put(handle_T)(name##_handles, name->handle, name); \
|
||||
} \
|
||||
\
|
||||
void handle_unregister_##name(type *name) \
|
||||
{ \
|
||||
pmap_del(uint64_t)(name##_handles, name->handle); \
|
||||
pmap_del(handle_T)(name##_handles, name->handle); \
|
||||
}
|
||||
|
||||
static uint64_t next_handle = 1;
|
||||
|
||||
HANDLE_IMPL(buf_T, buffer)
|
||||
HANDLE_IMPL(win_T, window)
|
||||
HANDLE_IMPL(tabpage_T, tabpage)
|
||||
|
@@ -3,9 +3,10 @@
|
||||
|
||||
#include "nvim/vim.h"
|
||||
#include "nvim/buffer_defs.h"
|
||||
#include "nvim/api/private/defs.h"
|
||||
|
||||
#define HANDLE_DECLS(type, name) \
|
||||
type *handle_get_##name(uint64_t handle); \
|
||||
type *handle_get_##name(handle_T handle); \
|
||||
void handle_register_##name(type *name); \
|
||||
void handle_unregister_##name(type *name);
|
||||
|
||||
|
@@ -7,6 +7,7 @@
|
||||
#include "nvim/api/private/helpers.h"
|
||||
#include "nvim/api/private/defs.h"
|
||||
#include "nvim/api/private/handle.h"
|
||||
#include "nvim/msgpack_rpc/helpers.h"
|
||||
#include "nvim/ascii.h"
|
||||
#include "nvim/vim.h"
|
||||
#include "nvim/buffer.h"
|
||||
@@ -17,6 +18,7 @@
|
||||
#include "nvim/map.h"
|
||||
#include "nvim/option.h"
|
||||
#include "nvim/option_defs.h"
|
||||
#include "nvim/version.h"
|
||||
#include "nvim/eval/typval_encode.h"
|
||||
#include "nvim/lib/kvec.h"
|
||||
|
||||
@@ -27,6 +29,7 @@ typedef struct {
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "api/private/helpers.c.generated.h"
|
||||
# include "api/private/funcs_metadata.generated.h"
|
||||
#endif
|
||||
|
||||
/// Start block that may cause vimscript exceptions
|
||||
@@ -104,10 +107,11 @@ Object dict_get_value(dict_T *dict, String key, Error *err)
|
||||
/// @param value The new value
|
||||
/// @param del Delete key in place of setting it. Argument `value` is ignored in
|
||||
/// this case.
|
||||
/// @param retval If true the old value will be converted and returned.
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return the old value, if any
|
||||
/// @return The old value if `retval` is true and the key was present, else NIL
|
||||
Object dict_set_value(dict_T *dict, String key, Object value, bool del,
|
||||
Error *err)
|
||||
bool retval, Error *err)
|
||||
{
|
||||
Object rv = OBJECT_INIT;
|
||||
|
||||
@@ -135,7 +139,9 @@ Object dict_set_value(dict_T *dict, String key, Object value, bool del,
|
||||
api_set_error(err, Validation, _("Key \"%s\" doesn't exist"), key.data);
|
||||
} else {
|
||||
// Return the old value
|
||||
rv = vim_to_object(&di->di_tv);
|
||||
if (retval) {
|
||||
rv = vim_to_object(&di->di_tv);
|
||||
}
|
||||
// Delete the entry
|
||||
hashitem_T *hi = hash_find(&dict->dv_hashtab, di->di_key);
|
||||
hash_remove(&dict->dv_hashtab, hi);
|
||||
@@ -156,7 +162,9 @@ Object dict_set_value(dict_T *dict, String key, Object value, bool del,
|
||||
dict_add(dict, di);
|
||||
} else {
|
||||
// Return the old value
|
||||
rv = vim_to_object(&di->di_tv);
|
||||
if (retval) {
|
||||
rv = vim_to_object(&di->di_tv);
|
||||
}
|
||||
clear_tv(&di->di_tv);
|
||||
}
|
||||
|
||||
@@ -363,11 +371,10 @@ static inline void typval_encode_list_start(EncodedData *const edata,
|
||||
const size_t len)
|
||||
FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
const Object obj = OBJECT_INIT;
|
||||
kv_push(edata->stack, ARRAY_OBJ(((Array) {
|
||||
.capacity = len,
|
||||
.size = 0,
|
||||
.items = xmalloc(len * sizeof(*obj.data.array.items)),
|
||||
.items = xmalloc(len * sizeof(*((Object *)NULL)->data.array.items)),
|
||||
})));
|
||||
}
|
||||
|
||||
@@ -404,11 +411,10 @@ static inline void typval_encode_dict_start(EncodedData *const edata,
|
||||
const size_t len)
|
||||
FUNC_ATTR_ALWAYS_INLINE FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
const Object obj = OBJECT_INIT;
|
||||
kv_push(edata->stack, DICTIONARY_OBJ(((Dictionary) {
|
||||
.capacity = len,
|
||||
.size = 0,
|
||||
.items = xmalloc(len * sizeof(*obj.data.dictionary.items)),
|
||||
.items = xmalloc(len * sizeof(*((Object *)NULL)->data.dictionary.items)),
|
||||
})));
|
||||
}
|
||||
|
||||
@@ -507,6 +513,10 @@ Object vim_to_object(typval_T *obj)
|
||||
|
||||
buf_T *find_buffer_by_handle(Buffer buffer, Error *err)
|
||||
{
|
||||
if (buffer == 0) {
|
||||
return curbuf;
|
||||
}
|
||||
|
||||
buf_T *rv = handle_get_buffer(buffer);
|
||||
|
||||
if (!rv) {
|
||||
@@ -518,6 +528,10 @@ buf_T *find_buffer_by_handle(Buffer buffer, Error *err)
|
||||
|
||||
win_T * find_window_by_handle(Window window, Error *err)
|
||||
{
|
||||
if (window == 0) {
|
||||
return curwin;
|
||||
}
|
||||
|
||||
win_T *rv = handle_get_window(window);
|
||||
|
||||
if (!rv) {
|
||||
@@ -529,6 +543,10 @@ win_T * find_window_by_handle(Window window, Error *err)
|
||||
|
||||
tabpage_T * find_tab_by_handle(Tabpage tabpage, Error *err)
|
||||
{
|
||||
if (tabpage == 0) {
|
||||
return curtab;
|
||||
}
|
||||
|
||||
tabpage_T *rv = handle_get_tabpage(tabpage);
|
||||
|
||||
if (!rv) {
|
||||
@@ -572,10 +590,16 @@ String cstr_as_string(char *str) FUNC_ATTR_PURE
|
||||
return (String) {.data = str, .size = strlen(str)};
|
||||
}
|
||||
|
||||
/// Converts from type Object to a VimL value.
|
||||
///
|
||||
/// @param obj Object to convert from.
|
||||
/// @param tv Conversion result is placed here. On failure member v_type is
|
||||
/// set to VAR_UNKNOWN (no allocation was made for this variable).
|
||||
/// returns true if conversion is successful, otherwise false.
|
||||
bool object_to_vim(Object obj, typval_T *tv, Error *err)
|
||||
{
|
||||
tv->v_type = VAR_UNKNOWN;
|
||||
tv->v_lock = 0;
|
||||
tv->v_lock = VAR_UNLOCKED;
|
||||
|
||||
switch (obj.type) {
|
||||
case kObjectTypeNil:
|
||||
@@ -592,13 +616,14 @@ bool object_to_vim(Object obj, typval_T *tv, Error *err)
|
||||
case kObjectTypeWindow:
|
||||
case kObjectTypeTabpage:
|
||||
case kObjectTypeInteger:
|
||||
if (obj.data.integer > INT_MAX || obj.data.integer < INT_MIN) {
|
||||
if (obj.data.integer > VARNUMBER_MAX
|
||||
|| obj.data.integer < VARNUMBER_MIN) {
|
||||
api_set_error(err, Validation, _("Integer value outside range"));
|
||||
return false;
|
||||
}
|
||||
|
||||
tv->v_type = VAR_NUMBER;
|
||||
tv->vval.v_number = (int)obj.data.integer;
|
||||
tv->vval.v_number = (varnumber_T)obj.data.integer;
|
||||
break;
|
||||
|
||||
case kObjectTypeFloat:
|
||||
@@ -616,9 +641,8 @@ bool object_to_vim(Object obj, typval_T *tv, Error *err)
|
||||
}
|
||||
break;
|
||||
|
||||
case kObjectTypeArray:
|
||||
tv->v_type = VAR_LIST;
|
||||
tv->vval.v_list = list_alloc();
|
||||
case kObjectTypeArray: {
|
||||
list_T *list = list_alloc();
|
||||
|
||||
for (uint32_t i = 0; i < obj.data.array.size; i++) {
|
||||
Object item = obj.data.array.items[i];
|
||||
@@ -627,45 +651,51 @@ bool object_to_vim(Object obj, typval_T *tv, Error *err)
|
||||
if (!object_to_vim(item, &li->li_tv, err)) {
|
||||
// cleanup
|
||||
listitem_free(li);
|
||||
list_free(tv->vval.v_list, true);
|
||||
list_free(list, true);
|
||||
return false;
|
||||
}
|
||||
|
||||
list_append(tv->vval.v_list, li);
|
||||
list_append(list, li);
|
||||
}
|
||||
tv->vval.v_list->lv_refcount++;
|
||||
break;
|
||||
list->lv_refcount++;
|
||||
|
||||
case kObjectTypeDictionary:
|
||||
tv->v_type = VAR_DICT;
|
||||
tv->vval.v_dict = dict_alloc();
|
||||
tv->v_type = VAR_LIST;
|
||||
tv->vval.v_list = list;
|
||||
break;
|
||||
}
|
||||
|
||||
case kObjectTypeDictionary: {
|
||||
dict_T *dict = dict_alloc();
|
||||
|
||||
for (uint32_t i = 0; i < obj.data.dictionary.size; i++) {
|
||||
KeyValuePair item = obj.data.dictionary.items[i];
|
||||
String key = item.key;
|
||||
|
||||
if (key.size == 0) {
|
||||
api_set_error(err,
|
||||
Validation,
|
||||
api_set_error(err, Validation,
|
||||
_("Empty dictionary keys aren't allowed"));
|
||||
// cleanup
|
||||
dict_free(tv->vval.v_dict, true);
|
||||
dict_free(dict, true);
|
||||
return false;
|
||||
}
|
||||
|
||||
dictitem_T *di = dictitem_alloc((uint8_t *) key.data);
|
||||
dictitem_T *di = dictitem_alloc((uint8_t *)key.data);
|
||||
|
||||
if (!object_to_vim(item.value, &di->di_tv, err)) {
|
||||
// cleanup
|
||||
dictitem_free(di);
|
||||
dict_free(tv->vval.v_dict, true);
|
||||
dict_free(dict, true);
|
||||
return false;
|
||||
}
|
||||
|
||||
dict_add(tv->vval.v_dict, di);
|
||||
dict_add(dict, di);
|
||||
}
|
||||
tv->vval.v_dict->dv_refcount++;
|
||||
dict->dv_refcount++;
|
||||
|
||||
tv->v_type = VAR_DICT;
|
||||
tv->vval.v_dict = dict;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
@@ -735,7 +765,8 @@ Dictionary api_metadata(void)
|
||||
static Dictionary metadata = ARRAY_DICT_INIT;
|
||||
|
||||
if (!metadata.size) {
|
||||
msgpack_rpc_init_function_metadata(&metadata);
|
||||
PUT(metadata, "version", DICTIONARY_OBJ(version_dict()));
|
||||
init_function_metadata(&metadata);
|
||||
init_error_type_metadata(&metadata);
|
||||
init_type_metadata(&metadata);
|
||||
}
|
||||
@@ -743,6 +774,22 @@ Dictionary api_metadata(void)
|
||||
return copy_object(DICTIONARY_OBJ(metadata)).data.dictionary;
|
||||
}
|
||||
|
||||
static void init_function_metadata(Dictionary *metadata)
|
||||
{
|
||||
msgpack_unpacked unpacked;
|
||||
msgpack_unpacked_init(&unpacked);
|
||||
if (msgpack_unpack_next(&unpacked,
|
||||
(const char *)funcs_metadata,
|
||||
sizeof(funcs_metadata),
|
||||
NULL) != MSGPACK_UNPACK_SUCCESS) {
|
||||
abort();
|
||||
}
|
||||
Object functions;
|
||||
msgpack_rpc_to_object(&unpacked.data, &functions);
|
||||
msgpack_unpacked_destroy(&unpacked);
|
||||
PUT(*metadata, "functions", functions);
|
||||
}
|
||||
|
||||
static void init_error_type_metadata(Dictionary *metadata)
|
||||
{
|
||||
Dictionary types = ARRAY_DICT_INIT;
|
||||
@@ -758,18 +805,22 @@ static void init_error_type_metadata(Dictionary *metadata)
|
||||
|
||||
PUT(*metadata, "error_types", DICTIONARY_OBJ(types));
|
||||
}
|
||||
|
||||
static void init_type_metadata(Dictionary *metadata)
|
||||
{
|
||||
Dictionary types = ARRAY_DICT_INIT;
|
||||
|
||||
Dictionary buffer_metadata = ARRAY_DICT_INIT;
|
||||
PUT(buffer_metadata, "id", INTEGER_OBJ(kObjectTypeBuffer));
|
||||
PUT(buffer_metadata, "prefix", STRING_OBJ(cstr_to_string("nvim_buf_")));
|
||||
|
||||
Dictionary window_metadata = ARRAY_DICT_INIT;
|
||||
PUT(window_metadata, "id", INTEGER_OBJ(kObjectTypeWindow));
|
||||
PUT(window_metadata, "prefix", STRING_OBJ(cstr_to_string("nvim_win_")));
|
||||
|
||||
Dictionary tabpage_metadata = ARRAY_DICT_INIT;
|
||||
PUT(tabpage_metadata, "id", INTEGER_OBJ(kObjectTypeTabpage));
|
||||
PUT(tabpage_metadata, "prefix", STRING_OBJ(cstr_to_string("nvim_tabpage_")));
|
||||
|
||||
PUT(types, "Buffer", DICTIONARY_OBJ(buffer_metadata));
|
||||
PUT(types, "Window", DICTIONARY_OBJ(window_metadata));
|
||||
|
@@ -37,15 +37,15 @@
|
||||
|
||||
#define BUFFER_OBJ(s) ((Object) { \
|
||||
.type = kObjectTypeBuffer, \
|
||||
.data.buffer = s })
|
||||
.data.integer = s })
|
||||
|
||||
#define WINDOW_OBJ(s) ((Object) { \
|
||||
.type = kObjectTypeWindow, \
|
||||
.data.window = s })
|
||||
.data.integer = s })
|
||||
|
||||
#define TABPAGE_OBJ(s) ((Object) { \
|
||||
.type = kObjectTypeTabpage, \
|
||||
.data.tabpage = s })
|
||||
.data.integer = s })
|
||||
|
||||
#define ARRAY_OBJ(a) ((Object) { \
|
||||
.type = kObjectTypeArray, \
|
||||
|
@@ -11,10 +11,10 @@
|
||||
|
||||
/// Gets the windows in a tabpage
|
||||
///
|
||||
/// @param tabpage The tabpage
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The windows in `tabpage`
|
||||
ArrayOf(Window) tabpage_get_windows(Tabpage tabpage, Error *err)
|
||||
/// @param tabpage Tabpage
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return List of windows in `tabpage`
|
||||
ArrayOf(Window) nvim_tabpage_list_wins(Tabpage tabpage, Error *err)
|
||||
{
|
||||
Array rv = ARRAY_DICT_INIT;
|
||||
tabpage_T *tab = find_tab_by_handle(tabpage, err);
|
||||
@@ -39,11 +39,11 @@ ArrayOf(Window) tabpage_get_windows(Tabpage tabpage, Error *err)
|
||||
|
||||
/// Gets a tab-scoped (t:) variable
|
||||
///
|
||||
/// @param tabpage The tab page handle
|
||||
/// @param name The variable name
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The variable value
|
||||
Object tabpage_get_var(Tabpage tabpage, String name, Error *err)
|
||||
/// @param tabpage Tabpage handle
|
||||
/// @param name Variable name
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Variable value
|
||||
Object nvim_tabpage_get_var(Tabpage tabpage, String name, Error *err)
|
||||
{
|
||||
tabpage_T *tab = find_tab_by_handle(tabpage, err);
|
||||
|
||||
@@ -56,11 +56,49 @@ Object tabpage_get_var(Tabpage tabpage, String name, Error *err)
|
||||
|
||||
/// Sets a tab-scoped (t:) variable
|
||||
///
|
||||
/// @param tabpage handle
|
||||
/// @param name The variable name
|
||||
/// @param value The variable value
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The old value or nil if there was no previous value.
|
||||
/// @param tabpage Tabpage handle
|
||||
/// @param name Variable name
|
||||
/// @param value Variable value
|
||||
/// @param[out] err Error details, if any
|
||||
void nvim_tabpage_set_var(Tabpage tabpage,
|
||||
String name,
|
||||
Object value,
|
||||
Error *err)
|
||||
{
|
||||
tabpage_T *tab = find_tab_by_handle(tabpage, err);
|
||||
|
||||
if (!tab) {
|
||||
return;
|
||||
}
|
||||
|
||||
dict_set_value(tab->tp_vars, name, value, false, false, err);
|
||||
}
|
||||
|
||||
/// Removes a tab-scoped (t:) variable
|
||||
///
|
||||
/// @param tabpage Tabpage handle
|
||||
/// @param name Variable name
|
||||
/// @param[out] err Error details, if any
|
||||
void nvim_tabpage_del_var(Tabpage tabpage, String name, Error *err)
|
||||
{
|
||||
tabpage_T *tab = find_tab_by_handle(tabpage, err);
|
||||
|
||||
if (!tab) {
|
||||
return;
|
||||
}
|
||||
|
||||
dict_set_value(tab->tp_vars, name, NIL, true, false, err);
|
||||
}
|
||||
|
||||
/// Sets a tab-scoped (t:) variable
|
||||
///
|
||||
/// @deprecated
|
||||
///
|
||||
/// @param tabpage Tabpage handle
|
||||
/// @param name Variable name
|
||||
/// @param value Variable value
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Old value or nil if there was no previous value.
|
||||
///
|
||||
/// @warning It may return nil if there was no previous value
|
||||
/// or if previous value was `v:null`.
|
||||
@@ -72,18 +110,17 @@ Object tabpage_set_var(Tabpage tabpage, String name, Object value, Error *err)
|
||||
return (Object) OBJECT_INIT;
|
||||
}
|
||||
|
||||
return dict_set_value(tab->tp_vars, name, value, false, err);
|
||||
return dict_set_value(tab->tp_vars, name, value, false, true, err);
|
||||
}
|
||||
|
||||
/// Removes a tab-scoped (t:) variable
|
||||
///
|
||||
/// @param tabpage handle
|
||||
/// @param name The variable name
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The old value or nil if there was no previous value.
|
||||
/// @deprecated
|
||||
///
|
||||
/// @warning It may return nil if there was no previous value
|
||||
/// or if previous value was `v:null`.
|
||||
/// @param tabpage Tabpage handle
|
||||
/// @param name Variable name
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Old value
|
||||
Object tabpage_del_var(Tabpage tabpage, String name, Error *err)
|
||||
{
|
||||
tabpage_T *tab = find_tab_by_handle(tabpage, err);
|
||||
@@ -92,15 +129,15 @@ Object tabpage_del_var(Tabpage tabpage, String name, Error *err)
|
||||
return (Object) OBJECT_INIT;
|
||||
}
|
||||
|
||||
return dict_set_value(tab->tp_vars, name, NIL, true, err);
|
||||
return dict_set_value(tab->tp_vars, name, NIL, true, true, err);
|
||||
}
|
||||
|
||||
/// Gets the current window in a tab page
|
||||
/// Gets the current window in a tabpage
|
||||
///
|
||||
/// @param tabpage The tab page handle
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The Window handle
|
||||
Window tabpage_get_window(Tabpage tabpage, Error *err)
|
||||
/// @param tabpage Tabpage handle
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Window handle
|
||||
Window nvim_tabpage_get_win(Tabpage tabpage, Error *err)
|
||||
{
|
||||
Window rv = 0;
|
||||
tabpage_T *tab = find_tab_by_handle(tabpage, err);
|
||||
@@ -110,7 +147,7 @@ Window tabpage_get_window(Tabpage tabpage, Error *err)
|
||||
}
|
||||
|
||||
if (tab == curtab) {
|
||||
return vim_get_current_window();
|
||||
return nvim_get_current_win();
|
||||
} else {
|
||||
FOR_ALL_WINDOWS_IN_TAB(wp, tab) {
|
||||
if (wp == tab->tp_curwin) {
|
||||
@@ -122,11 +159,28 @@ Window tabpage_get_window(Tabpage tabpage, Error *err)
|
||||
}
|
||||
}
|
||||
|
||||
/// Checks if a tab page is valid
|
||||
/// Gets the tabpage number
|
||||
///
|
||||
/// @param tabpage The tab page handle
|
||||
/// @return true if the tab page is valid, false otherwise
|
||||
Boolean tabpage_is_valid(Tabpage tabpage)
|
||||
/// @param tabpage Tabpage handle
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Tabpage number
|
||||
Integer nvim_tabpage_get_number(Tabpage tabpage, Error *err)
|
||||
{
|
||||
Integer rv = 0;
|
||||
tabpage_T *tab = find_tab_by_handle(tabpage, err);
|
||||
|
||||
if (!tab) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
return tabpage_index(tab);
|
||||
}
|
||||
|
||||
/// Checks if a tabpage is valid
|
||||
///
|
||||
/// @param tabpage Tabpage handle
|
||||
/// @return true if the tabpage is valid, false otherwise
|
||||
Boolean nvim_tabpage_is_valid(Tabpage tabpage)
|
||||
{
|
||||
Error stub = ERROR_INIT;
|
||||
return find_tab_by_handle(tabpage, &stub) != NULL;
|
||||
|
@@ -8,8 +8,10 @@
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/map.h"
|
||||
#include "nvim/msgpack_rpc/channel.h"
|
||||
#include "nvim/api/ui.h"
|
||||
#include "nvim/api/private/defs.h"
|
||||
#include "nvim/api/private/helpers.h"
|
||||
#include "nvim/popupmnu.h"
|
||||
|
||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||
# include "api/ui.c.generated.h"
|
||||
@@ -44,8 +46,9 @@ void remote_ui_disconnect(uint64_t channel_id)
|
||||
xfree(ui);
|
||||
}
|
||||
|
||||
void ui_attach(uint64_t channel_id, Integer width, Integer height,
|
||||
Boolean enable_rgb, Error *err)
|
||||
void nvim_ui_attach(uint64_t channel_id, Integer width, Integer height,
|
||||
Dictionary options, Error *err)
|
||||
FUNC_API_NOEVAL
|
||||
{
|
||||
if (pmap_has(uint64_t)(connected_uis, channel_id)) {
|
||||
api_set_error(err, Exception, _("UI already attached for channel"));
|
||||
@@ -57,14 +60,11 @@ void ui_attach(uint64_t channel_id, Integer width, Integer height,
|
||||
_("Expected width > 0 and height > 0"));
|
||||
return;
|
||||
}
|
||||
UIData *data = xmalloc(sizeof(UIData));
|
||||
data->channel_id = channel_id;
|
||||
data->buffer = (Array)ARRAY_DICT_INIT;
|
||||
UI *ui = xcalloc(1, sizeof(UI));
|
||||
ui->width = (int)width;
|
||||
ui->height = (int)height;
|
||||
ui->rgb = enable_rgb;
|
||||
ui->data = data;
|
||||
ui->rgb = true;
|
||||
ui->pum_external = false;
|
||||
ui->resize = remote_ui_resize;
|
||||
ui->clear = remote_ui_clear;
|
||||
ui->eol_clear = remote_ui_eol_clear;
|
||||
@@ -88,37 +88,100 @@ void ui_attach(uint64_t channel_id, Integer width, Integer height,
|
||||
ui->suspend = remote_ui_suspend;
|
||||
ui->set_title = remote_ui_set_title;
|
||||
ui->set_icon = remote_ui_set_icon;
|
||||
ui->event = remote_ui_event;
|
||||
|
||||
for (size_t i = 0; i < options.size; i++) {
|
||||
ui_set_option(ui, options.items[i].key, options.items[i].value, err);
|
||||
if (err->set) {
|
||||
xfree(ui);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
UIData *data = xmalloc(sizeof(UIData));
|
||||
data->channel_id = channel_id;
|
||||
data->buffer = (Array)ARRAY_DICT_INIT;
|
||||
ui->data = data;
|
||||
|
||||
pmap_put(uint64_t)(connected_uis, channel_id, ui);
|
||||
ui_attach_impl(ui);
|
||||
return;
|
||||
}
|
||||
|
||||
void ui_detach(uint64_t channel_id, Error *err)
|
||||
/// @deprecated
|
||||
void ui_attach(uint64_t channel_id, Integer width, Integer height,
|
||||
Boolean enable_rgb, Error *err)
|
||||
{
|
||||
Dictionary opts = ARRAY_DICT_INIT;
|
||||
PUT(opts, "rgb", BOOLEAN_OBJ(enable_rgb));
|
||||
nvim_ui_attach(channel_id, width, height, opts, err);
|
||||
api_free_dictionary(opts);
|
||||
}
|
||||
|
||||
void nvim_ui_detach(uint64_t channel_id, Error *err)
|
||||
FUNC_API_NOEVAL
|
||||
{
|
||||
if (!pmap_has(uint64_t)(connected_uis, channel_id)) {
|
||||
api_set_error(err, Exception, _("UI is not attached for channel"));
|
||||
return;
|
||||
}
|
||||
remote_ui_disconnect(channel_id);
|
||||
}
|
||||
|
||||
Object ui_try_resize(uint64_t channel_id, Integer width,
|
||||
Integer height, Error *err)
|
||||
|
||||
void nvim_ui_try_resize(uint64_t channel_id, Integer width,
|
||||
Integer height, Error *err)
|
||||
FUNC_API_NOEVAL
|
||||
{
|
||||
if (!pmap_has(uint64_t)(connected_uis, channel_id)) {
|
||||
api_set_error(err, Exception, _("UI is not attached for channel"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (width <= 0 || height <= 0) {
|
||||
api_set_error(err, Validation,
|
||||
_("Expected width > 0 and height > 0"));
|
||||
return NIL;
|
||||
return;
|
||||
}
|
||||
|
||||
UI *ui = pmap_get(uint64_t)(connected_uis, channel_id);
|
||||
ui->width = (int)width;
|
||||
ui->height = (int)height;
|
||||
ui_refresh();
|
||||
return NIL;
|
||||
}
|
||||
|
||||
void nvim_ui_set_option(uint64_t channel_id, String name,
|
||||
Object value, Error *error)
|
||||
FUNC_API_NOEVAL
|
||||
{
|
||||
if (!pmap_has(uint64_t)(connected_uis, channel_id)) {
|
||||
api_set_error(error, Exception, _("UI is not attached for channel"));
|
||||
return;
|
||||
}
|
||||
UI *ui = pmap_get(uint64_t)(connected_uis, channel_id);
|
||||
|
||||
ui_set_option(ui, name, value, error);
|
||||
if (!error->set) {
|
||||
ui_refresh();
|
||||
}
|
||||
}
|
||||
|
||||
static void ui_set_option(UI *ui, String name, Object value, Error *error) {
|
||||
if (strcmp(name.data, "rgb") == 0) {
|
||||
if (value.type != kObjectTypeBoolean) {
|
||||
api_set_error(error, Validation, _("rgb must be a Boolean"));
|
||||
return;
|
||||
}
|
||||
ui->rgb = value.data.boolean;
|
||||
} else if (strcmp(name.data, "popupmenu_external") == 0) {
|
||||
if (value.type != kObjectTypeBoolean) {
|
||||
api_set_error(error, Validation,
|
||||
_("popupmenu_external must be a Boolean"));
|
||||
return;
|
||||
}
|
||||
ui->pum_external = value.data.boolean;
|
||||
} else {
|
||||
api_set_error(error, Validation, _("No such ui option"));
|
||||
}
|
||||
}
|
||||
|
||||
static void push_call(UI *ui, char *name, Array args)
|
||||
@@ -341,3 +404,19 @@ static void remote_ui_set_icon(UI *ui, char *icon)
|
||||
ADD(args, STRING_OBJ(cstr_to_string(icon)));
|
||||
push_call(ui, "set_icon", args);
|
||||
}
|
||||
|
||||
static void remote_ui_event(UI *ui, char *name, Array args, bool *args_consumed)
|
||||
{
|
||||
Array my_args = ARRAY_DICT_INIT;
|
||||
// Objects are currently single-reference
|
||||
// make a copy, but only if necessary
|
||||
if (*args_consumed) {
|
||||
for (size_t i = 0; i < args.size; i++) {
|
||||
ADD(my_args, copy_object(args.items[i]));
|
||||
}
|
||||
} else {
|
||||
my_args = args;
|
||||
*args_consumed = true;
|
||||
}
|
||||
push_call(ui, name, my_args);
|
||||
}
|
||||
|
@@ -14,6 +14,7 @@
|
||||
#include "nvim/msgpack_rpc/channel.h"
|
||||
#include "nvim/vim.h"
|
||||
#include "nvim/buffer.h"
|
||||
#include "nvim/file_search.h"
|
||||
#include "nvim/window.h"
|
||||
#include "nvim/types.h"
|
||||
#include "nvim/ex_docmd.h"
|
||||
@@ -21,7 +22,7 @@
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/message.h"
|
||||
#include "nvim/eval.h"
|
||||
#include "nvim/misc2.h"
|
||||
#include "nvim/option.h"
|
||||
#include "nvim/syntax.h"
|
||||
#include "nvim/getchar.h"
|
||||
#include "nvim/os/input.h"
|
||||
@@ -32,37 +33,35 @@
|
||||
# include "api/vim.c.generated.h"
|
||||
#endif
|
||||
|
||||
/// Executes an ex-mode command str
|
||||
/// Executes an ex-command.
|
||||
/// On VimL error: Returns the VimL error; v:errmsg is not updated.
|
||||
///
|
||||
/// @param str The command str
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
void vim_command(String str, Error *err)
|
||||
/// @param command Ex-command string
|
||||
/// @param[out] err Error details (including actual VimL error), if any
|
||||
void nvim_command(String command, Error *err)
|
||||
{
|
||||
// Run the command
|
||||
try_start();
|
||||
do_cmdline_cmd(str.data);
|
||||
do_cmdline_cmd(command.data);
|
||||
update_screen(VALID);
|
||||
try_end(err);
|
||||
}
|
||||
|
||||
/// Passes input keys to Neovim
|
||||
/// Passes input keys to Nvim.
|
||||
/// On VimL error: Does not fail, but updates v:errmsg.
|
||||
///
|
||||
/// @param keys to be typed
|
||||
/// @param mode specifies the mapping options
|
||||
/// @param escape_csi the string needs escaping for K_SPECIAL/CSI bytes
|
||||
/// @param keys to be typed
|
||||
/// @param mode mapping options
|
||||
/// @param escape_csi If true, escape K_SPECIAL/CSI bytes in `keys`
|
||||
/// @see feedkeys()
|
||||
/// @see vim_strsave_escape_csi
|
||||
void vim_feedkeys(String keys, String mode, Boolean escape_csi)
|
||||
void nvim_feedkeys(String keys, String mode, Boolean escape_csi)
|
||||
{
|
||||
bool remap = true;
|
||||
bool insert = false;
|
||||
bool typed = false;
|
||||
bool execute = false;
|
||||
|
||||
if (keys.size == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < mode.size; ++i) {
|
||||
switch (mode.data[i]) {
|
||||
case 'n': remap = false; break;
|
||||
@@ -73,6 +72,10 @@ void vim_feedkeys(String keys, String mode, Boolean escape_csi)
|
||||
}
|
||||
}
|
||||
|
||||
if (keys.size == 0 && !execute) {
|
||||
return;
|
||||
}
|
||||
|
||||
char *keys_esc;
|
||||
if (escape_csi) {
|
||||
// Need to escape K_SPECIAL and CSI before putting the string in the
|
||||
@@ -92,18 +95,25 @@ void vim_feedkeys(String keys, String mode, Boolean escape_csi)
|
||||
typebuf_was_filled = true;
|
||||
}
|
||||
if (execute) {
|
||||
int save_msg_scroll = msg_scroll;
|
||||
|
||||
/* Avoid a 1 second delay when the keys start Insert mode. */
|
||||
msg_scroll = false;
|
||||
exec_normal(true);
|
||||
msg_scroll |= save_msg_scroll;
|
||||
}
|
||||
}
|
||||
|
||||
/// Passes input keys to Neovim. Unlike `vim_feedkeys`, this will use a
|
||||
/// lower-level input buffer and the call is not deferred.
|
||||
/// This is the most reliable way to emulate real user input.
|
||||
/// Passes keys to Nvim as raw user-input.
|
||||
/// On VimL error: Does not fail, but updates v:errmsg.
|
||||
///
|
||||
/// Unlike `nvim_feedkeys`, this uses a lower-level input buffer and the call
|
||||
/// is not deferred. This is the most reliable way to emulate real user input.
|
||||
///
|
||||
/// @param keys to be typed
|
||||
/// @return The number of bytes actually written, which can be lower than
|
||||
/// requested if the buffer becomes full.
|
||||
Integer vim_input(String keys)
|
||||
/// @return Number of bytes actually written (can be fewer than
|
||||
/// requested if the buffer becomes full).
|
||||
Integer nvim_input(String keys)
|
||||
FUNC_API_ASYNC
|
||||
{
|
||||
return (Integer)input_enqueue(keys);
|
||||
@@ -113,7 +123,7 @@ Integer vim_input(String keys)
|
||||
///
|
||||
/// @see replace_termcodes
|
||||
/// @see cpoptions
|
||||
String vim_replace_termcodes(String str, Boolean from_part, Boolean do_lt,
|
||||
String nvim_replace_termcodes(String str, Boolean from_part, Boolean do_lt,
|
||||
Boolean special)
|
||||
{
|
||||
if (str.size == 0) {
|
||||
@@ -133,10 +143,10 @@ String vim_replace_termcodes(String str, Boolean from_part, Boolean do_lt,
|
||||
return cstr_as_string(ptr);
|
||||
}
|
||||
|
||||
String vim_command_output(String str, Error *err)
|
||||
String nvim_command_output(String str, Error *err)
|
||||
{
|
||||
do_cmdline_cmd("redir => v:command_output");
|
||||
vim_command(str, err);
|
||||
nvim_command(str, err);
|
||||
do_cmdline_cmd("redir END");
|
||||
|
||||
if (err->set) {
|
||||
@@ -146,19 +156,19 @@ String vim_command_output(String str, Error *err)
|
||||
return cstr_to_string((char *)get_vim_var_str(VV_COMMAND_OUTPUT));
|
||||
}
|
||||
|
||||
/// Evaluates the expression str using the Vim internal expression
|
||||
/// evaluator (see |expression|).
|
||||
/// Dictionaries and lists are recursively expanded.
|
||||
/// Evaluates a VimL expression (:help expression).
|
||||
/// Dictionaries and Lists are recursively expanded.
|
||||
/// On VimL error: Returns a generic error; v:errmsg is not updated.
|
||||
///
|
||||
/// @param str The expression str
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The expanded object
|
||||
Object vim_eval(String str, Error *err)
|
||||
/// @param expr VimL expression string
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Evaluation result or expanded object
|
||||
Object nvim_eval(String expr, Error *err)
|
||||
{
|
||||
Object rv = OBJECT_INIT;
|
||||
// Evaluate the expression
|
||||
try_start();
|
||||
typval_T *expr_result = eval_expr((char_u *) str.data, NULL);
|
||||
typval_T *expr_result = eval_expr((char_u *)expr.data, NULL);
|
||||
|
||||
if (!expr_result) {
|
||||
api_set_error(err, Exception, _("Failed to evaluate expression"));
|
||||
@@ -174,13 +184,14 @@ Object vim_eval(String str, Error *err)
|
||||
return rv;
|
||||
}
|
||||
|
||||
/// Call the given function with the given arguments stored in an array.
|
||||
/// Calls a VimL function with the given arguments.
|
||||
/// On VimL error: Returns a generic error; v:errmsg is not updated.
|
||||
///
|
||||
/// @param fname Function to call
|
||||
/// @param args Functions arguments packed in an Array
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @param fname Function to call
|
||||
/// @param args Function arguments packed in an Array
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Result of the function call
|
||||
Object vim_call_function(String fname, Array args, Error *err)
|
||||
Object nvim_call_function(String fname, Array args, Error *err)
|
||||
{
|
||||
Object rv = OBJECT_INIT;
|
||||
if (args.size > MAX_FUNC_ARGS) {
|
||||
@@ -223,13 +234,13 @@ free_vim_args:
|
||||
return rv;
|
||||
}
|
||||
|
||||
/// Calculates the number of display cells `str` occupies, tab is counted as
|
||||
/// one cell.
|
||||
/// Calculates the number of display cells occupied by `text`.
|
||||
/// <Tab> counts as one cell.
|
||||
///
|
||||
/// @param str Some text
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The number of cells
|
||||
Integer vim_strwidth(String str, Error *err)
|
||||
/// @param text Some text
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Number of cells
|
||||
Integer nvim_strwidth(String str, Error *err)
|
||||
{
|
||||
if (str.size > INT_MAX) {
|
||||
api_set_error(err, Validation, _("String length is too high"));
|
||||
@@ -239,10 +250,10 @@ Integer vim_strwidth(String str, Error *err)
|
||||
return (Integer) mb_string2cells((char_u *) str.data);
|
||||
}
|
||||
|
||||
/// Gets a list of paths contained in 'runtimepath'
|
||||
/// Gets the paths contained in 'runtimepath'.
|
||||
///
|
||||
/// @return The list of paths
|
||||
ArrayOf(String) vim_list_runtime_paths(void)
|
||||
/// @return List of paths
|
||||
ArrayOf(String) nvim_list_runtime_paths(void)
|
||||
{
|
||||
Array rv = ARRAY_DICT_INIT;
|
||||
uint8_t *rtp = p_rtp;
|
||||
@@ -279,11 +290,11 @@ ArrayOf(String) vim_list_runtime_paths(void)
|
||||
return rv;
|
||||
}
|
||||
|
||||
/// Changes Vim working directory
|
||||
/// Changes the global working directory.
|
||||
///
|
||||
/// @param dir The new working directory
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
void vim_change_directory(String dir, Error *err)
|
||||
/// @param dir Directory path
|
||||
/// @param[out] err Error details, if any
|
||||
void nvim_set_current_dir(String dir, Error *err)
|
||||
{
|
||||
if (dir.size >= MAXPATHL) {
|
||||
api_set_error(err, Validation, _("Directory string is too long"));
|
||||
@@ -309,127 +320,148 @@ void vim_change_directory(String dir, Error *err)
|
||||
|
||||
/// Gets the current line
|
||||
///
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The current line string
|
||||
String vim_get_current_line(Error *err)
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Current line string
|
||||
String nvim_get_current_line(Error *err)
|
||||
{
|
||||
return buffer_get_line(curbuf->handle, curwin->w_cursor.lnum - 1, err);
|
||||
}
|
||||
|
||||
/// Sets the current line
|
||||
///
|
||||
/// @param line The line contents
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
void vim_set_current_line(String line, Error *err)
|
||||
/// @param line Line contents
|
||||
/// @param[out] err Error details, if any
|
||||
void nvim_set_current_line(String line, Error *err)
|
||||
{
|
||||
buffer_set_line(curbuf->handle, curwin->w_cursor.lnum - 1, line, err);
|
||||
}
|
||||
|
||||
/// Deletes the current line
|
||||
///
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
void vim_del_current_line(Error *err)
|
||||
/// @param[out] err Error details, if any
|
||||
void nvim_del_current_line(Error *err)
|
||||
{
|
||||
buffer_del_line(curbuf->handle, curwin->w_cursor.lnum - 1, err);
|
||||
}
|
||||
|
||||
/// Gets a global variable
|
||||
/// Gets a global (g:) variable
|
||||
///
|
||||
/// @param name The variable name
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The variable value
|
||||
Object vim_get_var(String name, Error *err)
|
||||
/// @param name Variable name
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Variable value
|
||||
Object nvim_get_var(String name, Error *err)
|
||||
{
|
||||
return dict_get_value(&globvardict, name, err);
|
||||
}
|
||||
|
||||
/// Sets a global (g:) variable
|
||||
///
|
||||
/// @param name Variable name
|
||||
/// @param value Variable value
|
||||
/// @param[out] err Error details, if any
|
||||
void nvim_set_var(String name, Object value, Error *err)
|
||||
{
|
||||
dict_set_value(&globvardict, name, value, false, false, err);
|
||||
}
|
||||
|
||||
/// Removes a global (g:) variable
|
||||
///
|
||||
/// @param name Variable name
|
||||
/// @param[out] err Error details, if any
|
||||
void nvim_del_var(String name, Error *err)
|
||||
{
|
||||
dict_set_value(&globvardict, name, NIL, true, false, err);
|
||||
}
|
||||
|
||||
/// Sets a global variable
|
||||
///
|
||||
/// @param name The variable name
|
||||
/// @param value The variable value
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The old value or nil if there was no previous value.
|
||||
/// @deprecated
|
||||
///
|
||||
/// @param name Variable name
|
||||
/// @param value Variable value
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Old value or nil if there was no previous value.
|
||||
///
|
||||
/// @warning It may return nil if there was no previous value
|
||||
/// or if previous value was `v:null`.
|
||||
Object vim_set_var(String name, Object value, Error *err)
|
||||
{
|
||||
return dict_set_value(&globvardict, name, value, false, err);
|
||||
return dict_set_value(&globvardict, name, value, false, true, err);
|
||||
}
|
||||
|
||||
/// Removes a global variable
|
||||
///
|
||||
/// @param name The variable name
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The old value or nil if there was no previous value.
|
||||
/// @deprecated
|
||||
///
|
||||
/// @warning It may return nil if there was no previous value
|
||||
/// or if previous value was `v:null`.
|
||||
/// @param name Variable name
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Old value
|
||||
Object vim_del_var(String name, Error *err)
|
||||
{
|
||||
return dict_set_value(&globvardict, name, NIL, true, err);
|
||||
return dict_set_value(&globvardict, name, NIL, true, true, err);
|
||||
}
|
||||
|
||||
/// Gets a vim variable
|
||||
/// Gets a v: variable
|
||||
///
|
||||
/// @param name The variable name
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The variable value
|
||||
Object vim_get_vvar(String name, Error *err)
|
||||
/// @param name Variable name
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Variable value
|
||||
Object nvim_get_vvar(String name, Error *err)
|
||||
{
|
||||
return dict_get_value(&vimvardict, name, err);
|
||||
}
|
||||
|
||||
/// Gets an option value string
|
||||
///
|
||||
/// @param name The option name
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The option value
|
||||
Object vim_get_option(String name, Error *err)
|
||||
/// @param name Option name
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Option value
|
||||
Object nvim_get_option(String name, Error *err)
|
||||
{
|
||||
return get_option_from(NULL, SREQ_GLOBAL, name, err);
|
||||
}
|
||||
|
||||
/// Sets an option value
|
||||
///
|
||||
/// @param name The option name
|
||||
/// @param value The new option value
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
void vim_set_option(String name, Object value, Error *err)
|
||||
/// @param name Option name
|
||||
/// @param value New option value
|
||||
/// @param[out] err Error details, if any
|
||||
void nvim_set_option(String name, Object value, Error *err)
|
||||
{
|
||||
set_option_to(NULL, SREQ_GLOBAL, name, value, err);
|
||||
}
|
||||
|
||||
/// Writes a message to vim output buffer
|
||||
///
|
||||
/// @param str The message
|
||||
void vim_out_write(String str)
|
||||
/// @param str Message
|
||||
void nvim_out_write(String str)
|
||||
{
|
||||
write_msg(str, false);
|
||||
}
|
||||
|
||||
/// Writes a message to vim error buffer
|
||||
///
|
||||
/// @param str The message
|
||||
void vim_err_write(String str)
|
||||
/// @param str Message
|
||||
void nvim_err_write(String str)
|
||||
{
|
||||
write_msg(str, true);
|
||||
}
|
||||
|
||||
/// Higher level error reporting function that ensures all str contents
|
||||
/// are written by sending a trailing linefeed to `vim_err_write`
|
||||
/// Writes a message to vim error buffer. Appends a linefeed to ensure all
|
||||
/// contents are written.
|
||||
///
|
||||
/// @param str The message
|
||||
void vim_report_error(String str)
|
||||
/// @param str Message
|
||||
/// @see nvim_err_write()
|
||||
void nvim_err_writeln(String str)
|
||||
{
|
||||
vim_err_write(str);
|
||||
vim_err_write((String) {.data = "\n", .size = 1});
|
||||
nvim_err_write(str);
|
||||
nvim_err_write((String) { .data = "\n", .size = 1 });
|
||||
}
|
||||
|
||||
/// Gets the current list of buffer handles
|
||||
///
|
||||
/// @return The number of buffers
|
||||
ArrayOf(Buffer) vim_get_buffers(void)
|
||||
/// @return List of buffer handles
|
||||
ArrayOf(Buffer) nvim_list_bufs(void)
|
||||
{
|
||||
Array rv = ARRAY_DICT_INIT;
|
||||
|
||||
@@ -449,17 +481,17 @@ ArrayOf(Buffer) vim_get_buffers(void)
|
||||
|
||||
/// Gets the current buffer
|
||||
///
|
||||
/// @reqturn The buffer handle
|
||||
Buffer vim_get_current_buffer(void)
|
||||
/// @return Buffer handle
|
||||
Buffer nvim_get_current_buf(void)
|
||||
{
|
||||
return curbuf->handle;
|
||||
}
|
||||
|
||||
/// Sets the current buffer
|
||||
///
|
||||
/// @param id The buffer handle
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
void vim_set_current_buffer(Buffer buffer, Error *err)
|
||||
/// @param id Buffer handle
|
||||
/// @param[out] err Error details, if any
|
||||
void nvim_set_current_buf(Buffer buffer, Error *err)
|
||||
{
|
||||
buf_T *buf = find_buffer_by_handle(buffer, err);
|
||||
|
||||
@@ -472,15 +504,15 @@ void vim_set_current_buffer(Buffer buffer, Error *err)
|
||||
if (!try_end(err) && result == FAIL) {
|
||||
api_set_error(err,
|
||||
Exception,
|
||||
_("Failed to switch to buffer %" PRIu64),
|
||||
_("Failed to switch to buffer %d"),
|
||||
buffer);
|
||||
}
|
||||
}
|
||||
|
||||
/// Gets the current list of window handles
|
||||
///
|
||||
/// @return The number of windows
|
||||
ArrayOf(Window) vim_get_windows(void)
|
||||
/// @return List of window handles
|
||||
ArrayOf(Window) nvim_list_wins(void)
|
||||
{
|
||||
Array rv = ARRAY_DICT_INIT;
|
||||
|
||||
@@ -500,16 +532,16 @@ ArrayOf(Window) vim_get_windows(void)
|
||||
|
||||
/// Gets the current window
|
||||
///
|
||||
/// @return The window handle
|
||||
Window vim_get_current_window(void)
|
||||
/// @return Window handle
|
||||
Window nvim_get_current_win(void)
|
||||
{
|
||||
return curwin->handle;
|
||||
}
|
||||
|
||||
/// Sets the current window
|
||||
///
|
||||
/// @param handle The window handle
|
||||
void vim_set_current_window(Window window, Error *err)
|
||||
/// @param handle Window handle
|
||||
void nvim_set_current_win(Window window, Error *err)
|
||||
{
|
||||
win_T *win = find_window_by_handle(window, err);
|
||||
|
||||
@@ -522,15 +554,15 @@ void vim_set_current_window(Window window, Error *err)
|
||||
if (!try_end(err) && win != curwin) {
|
||||
api_set_error(err,
|
||||
Exception,
|
||||
_("Failed to switch to window %" PRIu64),
|
||||
_("Failed to switch to window %d"),
|
||||
window);
|
||||
}
|
||||
}
|
||||
|
||||
/// Gets the current list of tabpage handles
|
||||
///
|
||||
/// @return The number of tab pages
|
||||
ArrayOf(Tabpage) vim_get_tabpages(void)
|
||||
/// @return List of tabpage handles
|
||||
ArrayOf(Tabpage) nvim_list_tabpages(void)
|
||||
{
|
||||
Array rv = ARRAY_DICT_INIT;
|
||||
|
||||
@@ -548,19 +580,19 @@ ArrayOf(Tabpage) vim_get_tabpages(void)
|
||||
return rv;
|
||||
}
|
||||
|
||||
/// Gets the current tab page
|
||||
/// Gets the current tabpage
|
||||
///
|
||||
/// @return The tab page handle
|
||||
Tabpage vim_get_current_tabpage(void)
|
||||
/// @return Tabpage handle
|
||||
Tabpage nvim_get_current_tabpage(void)
|
||||
{
|
||||
return curtab->handle;
|
||||
}
|
||||
|
||||
/// Sets the current tab page
|
||||
/// Sets the current tabpage
|
||||
///
|
||||
/// @param handle The tab page handle
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
void vim_set_current_tabpage(Tabpage tabpage, Error *err)
|
||||
/// @param handle Tabpage handle
|
||||
/// @param[out] err Error details, if any
|
||||
void nvim_set_current_tabpage(Tabpage tabpage, Error *err)
|
||||
{
|
||||
tabpage_T *tp = find_tab_by_handle(tabpage, err);
|
||||
|
||||
@@ -573,16 +605,17 @@ void vim_set_current_tabpage(Tabpage tabpage, Error *err)
|
||||
if (!try_end(err) && tp != curtab) {
|
||||
api_set_error(err,
|
||||
Exception,
|
||||
_("Failed to switch to tabpage %" PRIu64),
|
||||
_("Failed to switch to tabpage %d"),
|
||||
tabpage);
|
||||
}
|
||||
}
|
||||
|
||||
/// Subscribes to event broadcasts
|
||||
///
|
||||
/// @param channel_id The channel id (passed automatically by the dispatcher)
|
||||
/// @param event The event type string
|
||||
void vim_subscribe(uint64_t channel_id, String event)
|
||||
/// @param channel_id Channel id (passed automatically by the dispatcher)
|
||||
/// @param event Event type string
|
||||
void nvim_subscribe(uint64_t channel_id, String event)
|
||||
FUNC_API_NOEVAL
|
||||
{
|
||||
size_t length = (event.size < METHOD_MAXLEN ? event.size : METHOD_MAXLEN);
|
||||
char e[METHOD_MAXLEN + 1];
|
||||
@@ -593,9 +626,10 @@ void vim_subscribe(uint64_t channel_id, String event)
|
||||
|
||||
/// Unsubscribes to event broadcasts
|
||||
///
|
||||
/// @param channel_id The channel id (passed automatically by the dispatcher)
|
||||
/// @param event The event type string
|
||||
void vim_unsubscribe(uint64_t channel_id, String event)
|
||||
/// @param channel_id Channel id (passed automatically by the dispatcher)
|
||||
/// @param event Event type string
|
||||
void nvim_unsubscribe(uint64_t channel_id, String event)
|
||||
FUNC_API_NOEVAL
|
||||
{
|
||||
size_t length = (event.size < METHOD_MAXLEN ?
|
||||
event.size :
|
||||
@@ -606,12 +640,12 @@ void vim_unsubscribe(uint64_t channel_id, String event)
|
||||
channel_unsubscribe(channel_id, e);
|
||||
}
|
||||
|
||||
Integer vim_name_to_color(String name)
|
||||
Integer nvim_get_color_by_name(String name)
|
||||
{
|
||||
return name_to_color((uint8_t *)name.data);
|
||||
}
|
||||
|
||||
Dictionary vim_get_color_map(void)
|
||||
Dictionary nvim_get_color_map(void)
|
||||
{
|
||||
Dictionary colors = ARRAY_DICT_INIT;
|
||||
|
||||
@@ -623,8 +657,8 @@ Dictionary vim_get_color_map(void)
|
||||
}
|
||||
|
||||
|
||||
Array vim_get_api_info(uint64_t channel_id)
|
||||
FUNC_API_ASYNC
|
||||
Array nvim_get_api_info(uint64_t channel_id)
|
||||
FUNC_API_ASYNC FUNC_API_NOEVAL
|
||||
{
|
||||
Array rv = ARRAY_DICT_INIT;
|
||||
|
||||
@@ -635,13 +669,101 @@ Array vim_get_api_info(uint64_t channel_id)
|
||||
return rv;
|
||||
}
|
||||
|
||||
/// Call many api methods atomically
|
||||
///
|
||||
/// This has two main usages: Firstly, to perform several requests from an
|
||||
/// async context atomically, i.e. without processing requests from other rpc
|
||||
/// clients or redrawing or allowing user interaction in between. Note that api
|
||||
/// methods that could fire autocommands or do event processing still might do
|
||||
/// so. For instance invoking the :sleep command might call timer callbacks.
|
||||
/// Secondly, it can be used to reduce rpc overhead (roundtrips) when doing
|
||||
/// many requests in sequence.
|
||||
///
|
||||
/// @param calls an array of calls, where each call is described by an array
|
||||
/// with two elements: the request name, and an array of arguments.
|
||||
/// @param[out] err Details of a validation error of the nvim_multi_request call
|
||||
/// itself, i e malformatted `calls` parameter. Errors from called methods will
|
||||
/// be indicated in the return value, see below.
|
||||
///
|
||||
/// @return an array with two elements. The first is an array of return
|
||||
/// values. The second is NIL if all calls succeeded. If a call resulted in
|
||||
/// an error, it is a three-element array with the zero-based index of the call
|
||||
/// which resulted in an error, the error type and the error message. If an
|
||||
/// error ocurred, the values from all preceding calls will still be returned.
|
||||
Array nvim_call_atomic(uint64_t channel_id, Array calls, Error *err)
|
||||
FUNC_API_NOEVAL
|
||||
{
|
||||
Array rv = ARRAY_DICT_INIT;
|
||||
Array results = ARRAY_DICT_INIT;
|
||||
Error nested_error = ERROR_INIT;
|
||||
|
||||
size_t i; // also used for freeing the variables
|
||||
for (i = 0; i < calls.size; i++) {
|
||||
if (calls.items[i].type != kObjectTypeArray) {
|
||||
api_set_error(err,
|
||||
Validation,
|
||||
_("All items in calls array must be arrays"));
|
||||
goto validation_error;
|
||||
}
|
||||
Array call = calls.items[i].data.array;
|
||||
if (call.size != 2) {
|
||||
api_set_error(err,
|
||||
Validation,
|
||||
_("All items in calls array must be arrays of size 2"));
|
||||
goto validation_error;
|
||||
}
|
||||
|
||||
if (call.items[0].type != kObjectTypeString) {
|
||||
api_set_error(err,
|
||||
Validation,
|
||||
_("name must be String"));
|
||||
goto validation_error;
|
||||
}
|
||||
String name = call.items[0].data.string;
|
||||
|
||||
if (call.items[1].type != kObjectTypeArray) {
|
||||
api_set_error(err,
|
||||
Validation,
|
||||
_("args must be Array"));
|
||||
goto validation_error;
|
||||
}
|
||||
Array args = call.items[1].data.array;
|
||||
|
||||
MsgpackRpcRequestHandler handler = msgpack_rpc_get_handler_for(name.data,
|
||||
name.size);
|
||||
Object result = handler.fn(channel_id, args, &nested_error);
|
||||
if (nested_error.set) {
|
||||
// error handled after loop
|
||||
break;
|
||||
}
|
||||
|
||||
ADD(results, result);
|
||||
}
|
||||
|
||||
ADD(rv, ARRAY_OBJ(results));
|
||||
if (nested_error.set) {
|
||||
Array errval = ARRAY_DICT_INIT;
|
||||
ADD(errval, INTEGER_OBJ((Integer)i));
|
||||
ADD(errval, INTEGER_OBJ(nested_error.type));
|
||||
ADD(errval, STRING_OBJ(cstr_to_string(nested_error.msg)));
|
||||
ADD(rv, ARRAY_OBJ(errval));
|
||||
} else {
|
||||
ADD(rv, NIL);
|
||||
}
|
||||
return rv;
|
||||
|
||||
validation_error:
|
||||
api_free_array(results);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
/// Writes a message to vim output or error buffer. The string is split
|
||||
/// and flushed after each newline. Incomplete lines are kept for writing
|
||||
/// later.
|
||||
///
|
||||
/// @param message The message to write
|
||||
/// @param to_err true if it should be treated as an error message (use
|
||||
/// `emsg` instead of `msg` to print each line)
|
||||
/// @param message Message to write
|
||||
/// @param to_err true: message is an error (uses `emsg` instead of `msg`)
|
||||
static void write_msg(String message, bool to_err)
|
||||
{
|
||||
static size_t out_pos = 0, err_pos = 0;
|
||||
|
@@ -11,15 +11,14 @@
|
||||
#include "nvim/window.h"
|
||||
#include "nvim/screen.h"
|
||||
#include "nvim/move.h"
|
||||
#include "nvim/misc2.h"
|
||||
|
||||
|
||||
/// Gets the current buffer in a window
|
||||
///
|
||||
/// @param window The window handle
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The buffer handle
|
||||
Buffer window_get_buffer(Window window, Error *err)
|
||||
/// @param window Window handle
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Buffer handle
|
||||
Buffer nvim_win_get_buf(Window window, Error *err)
|
||||
{
|
||||
win_T *win = find_window_by_handle(window, err);
|
||||
|
||||
@@ -32,10 +31,10 @@ Buffer window_get_buffer(Window window, Error *err)
|
||||
|
||||
/// Gets the cursor position in the window
|
||||
///
|
||||
/// @param window The window handle
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return the (row, col) tuple
|
||||
ArrayOf(Integer, 2) window_get_cursor(Window window, Error *err)
|
||||
/// @param window Window handle
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return (row, col) tuple
|
||||
ArrayOf(Integer, 2) nvim_win_get_cursor(Window window, Error *err)
|
||||
{
|
||||
Array rv = ARRAY_DICT_INIT;
|
||||
win_T *win = find_window_by_handle(window, err);
|
||||
@@ -50,10 +49,10 @@ ArrayOf(Integer, 2) window_get_cursor(Window window, Error *err)
|
||||
|
||||
/// Sets the cursor position in the window
|
||||
///
|
||||
/// @param window The window handle
|
||||
/// @param pos the (row, col) tuple representing the new position
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
void window_set_cursor(Window window, ArrayOf(Integer, 2) pos, Error *err)
|
||||
/// @param window Window handle
|
||||
/// @param pos (row, col) tuple representing the new position
|
||||
/// @param[out] err Error details, if any
|
||||
void nvim_win_set_cursor(Window window, ArrayOf(Integer, 2) pos, Error *err)
|
||||
{
|
||||
win_T *win = find_window_by_handle(window, err);
|
||||
|
||||
@@ -96,10 +95,10 @@ void window_set_cursor(Window window, ArrayOf(Integer, 2) pos, Error *err)
|
||||
|
||||
/// Gets the window height
|
||||
///
|
||||
/// @param window The window handle
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return the height in rows
|
||||
Integer window_get_height(Window window, Error *err)
|
||||
/// @param window Window handle
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Height as a count of rows
|
||||
Integer nvim_win_get_height(Window window, Error *err)
|
||||
{
|
||||
win_T *win = find_window_by_handle(window, err);
|
||||
|
||||
@@ -113,10 +112,10 @@ Integer window_get_height(Window window, Error *err)
|
||||
/// Sets the window height. This will only succeed if the screen is split
|
||||
/// horizontally.
|
||||
///
|
||||
/// @param window The window handle
|
||||
/// @param height the new height in rows
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
void window_set_height(Window window, Integer height, Error *err)
|
||||
/// @param window Window handle
|
||||
/// @param height Height as a count of rows
|
||||
/// @param[out] err Error details, if any
|
||||
void nvim_win_set_height(Window window, Integer height, Error *err)
|
||||
{
|
||||
win_T *win = find_window_by_handle(window, err);
|
||||
|
||||
@@ -139,10 +138,10 @@ void window_set_height(Window window, Integer height, Error *err)
|
||||
|
||||
/// Gets the window width
|
||||
///
|
||||
/// @param window The window handle
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return the width in columns
|
||||
Integer window_get_width(Window window, Error *err)
|
||||
/// @param window Window handle
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Width as a count of columns
|
||||
Integer nvim_win_get_width(Window window, Error *err)
|
||||
{
|
||||
win_T *win = find_window_by_handle(window, err);
|
||||
|
||||
@@ -156,10 +155,10 @@ Integer window_get_width(Window window, Error *err)
|
||||
/// Sets the window width. This will only succeed if the screen is split
|
||||
/// vertically.
|
||||
///
|
||||
/// @param window The window handle
|
||||
/// @param width the new width in columns
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
void window_set_width(Window window, Integer width, Error *err)
|
||||
/// @param window Window handle
|
||||
/// @param width Width as a count of columns
|
||||
/// @param[out] err Error details, if any
|
||||
void nvim_win_set_width(Window window, Integer width, Error *err)
|
||||
{
|
||||
win_T *win = find_window_by_handle(window, err);
|
||||
|
||||
@@ -182,11 +181,11 @@ void window_set_width(Window window, Integer width, Error *err)
|
||||
|
||||
/// Gets a window-scoped (w:) variable
|
||||
///
|
||||
/// @param window The window handle
|
||||
/// @param name The variable name
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The variable value
|
||||
Object window_get_var(Window window, String name, Error *err)
|
||||
/// @param window Window handle
|
||||
/// @param name Variable name
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Variable value
|
||||
Object nvim_win_get_var(Window window, String name, Error *err)
|
||||
{
|
||||
win_T *win = find_window_by_handle(window, err);
|
||||
|
||||
@@ -199,11 +198,46 @@ Object window_get_var(Window window, String name, Error *err)
|
||||
|
||||
/// Sets a window-scoped (w:) variable
|
||||
///
|
||||
/// @param window The window handle
|
||||
/// @param name The variable name
|
||||
/// @param value The variable value
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The old value or nil if there was no previous value.
|
||||
/// @param window Window handle
|
||||
/// @param name Variable name
|
||||
/// @param value Variable value
|
||||
/// @param[out] err Error details, if any
|
||||
void nvim_win_set_var(Window window, String name, Object value, Error *err)
|
||||
{
|
||||
win_T *win = find_window_by_handle(window, err);
|
||||
|
||||
if (!win) {
|
||||
return;
|
||||
}
|
||||
|
||||
dict_set_value(win->w_vars, name, value, false, false, err);
|
||||
}
|
||||
|
||||
/// Removes a window-scoped (w:) variable
|
||||
///
|
||||
/// @param window Window handle
|
||||
/// @param name Variable name
|
||||
/// @param[out] err Error details, if any
|
||||
void nvim_win_del_var(Window window, String name, Error *err)
|
||||
{
|
||||
win_T *win = find_window_by_handle(window, err);
|
||||
|
||||
if (!win) {
|
||||
return;
|
||||
}
|
||||
|
||||
dict_set_value(win->w_vars, name, NIL, true, false, err);
|
||||
}
|
||||
|
||||
/// Sets a window-scoped (w:) variable
|
||||
///
|
||||
/// @deprecated
|
||||
///
|
||||
/// @param window Window handle
|
||||
/// @param name Variable name
|
||||
/// @param value Variable value
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Old value or nil if there was no previous value.
|
||||
///
|
||||
/// @warning It may return nil if there was no previous value
|
||||
/// or if previous value was `v:null`.
|
||||
@@ -215,18 +249,17 @@ Object window_set_var(Window window, String name, Object value, Error *err)
|
||||
return (Object) OBJECT_INIT;
|
||||
}
|
||||
|
||||
return dict_set_value(win->w_vars, name, value, false, err);
|
||||
return dict_set_value(win->w_vars, name, value, false, true, err);
|
||||
}
|
||||
|
||||
/// Removes a window-scoped (w:) variable
|
||||
///
|
||||
/// @param window The window handle
|
||||
/// @param name The variable name
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The old value or nil if there was no previous value.
|
||||
/// @deprecated
|
||||
///
|
||||
/// @warning It may return nil if there was no previous value
|
||||
/// or if previous value was `v:null`.
|
||||
/// @param window Window handle
|
||||
/// @param name variable name
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Old value
|
||||
Object window_del_var(Window window, String name, Error *err)
|
||||
{
|
||||
win_T *win = find_window_by_handle(window, err);
|
||||
@@ -235,16 +268,16 @@ Object window_del_var(Window window, String name, Error *err)
|
||||
return (Object) OBJECT_INIT;
|
||||
}
|
||||
|
||||
return dict_set_value(win->w_vars, name, NIL, true, err);
|
||||
return dict_set_value(win->w_vars, name, NIL, true, true, err);
|
||||
}
|
||||
|
||||
/// Gets a window option value
|
||||
///
|
||||
/// @param window The window handle
|
||||
/// @param name The option name
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The option value
|
||||
Object window_get_option(Window window, String name, Error *err)
|
||||
/// @param window Window handle
|
||||
/// @param name Option name
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Option value
|
||||
Object nvim_win_get_option(Window window, String name, Error *err)
|
||||
{
|
||||
win_T *win = find_window_by_handle(window, err);
|
||||
|
||||
@@ -258,11 +291,11 @@ Object window_get_option(Window window, String name, Error *err)
|
||||
/// Sets a window option value. Passing 'nil' as value deletes the option(only
|
||||
/// works if there's a global fallback)
|
||||
///
|
||||
/// @param window The window handle
|
||||
/// @param name The option name
|
||||
/// @param value The option value
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
void window_set_option(Window window, String name, Object value, Error *err)
|
||||
/// @param window Window handle
|
||||
/// @param name Option name
|
||||
/// @param value Option value
|
||||
/// @param[out] err Error details, if any
|
||||
void nvim_win_set_option(Window window, String name, Object value, Error *err)
|
||||
{
|
||||
win_T *win = find_window_by_handle(window, err);
|
||||
|
||||
@@ -275,10 +308,10 @@ void window_set_option(Window window, String name, Object value, Error *err)
|
||||
|
||||
/// Gets the window position in display cells. First position is zero.
|
||||
///
|
||||
/// @param window The window handle
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The (row, col) tuple with the window position
|
||||
ArrayOf(Integer, 2) window_get_position(Window window, Error *err)
|
||||
/// @param window Window handle
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return (row, col) tuple with the window position
|
||||
ArrayOf(Integer, 2) nvim_win_get_position(Window window, Error *err)
|
||||
{
|
||||
Array rv = ARRAY_DICT_INIT;
|
||||
win_T *win = find_window_by_handle(window, err);
|
||||
@@ -291,12 +324,12 @@ ArrayOf(Integer, 2) window_get_position(Window window, Error *err)
|
||||
return rv;
|
||||
}
|
||||
|
||||
/// Gets the window tab page
|
||||
/// Gets the window tabpage
|
||||
///
|
||||
/// @param window The window handle
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The tab page that contains the window
|
||||
Tabpage window_get_tabpage(Window window, Error *err)
|
||||
/// @param window Window handle
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Tabpage that contains the window
|
||||
Tabpage nvim_win_get_tabpage(Window window, Error *err)
|
||||
{
|
||||
Tabpage rv = 0;
|
||||
win_T *win = find_window_by_handle(window, err);
|
||||
@@ -308,11 +341,31 @@ Tabpage window_get_tabpage(Window window, Error *err)
|
||||
return rv;
|
||||
}
|
||||
|
||||
/// Gets the window number
|
||||
///
|
||||
/// @param window Window handle
|
||||
/// @param[out] err Error details, if any
|
||||
/// @return Window number
|
||||
Integer nvim_win_get_number(Window window, Error *err)
|
||||
{
|
||||
int rv = 0;
|
||||
win_T *win = find_window_by_handle(window, err);
|
||||
|
||||
if (!win) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
int tabnr;
|
||||
win_get_tabwin(window, &tabnr, &rv);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/// Checks if a window is valid
|
||||
///
|
||||
/// @param window The window handle
|
||||
/// @param window Window handle
|
||||
/// @return true if the window is valid, false otherwise
|
||||
Boolean window_is_valid(Window window)
|
||||
Boolean nvim_win_is_valid(Window window)
|
||||
{
|
||||
Error stub = ERROR_INIT;
|
||||
return find_window_by_handle(window, &stub) != NULL;
|
||||
|
@@ -36,6 +36,7 @@
|
||||
#include "nvim/ex_eval.h"
|
||||
#include "nvim/ex_getln.h"
|
||||
#include "nvim/fileio.h"
|
||||
#include "nvim/file_search.h"
|
||||
#include "nvim/fold.h"
|
||||
#include "nvim/getchar.h"
|
||||
#include "nvim/hashtab.h"
|
||||
@@ -48,7 +49,6 @@
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/message.h"
|
||||
#include "nvim/misc1.h"
|
||||
#include "nvim/misc2.h"
|
||||
#include "nvim/garray.h"
|
||||
#include "nvim/move.h"
|
||||
#include "nvim/option.h"
|
||||
@@ -268,6 +268,9 @@ open_buffer (
|
||||
bool buf_valid(buf_T *buf)
|
||||
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
if (buf == NULL) {
|
||||
return false;
|
||||
}
|
||||
FOR_ALL_BUFFERS(bp) {
|
||||
if (bp == buf) {
|
||||
return true;
|
||||
@@ -276,30 +279,25 @@ bool buf_valid(buf_T *buf)
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Close the link to a buffer.
|
||||
* "action" is used when there is no longer a window for the buffer.
|
||||
* It can be:
|
||||
* 0 buffer becomes hidden
|
||||
* DOBUF_UNLOAD buffer is unloaded
|
||||
* DOBUF_DELETE buffer is unloaded and removed from buffer list
|
||||
* DOBUF_WIPE buffer is unloaded and really deleted
|
||||
* When doing all but the first one on the current buffer, the caller should
|
||||
* get a new buffer very soon!
|
||||
*
|
||||
* The 'bufhidden' option can force freeing and deleting.
|
||||
*
|
||||
* When "abort_if_last" is TRUE then do not close the buffer if autocommands
|
||||
* cause there to be only one window with this buffer. e.g. when ":quit" is
|
||||
* supposed to close the window but autocommands close all other windows.
|
||||
*/
|
||||
void
|
||||
close_buffer (
|
||||
win_T *win, /* if not NULL, set b_last_cursor */
|
||||
buf_T *buf,
|
||||
int action,
|
||||
int abort_if_last
|
||||
)
|
||||
/// Close the link to a buffer.
|
||||
///
|
||||
/// @param win If not NULL, set b_last_cursor.
|
||||
/// @param buf
|
||||
/// @param action Used when there is no longer a window for the buffer.
|
||||
/// Possible values:
|
||||
/// 0 buffer becomes hidden
|
||||
/// DOBUF_UNLOAD buffer is unloaded
|
||||
/// DOBUF_DELETE buffer is unloaded and removed from buffer list
|
||||
/// DOBUF_WIPE buffer is unloaded and really deleted
|
||||
/// When doing all but the first one on the current buffer, the
|
||||
/// caller should get a new buffer very soon!
|
||||
/// The 'bufhidden' option can force freeing and deleting.
|
||||
/// @param abort_if_last
|
||||
/// If TRUE, do not close the buffer if autocommands cause
|
||||
/// there to be only one window with this buffer. e.g. when
|
||||
/// ":quit" is supposed to close the window but autocommands
|
||||
/// close all other windows.
|
||||
void close_buffer(win_T *win, buf_T *buf, int action, int abort_if_last)
|
||||
{
|
||||
bool unload_buf = (action != 0);
|
||||
bool del_buf = (action == DOBUF_DEL || action == DOBUF_WIPE);
|
||||
@@ -328,13 +326,14 @@ close_buffer (
|
||||
wipe_buf = true;
|
||||
}
|
||||
|
||||
if (win_valid(win)) {
|
||||
/* Set b_last_cursor when closing the last window for the buffer.
|
||||
* Remember the last cursor position and window options of the buffer.
|
||||
* This used to be only for the current window, but then options like
|
||||
* 'foldmethod' may be lost with a ":only" command. */
|
||||
if (buf->b_nwindows == 1)
|
||||
if (win_valid_any_tab(win)) {
|
||||
// Set b_last_cursor when closing the last window for the buffer.
|
||||
// Remember the last cursor position and window options of the buffer.
|
||||
// This used to be only for the current window, but then options like
|
||||
// 'foldmethod' may be lost with a ":only" command.
|
||||
if (buf->b_nwindows == 1) {
|
||||
set_last_cursor(win);
|
||||
}
|
||||
buflist_setfpos(buf, win,
|
||||
win->w_cursor.lnum == 1 ? 0 : win->w_cursor.lnum,
|
||||
win->w_cursor.col, TRUE);
|
||||
@@ -407,7 +406,7 @@ close_buffer (
|
||||
buf->b_nwindows = nwindows;
|
||||
|
||||
buf_freeall(buf, (del_buf ? BFA_DEL : 0) + (wipe_buf ? BFA_WIPE : 0));
|
||||
if (win_valid(win) && win->w_buffer == buf) {
|
||||
if (win_valid_any_tab(win) && win->w_buffer == buf) {
|
||||
win->w_buffer = NULL; // make sure we don't use the buffer now
|
||||
}
|
||||
|
||||
@@ -483,17 +482,32 @@ void buf_clear_file(buf_T *buf)
|
||||
buf->b_ml.ml_flags = ML_EMPTY; /* empty buffer */
|
||||
}
|
||||
|
||||
/*
|
||||
* buf_freeall() - free all things allocated for a buffer that are related to
|
||||
* the file. flags:
|
||||
* BFA_DEL buffer is going to be deleted
|
||||
* BFA_WIPE buffer is going to be wiped out
|
||||
* BFA_KEEP_UNDO do not free undo information
|
||||
*/
|
||||
/// Clears the current buffer contents.
|
||||
void buf_clear(void)
|
||||
{
|
||||
linenr_T line_count = curbuf->b_ml.ml_line_count;
|
||||
while (!(curbuf->b_ml.ml_flags & ML_EMPTY)) {
|
||||
ml_delete((linenr_T)1, false);
|
||||
}
|
||||
deleted_lines_mark(1, line_count); // prepare for display
|
||||
ml_close(curbuf, true); // free memline_T
|
||||
buf_clear_file(curbuf);
|
||||
}
|
||||
|
||||
/// buf_freeall() - free all things allocated for a buffer that are related to
|
||||
/// the file. Careful: get here with "curwin" NULL when exiting.
|
||||
///
|
||||
/// @param flags BFA_DEL buffer is going to be deleted
|
||||
/// BFA_WIPE buffer is going to be wiped out
|
||||
/// BFA_KEEP_UNDO do not free undo information
|
||||
void buf_freeall(buf_T *buf, int flags)
|
||||
{
|
||||
bool is_curbuf = (buf == curbuf);
|
||||
int is_curwin = (curwin != NULL && curwin->w_buffer == buf);
|
||||
win_T *the_curwin = curwin;
|
||||
tabpage_T *the_curtab = curtab;
|
||||
|
||||
// Make sure the buffer isn't closed by autocommands.
|
||||
buf->b_closing = true;
|
||||
apply_autocmds(EVENT_BUFUNLOAD, buf->b_fname, buf->b_fname, FALSE, buf);
|
||||
if (!buf_valid(buf)) /* autocommands may delete the buffer */
|
||||
@@ -510,8 +524,18 @@ void buf_freeall(buf_T *buf, int flags)
|
||||
return;
|
||||
}
|
||||
buf->b_closing = false;
|
||||
if (aborting()) /* autocmds may abort script processing */
|
||||
|
||||
// If the buffer was in curwin and the window has changed, go back to that
|
||||
// window, if it still exists. This avoids that ":edit x" triggering a
|
||||
// "tabnext" BufUnload autocmd leaves a window behind without a buffer.
|
||||
if (is_curwin && curwin != the_curwin && win_valid_any_tab(the_curwin)) {
|
||||
block_autocmds();
|
||||
goto_tabpage_win(the_curtab, the_curwin);
|
||||
unblock_autocmds();
|
||||
}
|
||||
if (aborting()) { // autocmds may abort script processing
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* It's possible that autocommands change curbuf to the one being deleted.
|
||||
@@ -662,14 +686,15 @@ void handle_swap_exists(buf_T *old_curbuf)
|
||||
* aborting() returns FALSE when closing a buffer. */
|
||||
enter_cleanup(&cs);
|
||||
|
||||
/* User selected Quit at ATTENTION prompt. Go back to previous
|
||||
* buffer. If that buffer is gone or the same as the current one,
|
||||
* open a new, empty buffer. */
|
||||
swap_exists_action = SEA_NONE; /* don't want it again */
|
||||
swap_exists_did_quit = TRUE;
|
||||
close_buffer(curwin, curbuf, DOBUF_UNLOAD, FALSE);
|
||||
if (!buf_valid(old_curbuf) || old_curbuf == curbuf)
|
||||
// User selected Quit at ATTENTION prompt. Go back to previous
|
||||
// buffer. If that buffer is gone or the same as the current one,
|
||||
// open a new, empty buffer.
|
||||
swap_exists_action = SEA_NONE; // don't want it again
|
||||
swap_exists_did_quit = true;
|
||||
close_buffer(curwin, curbuf, DOBUF_UNLOAD, false);
|
||||
if (!buf_valid(old_curbuf) || old_curbuf == curbuf) {
|
||||
old_curbuf = buflist_new(NULL, NULL, 1L, BLN_CURBUF | BLN_LISTED);
|
||||
}
|
||||
if (old_curbuf != NULL) {
|
||||
enter_buffer(old_curbuf);
|
||||
if (old_tw != curbuf->b_p_tw)
|
||||
@@ -1310,28 +1335,29 @@ void do_autochdir(void)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* functions for dealing with the buffer list
|
||||
*/
|
||||
//
|
||||
// functions for dealing with the buffer list
|
||||
//
|
||||
|
||||
/*
|
||||
* Add a file name to the buffer list. Return a pointer to the buffer.
|
||||
* If the same file name already exists return a pointer to that buffer.
|
||||
* If it does not exist, or if fname == NULL, a new entry is created.
|
||||
* If (flags & BLN_CURBUF) is TRUE, may use current buffer.
|
||||
* If (flags & BLN_LISTED) is TRUE, add new buffer to buffer list.
|
||||
* If (flags & BLN_DUMMY) is TRUE, don't count it as a real buffer.
|
||||
* This is the ONLY way to create a new buffer.
|
||||
*/
|
||||
static int top_file_num = 1; /* highest file number */
|
||||
static int top_file_num = 1; ///< highest file number
|
||||
|
||||
buf_T *
|
||||
buflist_new (
|
||||
char_u *ffname, /* full path of fname or relative */
|
||||
char_u *sfname, /* short fname or NULL */
|
||||
linenr_T lnum, /* preferred cursor line */
|
||||
int flags /* BLN_ defines */
|
||||
)
|
||||
/// Add a file name to the buffer list.
|
||||
/// If the same file name already exists return a pointer to that buffer.
|
||||
/// If it does not exist, or if fname == NULL, a new entry is created.
|
||||
/// If (flags & BLN_CURBUF) is TRUE, may use current buffer.
|
||||
/// If (flags & BLN_LISTED) is TRUE, add new buffer to buffer list.
|
||||
/// If (flags & BLN_DUMMY) is TRUE, don't count it as a real buffer.
|
||||
/// If (flags & BLN_NEW) is TRUE, don't use an existing buffer.
|
||||
/// This is the ONLY way to create a new buffer.
|
||||
///
|
||||
/// @param ffname full path of fname or relative
|
||||
/// @param sfname short fname or NULL
|
||||
/// @param lnum preferred cursor line
|
||||
/// @param flags BLN_ defines
|
||||
/// @param bufnr
|
||||
///
|
||||
/// @return pointer to the buffer
|
||||
buf_T * buflist_new(char_u *ffname, char_u *sfname, linenr_T lnum, int flags)
|
||||
{
|
||||
buf_T *buf;
|
||||
|
||||
@@ -1397,8 +1423,7 @@ buflist_new (
|
||||
}
|
||||
if (buf != curbuf || curbuf == NULL) {
|
||||
buf = xcalloc(1, sizeof(buf_T));
|
||||
handle_register_buffer(buf);
|
||||
/* init b: variables */
|
||||
// init b: variables
|
||||
buf->b_vars = dict_alloc();
|
||||
init_var_dict(buf->b_vars, &buf->b_bufvar, VAR_SCOPE);
|
||||
}
|
||||
@@ -1451,11 +1476,12 @@ buflist_new (
|
||||
lastbuf = buf;
|
||||
|
||||
buf->b_fnum = top_file_num++;
|
||||
if (top_file_num < 0) { /* wrap around (may cause duplicates) */
|
||||
handle_register_buffer(buf);
|
||||
if (top_file_num < 0) { // wrap around (may cause duplicates)
|
||||
EMSG(_("W14: Warning: List of file names overflow"));
|
||||
if (emsg_silent == 0) {
|
||||
ui_flush();
|
||||
os_delay(3000L, true); /* make sure it is noticed */
|
||||
os_delay(3000L, true); // make sure it is noticed
|
||||
}
|
||||
top_file_num = 1;
|
||||
}
|
||||
@@ -2365,10 +2391,11 @@ buf_T *setaltfname(char_u *ffname, char_u *sfname, linenr_T lnum)
|
||||
{
|
||||
buf_T *buf;
|
||||
|
||||
/* Create a buffer. 'buflisted' is not set if it's a new buffer */
|
||||
// Create a buffer. 'buflisted' is not set if it's a new buffer
|
||||
buf = buflist_new(ffname, sfname, lnum, 0);
|
||||
if (buf != NULL && !cmdmod.keepalt)
|
||||
if (buf != NULL && !cmdmod.keepalt) {
|
||||
curwin->w_alt_fnum = buf->b_fnum;
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
@@ -2403,8 +2430,9 @@ int buflist_add(char_u *fname, int flags)
|
||||
buf_T *buf;
|
||||
|
||||
buf = buflist_new(fname, NULL, (linenr_T)0, flags);
|
||||
if (buf != NULL)
|
||||
if (buf != NULL) {
|
||||
return buf->b_fnum;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -4514,7 +4542,7 @@ chk_modeline (
|
||||
char_u *e;
|
||||
char_u *linecopy; /* local copy of any modeline found */
|
||||
int prev;
|
||||
int vers;
|
||||
intmax_t vers;
|
||||
int end;
|
||||
int retval = OK;
|
||||
char_u *save_sourcing_name;
|
||||
@@ -4533,7 +4561,10 @@ chk_modeline (
|
||||
e = s + 4;
|
||||
else
|
||||
e = s + 3;
|
||||
vers = getdigits_int(&e);
|
||||
if (getdigits_safe(&e, &vers) != OK) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (*e == ':'
|
||||
&& (s[0] != 'V'
|
||||
|| STRNCMP(skipwhite(e + 1), "set", 3) == 0)
|
||||
@@ -4541,8 +4572,9 @@ chk_modeline (
|
||||
|| (VIM_VERSION_100 >= vers && isdigit(s[3]))
|
||||
|| (VIM_VERSION_100 < vers && s[3] == '<')
|
||||
|| (VIM_VERSION_100 > vers && s[3] == '>')
|
||||
|| (VIM_VERSION_100 == vers && s[3] == '=')))
|
||||
|| (VIM_VERSION_100 == vers && s[3] == '='))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
prev = *s;
|
||||
@@ -5231,12 +5263,30 @@ wipe_buffer (
|
||||
int aucmd /* When TRUE trigger autocommands. */
|
||||
)
|
||||
{
|
||||
if (buf->b_fnum == top_file_num - 1)
|
||||
--top_file_num;
|
||||
|
||||
if (!aucmd) /* Don't trigger BufDelete autocommands here. */
|
||||
if (!aucmd) {
|
||||
// Don't trigger BufDelete autocommands here.
|
||||
block_autocmds();
|
||||
close_buffer(NULL, buf, DOBUF_WIPE, FALSE);
|
||||
if (!aucmd)
|
||||
}
|
||||
close_buffer(NULL, buf, DOBUF_WIPE, false);
|
||||
if (!aucmd) {
|
||||
unblock_autocmds();
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates or switches to a scratch buffer. :h special-buffers
|
||||
/// Scratch buffer is:
|
||||
/// - buftype=nofile bufhidden=hide noswapfile
|
||||
/// - Always considered 'nomodified'
|
||||
///
|
||||
/// @param bufnr Buffer to switch to, or 0 to create a new buffer.
|
||||
///
|
||||
/// @see curbufIsChanged()
|
||||
void buf_open_scratch(handle_T bufnr, char *bufname)
|
||||
{
|
||||
(void)do_ecmd((int)bufnr, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, NULL);
|
||||
(void)setfname(curbuf, (char_u *)bufname, NULL, true);
|
||||
set_option_value((char_u *)"bh", 0L, (char_u *)"hide", OPT_LOCAL);
|
||||
set_option_value((char_u *)"bt", 0L, (char_u *)"nofile", OPT_LOCAL);
|
||||
set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
|
||||
RESET_BINDING(curwin);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user